summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Elements/SenchaArray.h
blob: 963253649c5db4d211ce94b7c5a3b60cf9541230 (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
/*
 * SenchaArray.h
 *
 *  Created on: Jan 10, 2013
 *      Author: att
 */

#ifndef SENCHAARRAY_H_
#define SENCHAARRAY_H_
#include "SenchaObject.h"
#include "Element.h"
#include "../ContextManager.h"

/**
 * SenchaArray is an abstraction of array element in a language.
 * It provides access to its elements and some basic methods.
 * It uses context_manager to evaluate its elements. SenchaArray is created on the go and stored nowhere.
 */
class SenchaArray: public Element {
public:
	/**
	 * Basic, universal constructor.
	 */
	SenchaArray(std::string name, ContextManager * context_manager);

	/**
	 * Special constructor, used to deal with strings
	 */
	SenchaArray(std::string name, ContextManager * context_manager, std::string);

	typedef int IndexNumber;

	IndexNumber add(SenchaObject value);
	void set(IndexNumber index, SenchaObject value);
	SenchaObject get(IndexNumber index);
	virtual ~SenchaArray();
private:
	ContextManager * context_manager;
	std::string name;
	IndexNumber max_index;


};

#endif /* SENCHAARRAY_H_ */