diff options
author | Marius Kintel <marius@kintel.net> | 2011-09-03 04:10:36 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-09-03 04:10:36 (GMT) |
commit | 6f632190a05417d44193e3b16a7b3000b2cc1145 (patch) | |
tree | 9ddccef57c10361a7019274f79f1d86edb7630d3 /src/context.h | |
parent | 3129189342f3da7322efa0b860ff3ff676ba7b77 (diff) |
Ported a bunch of stuff from Qt to STL
Diffstat (limited to 'src/context.h')
-rw-r--r-- | src/context.h | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/context.h b/src/context.h index cbb1c4f..99726a9 100644 --- a/src/context.h +++ b/src/context.h @@ -1,38 +1,43 @@ #ifndef CONTEXT_H_ #define CONTEXT_H_ -#include <QHash> -#include <QString> +#include <string> +#include <vector> +#include <boost/unordered_map.hpp> #include "value.h" +using boost::unordered_map; + class Context { public: const Context *parent; - QHash<QString, Value> constants; - QHash<QString, Value> variables; - QHash<QString, Value> config_variables; - const QHash<QString, class AbstractFunction*> *functions_p; - const QHash<QString, class AbstractModule*> *modules_p; - const QHash<QString, class Module*> *usedlibs_p; + typedef unordered_map<std::string, Value> ValueMap; + ValueMap constants; + ValueMap variables; + ValueMap config_variables; + const unordered_map<std::string, class AbstractFunction*> *functions_p; + const unordered_map<std::string, class AbstractModule*> *modules_p; + typedef unordered_map<std::string, class Module*> ModuleContainer; + const ModuleContainer *usedlibs_p; const class ModuleInstantiation *inst_p; - QString document_path; + std::string document_path; - static QVector<const Context*> ctx_stack; + static std::vector<const Context*> ctx_stack; Context(const Context *parent = NULL); ~Context(); - void args(const QVector<QString> &argnames, const QVector<class Expression*> &argexpr, const QVector<QString> &call_argnames, const QVector<Value> &call_argvalues); + void args(const std::vector<std::string> &argnames, const std::vector<class Expression*> &argexpr, const std::vector<std::string> &call_argnames, const std::vector<Value> &call_argvalues); - void set_variable(QString name, Value value); - Value lookup_variable(QString name, bool silent = false) const; + void set_variable(const std::string &name, Value value); + Value lookup_variable(const std::string &name, bool silent = false) const; - void set_constant(QString name, Value value); + void set_constant(const std::string &name, Value value); - QString get_absolute_path(const QString &filename) const; + std::string get_absolute_path(const std::string &filename) const; - Value evaluate_function(QString name, const QVector<QString> &argnames, const QVector<Value> &argvalues) const; + Value evaluate_function(const std::string &name, const std::vector<std::string> &argnames, const std::vector<Value> &argvalues) const; class AbstractNode *evaluate_module(const ModuleInstantiation *inst) const; }; |