-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayLiteral.h
More file actions
46 lines (35 loc) · 813 Bytes
/
ArrayLiteral.h
File metadata and controls
46 lines (35 loc) · 813 Bytes
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
#ifndef ARRAYLITERAL_H
#define ARRAYLITERAL_H
#include <memory>
#include <vector>
#include "Expression.h"
class ArrayLiteral : public Expression
{
std::vector<std::shared_ptr<Expression>> elements;
public:
ArrayLiteral()
{
}
void Add (std::shared_ptr<Expression> element)
{
elements.push_back(element);
}
virtual picojson::value asJson(std::shared_ptr<Substitution> subs, bool forConditionSection) const
{
std::vector<picojson::value> arr;
for (const std::shared_ptr<Expression>& e : elements)
{
arr.push_back(e->asJson(subs, forConditionSection));
}
return picojson::value(arr);
}
virtual ExpressionForm getForm() const
{
return ARRAY_LITERAL;
}
virtual std::wstring getType(std::shared_ptr<Substitution> subs) const
{
return L"array";
}
};
#endif // ARRAYLITERAL_H