Sha256: 8970abf0d94784cc7b42f5ee8366b1f99ccbe98b79fe1a09c1d856e94540b413

Contents?: true

Size: 1.62 KB

Versions: 10

Compression:

Stored size: 1.62 KB

Contents

#ifndef SASS_AST_DEF_MACROS_H
#define SASS_AST_DEF_MACROS_H

// Helper class to switch a flag and revert once we go out of scope
template <class T>
class LocalOption {
  private:
    T* var; // pointer to original variable
    T orig; // copy of the original option
  public:
    LocalOption(T& var)
    {
      this->var = &var;
      this->orig = var;
    }
    LocalOption(T& var, T orig)
    {
      this->var = &var;
      this->orig = var;
      *(this->var) = orig;
    }
    ~LocalOption() {
      *(this->var) = this->orig;
    }
};

#define LOCAL_FLAG(name,opt) LocalOption<bool> flag_##name(name, opt)

#define ATTACH_OPERATIONS()\
virtual void perform(Operation<void>* op) { (*op)(this); }\
virtual AST_Node* perform(Operation<AST_Node*>* op) { return (*op)(this); }\
virtual Statement* perform(Operation<Statement*>* op) { return (*op)(this); }\
virtual Expression* perform(Operation<Expression*>* op) { return (*op)(this); }\
virtual Selector* perform(Operation<Selector*>* op) { return (*op)(this); }\
virtual std::string perform(Operation<std::string>* op) { return (*op)(this); }\
virtual union Sass_Value* perform(Operation<union Sass_Value*>* op) { return (*op)(this); }\
virtual Value* perform(Operation<Value*>* op) { return (*op)(this); }

#define ADD_PROPERTY(type, name)\
protected:\
  type name##_;\
public:\
  type name() const        { return name##_; }\
  type name(type name##__) { return name##_ = name##__; }\
private:

#define ADD_HASHED(type, name)\
protected:\
  type name##_;\
public:\
  type name() const        { return name##_; }\
  type name(type name##__) { hash_ = 0; return name##_ = name##__; }\
private:

#endif

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
sassc-1.11.1 ext/libsass/src/ast_def_macros.hpp
sassc-1.11.0 ext/libsass/src/ast_def_macros.hpp
sassc-1.10.1 ext/libsass/src/ast_def_macros.hpp
sassc-1.10.0 ext/libsass/src/ast_def_macros.hpp
blackboard-3.1.9 lib/site_template/node_modules/node-sass/src/libsass/src/ast_def_macros.hpp
sassc-1.9.0 ext/libsass/src/ast_def_macros.hpp
sassc-1.8.5 ext/libsass/src/ast_def_macros.hpp
sassc-1.8.4 ext/libsass/src/ast_def_macros.hpp
sassc-1.8.3 ext/libsass/src/ast_def_macros.hpp
sassc-1.8.2 ext/libsass/src/ast_def_macros.hpp