source: dev/BasicCompiler_Common/include/Source.h@ 88

Last change on this file since 88 was 88, checked in by dai_9181, 17 years ago

House→Smoothie
Sourceクラスを用意した。

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 void Realloc( int newLength ){
32 buffer = (char *)realloc( buffer, newLength + 255 );
33
34 length = newLength;
35
36 extern char *basbuf;
37 basbuf = buffer + 2;
38 }
39
40 void IncludeFiles();
41
42 void ChangeReturnLineChar();
43
44 void RemoveComments();
45
46 bool ReadFile_InIncludeDirective( const string &filePath );
47 void DirectiveIncludeOrRequire();
48
49 void RemoveReturnLineUnderbar();
50
51public:
52 BasicSource(){}
53 ~BasicSource(){}
54
55 char *GetBuffer(){
56 return buffer+2;
57 }
58 int GetLength(){
59 return length-2;
60 }
61
62 void SetBuffer( const char *buffer );
63
64 bool ReadFile( const string &filePath );
65
66 bool Generate( const string &genName, const char *buffer );
67
68 void Addition( const char *buffer );
69
70 void operator = ( const BasicSource &source ){
71 Realloc( source.length );
72 lstrcpy( buffer, source.buffer );
73 }
74};
Note: See TracBrowser for help on using the repository browser.