-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsli_dicttype.h
51 lines (43 loc) · 1022 Bytes
/
sli_dicttype.h
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
49
50
51
#ifndef SLI_DICTTYPE_H
#define SLI_DICTTYPE_H
#include "sli_type.h"
#include "sli_dictionary.h"
#include <cassert>
namespace sli3
{
class DictionaryType: public SLIType
{
public:
DictionaryType(SLIInterpreter *sli, char const name[], sli_typeid type)
:SLIType(sli, name, type){}
refcount_t add_reference(Token const& t) const
{
if(t.data_.dict_val !=0)
return t.data_.dict_val->add_reference();
else
return 0;
}
void remove_reference(Token &t) const
{
if(t.data_.dict_val->remove_reference() ==0)
{
t.type_=0;
t.data_.dict_val=0;
}
}
void clear(Token &t) const
{
remove_reference(t);
t.data_.dict_val=0;
t.type_=0;
}
refcount_t references(Token const &t) const
{
return t.data_.dict_val->references();
}
bool compare(const Token&t1, const Token&t2) const;
std::ostream & print(std::ostream&, const Token &) const;
std::ostream & pprint(std::ostream&, const Token &) const;
};
}
#endif