source: dev/trunk/abdev/BasicCompiler_Common/src/ObjectModule.cpp@ 279

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

sourceをObjectModuleに入れた

File size: 2.0 KB
Line 
1#include "stdafx.h"
2
3#include <Compiler.h>
4
5enum ObjectModuleDataType
6{
7 ObjectModuleDataTypeXml,
8 ObjectModuleDataTypeText,
9 ObjectModuleDataTypeBinaly,
10};
11const ObjectModuleDataType objectModuleDataType = ObjectModuleDataTypeText;
12
13
14void ObjectModule::StaticLink( ObjectModule &objectModule )
15{
16 // メタ情報を結合
17 meta.StaticLink( objectModule.meta, dataTable.GetSize() );
18
19 // ネイティブコードを結合
20 globalNativeCode.Put( objectModule.globalNativeCode );
21 globalNativeCode.ResetDataSectionBaseOffset( dataTable.GetSize() );
22
23 // データテーブルを結合
24 dataTable.Add( objectModule.dataTable );
25}
26
27bool ObjectModule::Read( const std::string &filePath )
28{
29 switch( objectModuleDataType )
30 {
31 case ObjectModuleDataTypeXml:
32 return ReadXml( filePath );
33 case ObjectModuleDataTypeText:
34 return ReadText( filePath );
35 case ObjectModuleDataTypeBinaly:
36 return ReadBinary( filePath );
37 default:
38 Jenga::Throw( "" );
39 break;
40 }
41 return false;
42}
43bool ObjectModule::Write( const std::string &filePath ) const
44{
45 switch( objectModuleDataType )
46 {
47 case ObjectModuleDataTypeXml:
48 return WriteXml( filePath );
49 case ObjectModuleDataTypeText:
50 return WriteText( filePath );
51 case ObjectModuleDataTypeBinaly:
52 return WriteBinary( filePath );
53 default:
54 Jenga::Throw( "" );
55 break;
56 }
57 return false;
58}
59bool ObjectModule::ReadString( const std::string &str )
60{
61 switch( objectModuleDataType )
62 {
63 case ObjectModuleDataTypeXml:
64 return ReadXmlString( str );
65 case ObjectModuleDataTypeText:
66 return ReadTextString( str );
67 case ObjectModuleDataTypeBinaly:
68 Jenga::Throw( "" );
69 break;
70 default:
71 Jenga::Throw( "" );
72 break;
73 }
74 return false;
75}
76bool ObjectModule::WriteString( std::string &str ) const
77{
78 switch( objectModuleDataType )
79 {
80 case ObjectModuleDataTypeXml:
81 return WriteXmlString( str );
82 case ObjectModuleDataTypeText:
83 return WriteTextString( str );
84 case ObjectModuleDataTypeBinaly:
85 Jenga::Throw( "" );
86 break;
87 default:
88 Jenga::Throw( "" );
89 break;
90 }
91 return false;
92}
Note: See TracBrowser for help on using the repository browser.