summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Elements/SenchaArray.cpp
blob: 3d48b114dd18a805ca0be7b9894e83b973ed4b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * SenchaArray.cpp
 *
 *  Created on: Jan 10, 2013
 *      Author: att
 */

#include "SenchaArray.h"

SenchaArray::SenchaArray() {
	// TODO Auto-generated constructor stub
	max_index = 0;
}

SenchaArray::~SenchaArray() {
	// TODO Auto-generated destructor stub
}


SenchaArray::SenchaArray(std::string text)
{
	for(unsigned int i = 0; i < text.size(); i++)
	{
		SenchaObject temp;
		std::string letter_string = text.substr(i, 1) ;
		temp.text = letter_string;
		temp.type = SenchaObject::string_literal;
		objects.push_back(temp);
	}
	max_index = objects.size();
}

SenchaObject SenchaArray::get(IndexNumber index)
{
 return objects[index];
}

SenchaArray::IndexNumber SenchaArray::add(SenchaObject value)
{
	objects.push_back(value);
	max_index = objects.size();
	return max_index;
}

void SenchaArray::set(IndexNumber index, SenchaObject value)
{
	objects[index] = value;
}