source: dev/trunk/abdev/BasicCompiler_Common/Const.h@ 199

Last change on this file since 199 was 188, checked in by dai_9181, 17 years ago
File size: 1.9 KB
Line 
1#pragma once
2
3#include <jenga/include/smoothie/Type.h>
4
5//定数の基底クラス
6class ConstBase{
7 const string name;
8 const NamespaceScopes namespaceScopes;
9
10public:
11
12 ConstBase( const NamespaceScopes &namespaceScopes, const string &name )
13 : namespaceScopes( namespaceScopes )
14 , name( name )
15 {
16 }
17 ~ConstBase()
18 {
19 }
20
21 const string &GetName() const
22 {
23 return name;
24 }
25
26 bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
27 bool IsEqualSymbol( const string &name ) const;
28};
29
30//定数
31class CConst:public ConstBase{
32 Type type;
33 _int64 i64data;
34
35public:
36 CConst *pNext;
37
38 CConst( const NamespaceScopes &namespaceScopes, const string &name, const Type &newType, _int64 i64data);
39 CConst( const NamespaceScopes &namespaceScopes, const string &name, int value);
40 ~CConst();
41
42 Type GetType();
43 _int64 GetWholeData();
44 double GetDoubleData();
45};
46
47//定数マクロ
48class CConstMacro:public ConstBase{
49 int ParmNum;
50 char **ppParm;
51public:
52
53 CConstMacro( const NamespaceScopes &namespaceScopes, const string &name, char *Expression);
54 ~CConstMacro();
55};
56
57//定数管理クラス
58class CDBConst{
59 CConst **ppHash;
60
61 CConstMacro **ppobj_Macro;
62 int NumOfMacro;
63
64 //シングルトンクラスなので、プライベートに置く
65 CDBConst();
66 ~CDBConst();
67 void _free();
68 void Free();
69
70public:
71
72 void Init();
73
74 void Add( const NamespaceScopes &namespaceScopes, char *buffer);
75private:
76 void AddConst( const string &name, CConst *newconst);
77public:
78 void AddConst( const NamespaceScopes &namespaceScopes, const string &name, char *Expression);
79 void AddConst( const NamespaceScopes &namespaceScopes, const string &name, int value);
80
81private:
82 CConst *GetObjectPtr( const string &name );
83public:
84
85 int GetBasicType(char *Name);
86 _int64 GetWholeData(char *Name);
87 double GetDoubleData(char *Name);
88 bool IsStringPtr(char *Name);
89
90
91 //シングルトンオブジェクト
92 static CDBConst obj;
93};
Note: See TracBrowser for help on using the repository browser.