summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Elements/SenchaArray.cpp
diff options
context:
space:
mode:
authorJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-12 19:20:47 +0100
committerJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-12 19:20:47 +0100
commit3a449cb09b812ef7017f584ff3968c40a4f6a83a (patch)
treea46d2dbf8af84042f2410c86aad4a1a493faf062 /Sencha-lang/Elements/SenchaArray.cpp
parent7d60b159cc5a63f3835d253a109ae5999bf29fc5 (diff)
downloadsencha-lang-3a449cb09b812ef7017f584ff3968c40a4f6a83a.tar.gz
sencha-lang-3a449cb09b812ef7017f584ff3968c40a4f6a83a.tar.bz2
sencha-lang-3a449cb09b812ef7017f584ff3968c40a4f6a83a.tar.xz
sencha-lang-3a449cb09b812ef7017f584ff3968c40a4f6a83a.zip
Small changes in Array. New programming examples. Comments enabled.
Diffstat (limited to 'Sencha-lang/Elements/SenchaArray.cpp')
-rw-r--r--Sencha-lang/Elements/SenchaArray.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/Sencha-lang/Elements/SenchaArray.cpp b/Sencha-lang/Elements/SenchaArray.cpp
index 1bd004d..be69825 100644
--- a/Sencha-lang/Elements/SenchaArray.cpp
+++ b/Sencha-lang/Elements/SenchaArray.cpp
@@ -9,12 +9,12 @@
-SenchaArray::SenchaArray(std::string name, Context * context) {
+SenchaArray::SenchaArray(std::string name, ContextManager * context_manager) {
// TODO Auto-generated constructor stub
max_index = 0;
- this->context = context;
+ this->context_manager = context_manager;
this->name = name;
- context->add(name, SenchaObject());
+ context_manager->get_top()->add(name, SenchaObject());
}
SenchaArray::~SenchaArray() {
@@ -22,10 +22,10 @@ SenchaArray::~SenchaArray() {
}
-SenchaArray::SenchaArray(std::string name, Context * context, std::string text)
+SenchaArray::SenchaArray(std::string name, ContextManager * context_manager, std::string text)
{
max_index = 0;
- this->context = context;
+ this->context_manager = context_manager;
this->name = name;
for(unsigned int i = 0; i < text.size(); i++)
{
@@ -33,7 +33,7 @@ SenchaArray::SenchaArray(std::string name, Context * context, std::string text)
std::string letter_string = text.substr(i, 1) ;
temp.text = letter_string;
temp.type = SenchaObject::string_literal;
- context->add("_" + name+ "_" + to_string(i), temp);
+ context_manager->get_top()->add("_" + name+ "_" + to_string(i), temp);
//objects.push_back(temp);
}
max_index = text.size();
@@ -42,7 +42,7 @@ SenchaArray::SenchaArray(std::string name, Context * context, std::string text)
SenchaObject SenchaArray::get(IndexNumber index)
{
- SenchaObject result = context->get("_" + name +"_" +to_string(index));
+ SenchaObject result = context_manager->get_top()->get("_" + name +"_" +to_string(index));
result.name = "_" + name + "_" + to_string(index);
return result;
//return objects[index];
@@ -50,15 +50,14 @@ SenchaObject SenchaArray::get(IndexNumber index)
SenchaArray::IndexNumber SenchaArray::add(SenchaObject value)
{
- context->add("_" + name+ "_" + to_string(max_index), value);
+ context_manager->get_top()->add("_" + name+ "_" + to_string(max_index), value);
max_index++;
- //objects.push_back(value);
- max_index = objects.size();
+
return max_index;
}
void SenchaArray::set(IndexNumber index, SenchaObject value)
{
//objects[index] = value;
- context->add("_" + name +"_" +to_string(index), value);
+ context_manager->get_top()->add("_" + name +"_" +to_string(index), value);
}