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