summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Context.h
diff options
context:
space:
mode:
authorJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-13 17:36:38 +0100
committerJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-13 17:36:38 +0100
commit058a18c612c6d4f33779058b07ba80b3854f2275 (patch)
tree6fcb75fb0ba30fc6104e83863aa93f3e15375c1e /Sencha-lang/Context.h
parent837d4c4bce813919f6713f76c7c24404951751f6 (diff)
downloadsencha-lang-master.tar.gz
sencha-lang-master.tar.bz2
sencha-lang-master.zip
More documentaaaaation.HEADmaster
Diffstat (limited to 'Sencha-lang/Context.h')
-rw-r--r--Sencha-lang/Context.h66
1 files changed, 57 insertions, 9 deletions
diff --git a/Sencha-lang/Context.h b/Sencha-lang/Context.h
index c432924..bd537b1 100644
--- a/Sencha-lang/Context.h
+++ b/Sencha-lang/Context.h
@@ -24,29 +24,77 @@
*/
class Context {
public:
+ /**
+ * Context has unique name, which is passed to it in constructor.
+ */
Context(std::string name);
std::string name;
+
+ /**
+ * Typedef to make further declarations easier to read.
+ */
typedef SenchaObject (*PointerToNativeFunction)(std::vector<ASTExpression *>);
+
+ /**
+ * Function have to be declared, which means here, registered before usage.
+ * You can register them with register_function functions.
+ */
void register_function(std::string name, PointerToNativeFunction f);
void register_function(std::string name, SenchaFunction * f);
+ /**
+ * Map with function written in C++ stored like {"my_function" : &my_function}
+ */
+ std::map<std::string, PointerToNativeFunction> registered_functions;
+ /**
+ * Map with function written in Sencha stored like {"my_function" : &my_function}
+ */
+ std::map<std::string, SenchaFunction *> registered_sfunctions;
+
+ /**
+ * contains_function("x") returns true if x can be found in registered native (c++) or sencha functions.
+ */
+ bool contains_function(std::string name);
+
+ /**
+ * contains_function("x") returns true if x can be found in registered sencha functions.
+ */
+ bool contains_sfunction(std::string name);
+
+ /**
+ * contains_function("x") returns true if x can be found in registered native (c++).
+ */
+ bool contains_nfunction(std::string name);
+
+ /**
+ * Executes function written in c++
+ */
SenchaObject execute_native_function(std::string name, std::vector<ASTExpression *> arguments);
+
+ /**
+ * get_updated_string(name) return string of given name with all updates done on its elements such as name[9] = "a";
+ */
SenchaObject get_updated_string(std::string name);
+
+ /**
+ * debug() provides very useful info about context. What variables are stored, what are their values.
+ */
std::string debug() ;
+
+ /**
+ * add(name, value) adds value called name to object store.
+ */
void add(std::string name, SenchaObject object);
- void set(std::string name, SenchaObject object);
+
+ /**
+ * get(name) returns value from object store. If there isn't such a value. It returns SenchaObject();
+ */
SenchaObject get(std::string name);
- bool contains_function(std::string name);
- bool contains_sfunction(std::string name);
- bool contains_nfunction(std::string name);
- std::map<std::string, PointerToNativeFunction> registered_functions;
- std::map<std::string, SenchaFunction *> registered_sfunctions;
+
+
virtual ~Context();
private:
unsigned int index;
-
-
-
std::map<std::string, SenchaObject> object_store;
};