source: dev/trunk/abdev/BasicCompiler_Common/include/Source.h@ 152

Last change on this file since 152 was 89, checked in by dai_9181, 18 years ago

実行時型情報の生成に対応。
関数の戻り値の型に抽象クラスを指定できるようにした。

File size: 1.2 KB
Line 
1#pragma once
2
3#include <vector>
4#include <string>
5
6#include <windows.h>
7#include <stdlib.h>
8
9using namespace std;
10
11class Text{
12protected:
13 char *buffer;
14 int length;
15
16public:
17
18 Text(){
19 buffer = (char *)calloc( 1, 1 );
20 length = 0;
21 }
22 ~Text(){
23 free( buffer );
24 }
25
26 bool ReadFile( const string &filePath );
27};
28
29class BasicSource : public Text
30{
31 static const string generateDirectiveName;
32
33 void Realloc( int newLength ){
34 buffer = (char *)realloc( buffer, newLength + 255 );
35
36 length = newLength;
37
38 extern char *basbuf;
39 basbuf = buffer + 2;
40 }
41
42 void IncludeFiles();
43
44 void ChangeReturnLineChar();
45
46 void RemoveComments();
47
48 bool ReadFile_InIncludeDirective( const string &filePath );
49 void DirectiveIncludeOrRequire();
50
51 void RemoveReturnLineUnderbar();
52
53public:
54 BasicSource(){}
55 ~BasicSource(){}
56
57 char *GetBuffer(){
58 return buffer+2;
59 }
60 int GetLength(){
61 return length-2;
62 }
63
64 void SetBuffer( const char *buffer );
65
66 bool ReadFile( const string &filePath );
67
68 bool Generate( const string &genName, const char *buffer );
69
70 void Addition( const char *buffer );
71
72 void operator = ( const BasicSource &source ){
73 Realloc( source.length );
74 lstrcpy( buffer, source.buffer );
75 }
76};
Note: See TracBrowser for help on using the repository browser.