[184] | 1 | #pragma once
|
---|
| 2 |
|
---|
[206] | 3 | #include <option.h>
|
---|
| 4 | #include <Program.h>
|
---|
| 5 | #include <Prototype.h>
|
---|
[382] | 6 | #include <Type.h>
|
---|
[206] | 7 | #include <Method.h>
|
---|
| 8 | #include <Member.h>
|
---|
[266] | 9 | #include <Source.h>
|
---|
[184] | 10 |
|
---|
[206] | 11 | class UserProc;
|
---|
[290] | 12 | class CClass;
|
---|
[325] | 13 | class Delegate;
|
---|
[206] | 14 |
|
---|
[344] | 15 | class DynamicMethodsPrototype
|
---|
[184] | 16 | {
|
---|
[342] | 17 | // 動的メソッド
|
---|
| 18 | Methods dynamicMethods;
|
---|
| 19 |
|
---|
| 20 | // XMLシリアライズ用
|
---|
| 21 | private:
|
---|
| 22 | friend class boost::serialization::access;
|
---|
| 23 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
| 24 | {
|
---|
| 25 | ar & BOOST_SERIALIZATION_NVP( dynamicMethods );
|
---|
| 26 | }
|
---|
| 27 |
|
---|
[184] | 28 | public:
|
---|
[344] | 29 | DynamicMethodsPrototype(){}
|
---|
| 30 | DynamicMethodsPrototype( const DynamicMethodsPrototype &dynamicMethodsPrototype )
|
---|
| 31 | : dynamicMethods( dynamicMethodsPrototype.dynamicMethods )
|
---|
[342] | 32 | {
|
---|
| 33 | }
|
---|
[344] | 34 | ~DynamicMethodsPrototype(){}
|
---|
| 35 |
|
---|
[342] | 36 | const Methods &GetDynamicMethods() const
|
---|
| 37 | {
|
---|
| 38 | return dynamicMethods;
|
---|
| 39 | }
|
---|
| 40 | Methods &GetDynamicMethods()
|
---|
| 41 | {
|
---|
| 42 | return dynamicMethods;
|
---|
| 43 | }
|
---|
[344] | 44 |
|
---|
| 45 | void AddDynamicMethods( CMethod *pMethod )
|
---|
| 46 | {
|
---|
| 47 | dynamicMethods.push_back( pMethod );
|
---|
| 48 | }
|
---|
[342] | 49 | };
|
---|
| 50 |
|
---|
[344] | 51 | class ClassPrototype : public Prototype, public DynamicMethodsPrototype
|
---|
[342] | 52 | {
|
---|
[344] | 53 | // XMLシリアライズ用
|
---|
| 54 | private:
|
---|
| 55 | friend class boost::serialization::access;
|
---|
| 56 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
| 57 | {
|
---|
| 58 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Prototype );
|
---|
| 59 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( DynamicMethodsPrototype );
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | public:
|
---|
| 63 | ClassPrototype( const NamespaceScopes &namespaceScopes, const string &name )
|
---|
| 64 | : Prototype( namespaceScopes, name )
|
---|
| 65 | , DynamicMethodsPrototype()
|
---|
| 66 | {
|
---|
| 67 | }
|
---|
| 68 | ClassPrototype()
|
---|
| 69 | : Prototype()
|
---|
| 70 | , DynamicMethodsPrototype()
|
---|
| 71 | {
|
---|
| 72 | }
|
---|
| 73 | };
|
---|
| 74 |
|
---|
| 75 | class Interface : public DynamicMethodsPrototype
|
---|
| 76 | {
|
---|
[342] | 77 | const CClass *pInterfaceClass;
|
---|
[345] | 78 | mutable LONG_PTR vtblOffset;
|
---|
[344] | 79 |
|
---|
[376] | 80 | // 型パラメータ(実パラメータ)
|
---|
| 81 | Types actualTypeParameters;
|
---|
| 82 |
|
---|
[353] | 83 | // XMLシリアライズ用
|
---|
| 84 | private:
|
---|
| 85 | friend class boost::serialization::access;
|
---|
| 86 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
| 87 | {
|
---|
| 88 | trace_for_serialize( "serializing - Interface" );
|
---|
| 89 |
|
---|
| 90 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( DynamicMethodsPrototype );
|
---|
| 91 | ar & boost::serialization::make_nvp("pInterfaceClass", const_cast<CClass *&>(pInterfaceClass) );
|
---|
| 92 | ar & BOOST_SERIALIZATION_NVP( vtblOffset );
|
---|
[376] | 93 | ar & BOOST_SERIALIZATION_NVP( actualTypeParameters );
|
---|
[353] | 94 | }
|
---|
| 95 |
|
---|
[342] | 96 | public:
|
---|
[376] | 97 | Interface( const CClass *pInterfaceClass, const Types &actualTypeParameters );
|
---|
[344] | 98 | Interface( const Interface &objInterface )
|
---|
| 99 | : DynamicMethodsPrototype( objInterface )
|
---|
| 100 | , pInterfaceClass( objInterface.pInterfaceClass )
|
---|
| 101 | , vtblOffset( objInterface.vtblOffset )
|
---|
| 102 | {
|
---|
| 103 | }
|
---|
[353] | 104 | Interface()
|
---|
| 105 | {
|
---|
| 106 | }
|
---|
[206] | 107 |
|
---|
[342] | 108 | const CClass &GetClass() const{
|
---|
[206] | 109 | return *pInterfaceClass;
|
---|
| 110 | }
|
---|
[342] | 111 | LONG_PTR GetVtblOffset() const
|
---|
[191] | 112 | {
|
---|
[206] | 113 | return vtblOffset;
|
---|
[191] | 114 | }
|
---|
[342] | 115 | void SetVtblOffset( LONG_PTR vtblOffset ) const
|
---|
| 116 | {
|
---|
| 117 | this->vtblOffset = vtblOffset;
|
---|
| 118 | }
|
---|
[376] | 119 |
|
---|
| 120 | const Types &GetActualTypeParameters() const
|
---|
| 121 | {
|
---|
| 122 | return actualTypeParameters;
|
---|
| 123 | }
|
---|
[378] | 124 |
|
---|
| 125 | std::string GetFullNameWithActualGenericTypeParameters() const;
|
---|
[206] | 126 | };
|
---|
[346] | 127 | typedef std::vector<Interface *> Interfaces;
|
---|
[184] | 128 |
|
---|
[342] | 129 | class CClass: public ClassPrototype, public Jenga::Common::ObjectInHashmap<CClass>
|
---|
[206] | 130 | {
|
---|
| 131 | public:
|
---|
| 132 | // 型の種類
|
---|
| 133 | enum ClassType{
|
---|
| 134 | Class,
|
---|
| 135 | Interface,
|
---|
[370] | 136 | ComInterface,
|
---|
[206] | 137 | Enum,
|
---|
| 138 | Delegate,
|
---|
| 139 | Structure,
|
---|
| 140 | };
|
---|
[193] | 141 |
|
---|
[206] | 142 | private:
|
---|
| 143 | ClassType classType;
|
---|
[184] | 144 |
|
---|
[206] | 145 | // importされている名前空間
|
---|
| 146 | NamespaceScopesCollection importedNamespaces;
|
---|
[290] | 147 |
|
---|
| 148 | // 型パラメータ
|
---|
| 149 | GenericTypes formalGenericTypes;
|
---|
| 150 |
|
---|
[382] | 151 | // 基底クラス
|
---|
[206] | 152 | const CClass *pSuperClass;
|
---|
[184] | 153 |
|
---|
[382] | 154 | // 基底クラスの型パラメータ(実パラメータ)
|
---|
[299] | 155 | Types superClassActualTypeParameters;
|
---|
| 156 |
|
---|
[206] | 157 | // Blittable型情報
|
---|
| 158 | Type blittableType;
|
---|
[184] | 159 |
|
---|
[206] | 160 | // 実装するインターフェイス
|
---|
| 161 | Interfaces interfaces;
|
---|
[191] | 162 |
|
---|
[206] | 163 | // 動的メンバ
|
---|
| 164 | Members dynamicMembers;
|
---|
[191] | 165 |
|
---|
[206] | 166 | // 静的メンバ
|
---|
| 167 | Members staticMembers;
|
---|
| 168 |
|
---|
| 169 | // 動的メソッド
|
---|
| 170 | int ConstructorMemberSubIndex;
|
---|
| 171 | int DestructorMemberSubIndex;
|
---|
| 172 | int vtblNum; // 仮想関数の数
|
---|
| 173 |
|
---|
| 174 | // 静的メソッド
|
---|
| 175 | Methods staticMethods;
|
---|
| 176 |
|
---|
[232] | 177 | //アラインメント値
|
---|
| 178 | int fixedAlignment;
|
---|
| 179 |
|
---|
[191] | 180 | // XMLシリアライズ用
|
---|
| 181 | private:
|
---|
| 182 | friend class boost::serialization::access;
|
---|
| 183 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
| 184 | {
|
---|
[206] | 185 | trace_for_serialize( "serializing - CClass" );
|
---|
| 186 |
|
---|
[342] | 187 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( ClassPrototype );
|
---|
[206] | 188 | ar & BOOST_SERIALIZATION_NVP( classType );
|
---|
| 189 | ar & BOOST_SERIALIZATION_NVP( importedNamespaces );
|
---|
[293] | 190 | ar & BOOST_SERIALIZATION_NVP( formalGenericTypes );
|
---|
[206] | 191 | ar & boost::serialization::make_nvp( "pSuperClass", const_cast<CClass *&>(pSuperClass) );
|
---|
[299] | 192 | ar & BOOST_SERIALIZATION_NVP( superClassActualTypeParameters );
|
---|
[206] | 193 | ar & BOOST_SERIALIZATION_NVP( blittableType );
|
---|
[353] | 194 | ar & BOOST_SERIALIZATION_NVP( interfaces );
|
---|
[206] | 195 | ar & BOOST_SERIALIZATION_NVP( dynamicMembers );
|
---|
| 196 | ar & BOOST_SERIALIZATION_NVP( staticMembers );
|
---|
| 197 | ar & BOOST_SERIALIZATION_NVP( ConstructorMemberSubIndex );
|
---|
| 198 | ar & BOOST_SERIALIZATION_NVP( DestructorMemberSubIndex );
|
---|
| 199 | ar & BOOST_SERIALIZATION_NVP( vtblNum );
|
---|
| 200 | ar & BOOST_SERIALIZATION_NVP( staticMethods );
|
---|
[232] | 201 | ar & BOOST_SERIALIZATION_NVP( fixedAlignment );
|
---|
[191] | 202 | }
|
---|
[184] | 203 |
|
---|
[206] | 204 | bool isReady;
|
---|
[184] | 205 | public:
|
---|
[206] | 206 |
|
---|
| 207 | CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name )
|
---|
[342] | 208 | : ClassPrototype( namespaceScopes, name )
|
---|
[206] | 209 | , importedNamespaces( importedNamespaces )
|
---|
| 210 | , classType( Class )
|
---|
| 211 | , pSuperClass( NULL )
|
---|
[290] | 212 | , blittableType( Type() )
|
---|
[206] | 213 | , isReady( false )
|
---|
[232] | 214 | , fixedAlignment( 0 )
|
---|
[206] | 215 | , ConstructorMemberSubIndex( -1 )
|
---|
| 216 | , DestructorMemberSubIndex( -1 )
|
---|
| 217 | , vtblNum( 0 )
|
---|
| 218 | , vtbl_offset( -1 )
|
---|
[370] | 219 | , comVtblOffset( 0 )
|
---|
[206] | 220 | , isCompilingConstructor( false )
|
---|
| 221 | , isCompilingDestructor( false )
|
---|
| 222 | , pobj_NextClass( NULL )
|
---|
[409] | 223 | , cacheSize( 0 )
|
---|
[191] | 224 | {
|
---|
| 225 | }
|
---|
[206] | 226 | CClass()
|
---|
[342] | 227 | : ClassPrototype()
|
---|
[206] | 228 | , importedNamespaces()
|
---|
| 229 | , classType()
|
---|
| 230 | , pSuperClass( NULL )
|
---|
[290] | 231 | , blittableType( Type() )
|
---|
[206] | 232 | , isReady( false )
|
---|
[232] | 233 | , fixedAlignment( 0 )
|
---|
[206] | 234 | , ConstructorMemberSubIndex( -1 )
|
---|
| 235 | , DestructorMemberSubIndex( -1 )
|
---|
| 236 | , vtblNum( 0 )
|
---|
| 237 | , vtbl_offset( -1 )
|
---|
[370] | 238 | , comVtblOffset( 0 )
|
---|
[206] | 239 | , isCompilingConstructor( false )
|
---|
| 240 | , isCompilingDestructor( false )
|
---|
| 241 | , pobj_NextClass( NULL )
|
---|
[409] | 242 | , cacheSize( 0 )
|
---|
[206] | 243 | {
|
---|
| 244 | }
|
---|
| 245 | ~CClass()
|
---|
| 246 | {
|
---|
| 247 | // 動的メンバ
|
---|
[346] | 248 | BOOST_FOREACH( CMember *member, dynamicMembers )
|
---|
| 249 | {
|
---|
[206] | 250 | delete member;
|
---|
| 251 | }
|
---|
[191] | 252 |
|
---|
[206] | 253 | // 静的メンバ
|
---|
[346] | 254 | BOOST_FOREACH( CMember *member, staticMembers )
|
---|
| 255 | {
|
---|
[206] | 256 | delete member;
|
---|
| 257 | }
|
---|
[346] | 258 |
|
---|
| 259 | // インターフェイス
|
---|
| 260 | BOOST_FOREACH( ::Interface *pInterface, interfaces )
|
---|
| 261 | {
|
---|
| 262 | delete pInterface;
|
---|
| 263 | }
|
---|
[206] | 264 | }
|
---|
[184] | 265 |
|
---|
[270] | 266 | virtual const std::string &GetKeyName() const
|
---|
| 267 | {
|
---|
| 268 | return GetName();
|
---|
| 269 | }
|
---|
| 270 | virtual bool IsDuplication( const CClass *pClass ) const
|
---|
| 271 | {
|
---|
| 272 | if( pClass->IsEqualSymbol( *this ) )
|
---|
| 273 | {
|
---|
| 274 | return true;
|
---|
| 275 | }
|
---|
| 276 | return false;
|
---|
| 277 | }
|
---|
| 278 |
|
---|
[206] | 279 | void Readed(){
|
---|
| 280 | isReady = true;
|
---|
| 281 | }
|
---|
| 282 | bool IsReady() const{
|
---|
| 283 | return isReady;
|
---|
| 284 | }
|
---|
[184] | 285 |
|
---|
[206] | 286 | const NamespaceScopesCollection &GetImportedNamespaces() const
|
---|
| 287 | {
|
---|
| 288 | return importedNamespaces;
|
---|
| 289 | }
|
---|
| 290 |
|
---|
[290] | 291 | // 型パラメータ
|
---|
[424] | 292 | const GenericTypes &GetFormalGenericTypes() const
|
---|
| 293 | {
|
---|
| 294 | return formalGenericTypes;
|
---|
| 295 | }
|
---|
[290] | 296 | void AddFormalGenericType( GenericType genericType )
|
---|
| 297 | {
|
---|
| 298 | this->formalGenericTypes.push_back( genericType );
|
---|
| 299 | }
|
---|
[299] | 300 | int GetFormalGenericTypeParameterIndex( const std::string &name ) const
|
---|
| 301 | {
|
---|
| 302 | int i = 0;
|
---|
| 303 | BOOST_FOREACH( const GenericType &genericType, formalGenericTypes )
|
---|
| 304 | {
|
---|
| 305 | if( genericType.GetName() == name )
|
---|
| 306 | {
|
---|
| 307 | return i;
|
---|
| 308 | }
|
---|
| 309 | i++;
|
---|
| 310 | }
|
---|
| 311 | return -1;
|
---|
| 312 | }
|
---|
[290] | 313 | bool IsExistFormalGenericTypeParameter( const std::string &name ) const
|
---|
| 314 | {
|
---|
| 315 | BOOST_FOREACH( const GenericType &genericType, formalGenericTypes )
|
---|
| 316 | {
|
---|
| 317 | if( genericType.GetName() == name )
|
---|
| 318 | {
|
---|
| 319 | return true;
|
---|
| 320 | }
|
---|
| 321 | }
|
---|
| 322 | return false;
|
---|
| 323 | }
|
---|
[379] | 324 | bool IsGeneric() const
|
---|
| 325 | {
|
---|
| 326 | return ( this->formalGenericTypes.size() != 0 );
|
---|
| 327 | }
|
---|
[290] | 328 |
|
---|
[206] | 329 | // 継承元クラス
|
---|
| 330 | bool HasSuperClass() const
|
---|
| 331 | {
|
---|
| 332 | return ( pSuperClass != NULL );
|
---|
| 333 | }
|
---|
| 334 | const CClass &GetSuperClass() const
|
---|
| 335 | {
|
---|
| 336 | return *pSuperClass;
|
---|
| 337 | }
|
---|
| 338 | void SetSuperClass( const CClass *pSuperClass )
|
---|
| 339 | {
|
---|
| 340 | this->pSuperClass = pSuperClass;
|
---|
| 341 | }
|
---|
[299] | 342 | const Types &GetSuperClassActualTypeParameters() const
|
---|
| 343 | {
|
---|
| 344 | return superClassActualTypeParameters;
|
---|
| 345 | }
|
---|
| 346 | void SetSuperClassActualTypeParameters( const Types &actualTypeParameters )
|
---|
| 347 | {
|
---|
| 348 | this->superClassActualTypeParameters = actualTypeParameters;
|
---|
| 349 | }
|
---|
[206] | 350 |
|
---|
| 351 | // Blittable型
|
---|
| 352 | bool IsBlittableType() const
|
---|
| 353 | {
|
---|
| 354 | return !blittableType.IsNull();
|
---|
| 355 | }
|
---|
| 356 | const Type &GetBlittableType() const
|
---|
| 357 | {
|
---|
| 358 | return blittableType;
|
---|
| 359 | }
|
---|
| 360 | void SetBlittableType( const Type &type ){
|
---|
| 361 | blittableType = type;
|
---|
| 362 | }
|
---|
| 363 |
|
---|
| 364 | bool IsClass() const;
|
---|
| 365 | bool IsInterface() const;
|
---|
[370] | 366 | bool IsComInterface() const;
|
---|
[206] | 367 | bool IsEnum() const;
|
---|
| 368 | bool IsDelegate() const;
|
---|
| 369 | bool IsStructure() const;
|
---|
| 370 | void SetClassType( ClassType classType )
|
---|
| 371 | {
|
---|
| 372 | this->classType = classType;
|
---|
| 373 | }
|
---|
| 374 |
|
---|
| 375 |
|
---|
| 376 | //コンストラクタをコンパイルしているかどうかのチェックフラグ
|
---|
[184] | 377 | private:
|
---|
[206] | 378 | mutable bool isCompilingConstructor;
|
---|
[184] | 379 | public:
|
---|
[206] | 380 | void NotifyStartConstructorCompile() const;
|
---|
| 381 | void NotifyFinishConstructorCompile() const;
|
---|
| 382 | bool IsCompilingConstructor() const;
|
---|
[184] | 383 |
|
---|
[206] | 384 | //デストラクタをコンパイルしているかどうかのチェックフラグ
|
---|
| 385 | private:
|
---|
| 386 | mutable bool isCompilingDestructor;
|
---|
| 387 | public:
|
---|
| 388 | void NotifyStartDestructorCompile() const;
|
---|
| 389 | void NotifyFinishDestructorCompile() const;
|
---|
| 390 | bool IsCompilingDestructor() const;
|
---|
[191] | 391 |
|
---|
[193] | 392 |
|
---|
[206] | 393 | //自身の派生クラスかどうかを確認
|
---|
| 394 | bool IsSubClass( const CClass *pClass ) const;
|
---|
| 395 |
|
---|
| 396 | //自身と等しいまたは派生クラスかどうかを確認
|
---|
| 397 | bool IsEqualsOrSubClass( const CClass *pClass ) const;
|
---|
| 398 |
|
---|
| 399 | // 自身と等しいまたは派生クラス、基底クラスかどうかを確認
|
---|
| 400 | bool IsEqualsOrSubClassOrSuperClass( const CClass &objClass ) const;
|
---|
| 401 |
|
---|
| 402 | // インターフェイス
|
---|
| 403 | bool HasInterfaces() const
|
---|
| 404 | {
|
---|
| 405 | return ( interfaces.size() != 0 );
|
---|
| 406 | }
|
---|
[342] | 407 | const Interfaces &GetInterfaces() const
|
---|
| 408 | {
|
---|
| 409 | return interfaces;
|
---|
| 410 | }
|
---|
[206] | 411 | bool IsInheritsInterface( const CClass *pInterfaceClass ) const;
|
---|
| 412 |
|
---|
[340] | 413 | // クラス継承
|
---|
[206] | 414 | bool Inherits( const char *inheritNames, int nowLine );
|
---|
[299] | 415 | bool InheritsClass( const CClass &inheritsClass, const Types &actualTypeParameters, int nowLine );
|
---|
[206] | 416 | bool InheritsInterface( const CClass &inheritsClass, int nowLine );
|
---|
| 417 |
|
---|
[340] | 418 | // インターフェイス実装
|
---|
[376] | 419 | bool Implements( const CClass &interfaceClass, const Types &actualTypeParameters, int nowLine );
|
---|
[340] | 420 | bool Implements( const char *interfaceNames, int nowLine );
|
---|
| 421 |
|
---|
[206] | 422 | //メンバ、メソッドの追加
|
---|
| 423 | CMember *CreateMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );
|
---|
| 424 | void AddMember( Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer, int nowLine );
|
---|
| 425 | void AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );
|
---|
| 426 |
|
---|
| 427 | void AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
|
---|
[350] | 428 | bool isVirtual, bool isOverride, bool isAutoGeneration, char *buffer, int nowLine);
|
---|
[206] | 429 |
|
---|
| 430 | //重複チェック
|
---|
[409] | 431 | bool DupliCheckAll(const char *name) const;
|
---|
| 432 | bool DupliCheckMember(const char *name) const;
|
---|
[206] | 433 |
|
---|
| 434 | const Members &GetDynamicMembers() const
|
---|
| 435 | {
|
---|
| 436 | return dynamicMembers;
|
---|
| 437 | }
|
---|
| 438 | const Members &GetStaticMembers() const
|
---|
| 439 | {
|
---|
| 440 | return staticMembers;
|
---|
| 441 | }
|
---|
| 442 | Members &GetDynamicMembers()
|
---|
| 443 | {
|
---|
| 444 | return dynamicMembers;
|
---|
| 445 | }
|
---|
| 446 | Members &GetStaticMembers()
|
---|
| 447 | {
|
---|
| 448 | return staticMembers;
|
---|
| 449 | }
|
---|
[355] | 450 |
|
---|
[409] | 451 | const CMember *FindDynamicMember( const char *memberName ) const;
|
---|
| 452 | bool HasDynamicMember( const char *memberName ) const
|
---|
[355] | 453 | {
|
---|
[409] | 454 | return ( FindDynamicMember( memberName ) != NULL );
|
---|
[355] | 455 | }
|
---|
[206] | 456 |
|
---|
[350] | 457 | void EnumDynamicMethodsOrInterfaceMethods( const char *methodName, std::vector<const UserProc *> &subs ) const;
|
---|
| 458 | const CMethod *GetDynamicMethodOrInterfaceMethod( const UserProc *pUserProc ) const;
|
---|
[347] | 459 |
|
---|
[206] | 460 | const Methods &GetStaticMethods() const
|
---|
| 461 | {
|
---|
| 462 | return staticMethods;
|
---|
| 463 | }
|
---|
| 464 | Methods &GetStaticMethods()
|
---|
| 465 | {
|
---|
| 466 | return staticMethods;
|
---|
| 467 | }
|
---|
| 468 |
|
---|
| 469 | //デフォルト コンストラクタ
|
---|
| 470 | const CMethod *GetConstructorMethod() const
|
---|
| 471 | {
|
---|
| 472 | if( ConstructorMemberSubIndex == -1 ) return NULL;
|
---|
[342] | 473 | return GetDynamicMethods()[ConstructorMemberSubIndex];
|
---|
[206] | 474 | }
|
---|
| 475 | void SetConstructorMemberSubIndex( int constructorMemberSubIndex )
|
---|
| 476 | {
|
---|
| 477 | this->ConstructorMemberSubIndex = constructorMemberSubIndex;
|
---|
| 478 | }
|
---|
| 479 |
|
---|
| 480 | //デストラクタ メソッドを取得
|
---|
| 481 | const CMethod *GetDestructorMethod() const
|
---|
| 482 | {
|
---|
| 483 | if( DestructorMemberSubIndex == -1 ) return NULL;
|
---|
[342] | 484 | return GetDynamicMethods()[DestructorMemberSubIndex];
|
---|
[206] | 485 | }
|
---|
| 486 | void SetDestructorMemberSubIndex( int destructorMemberSubIndex )
|
---|
| 487 | {
|
---|
| 488 | this->DestructorMemberSubIndex = destructorMemberSubIndex;
|
---|
| 489 | }
|
---|
| 490 |
|
---|
[325] | 491 | // デリゲート情報を取得
|
---|
| 492 | const ::Delegate &GetDelegate() const;
|
---|
| 493 |
|
---|
[232] | 494 | // ユーザ指定のアラインメント固定値
|
---|
| 495 | int GetFixedAlignment() const
|
---|
| 496 | {
|
---|
| 497 | return fixedAlignment;
|
---|
| 498 | }
|
---|
| 499 | void SetFixedAlignment( int fixedAlignment )
|
---|
| 500 | {
|
---|
| 501 | this->fixedAlignment = fixedAlignment;
|
---|
| 502 | }
|
---|
| 503 |
|
---|
[206] | 504 | // メンバの総合サイズを取得
|
---|
[409] | 505 | private:
|
---|
| 506 | int cacheSize;
|
---|
| 507 | public:
|
---|
[206] | 508 | int GetSize() const;
|
---|
| 509 |
|
---|
| 510 | // メンバのオフセットを取得
|
---|
[409] | 511 | int GetMemberOffset( const char *memberName ) const;
|
---|
[206] | 512 | private:
|
---|
| 513 | // アラインメント値を取得
|
---|
| 514 | int GetAlignment() const;
|
---|
| 515 |
|
---|
[342] | 516 |
|
---|
| 517 | /////////////////////////////////////////////////////////////////
|
---|
| 518 | // vtbl
|
---|
| 519 | /////////////////////////////////////////////////////////////////
|
---|
[206] | 520 | public:
|
---|
[342] | 521 | // vtblに存在する仮想関数の数
|
---|
| 522 | int GetVtblNum() const
|
---|
| 523 | {
|
---|
| 524 | return vtblNum;
|
---|
| 525 | }
|
---|
| 526 | void SetVtblNum( int vtblNum )
|
---|
| 527 | {
|
---|
| 528 | this->vtblNum = vtblNum;
|
---|
| 529 | }
|
---|
| 530 | void AddVtblNum( int vtblNum )
|
---|
| 531 | {
|
---|
| 532 | this->vtblNum += vtblNum;
|
---|
| 533 | }
|
---|
| 534 | bool IsExistVirtualFunctions() const
|
---|
| 535 | {
|
---|
[409] | 536 | // 構造体以外は仮想関数を持つ
|
---|
| 537 | return !IsStructure();
|
---|
[342] | 538 | }
|
---|
| 539 |
|
---|
| 540 | private:
|
---|
| 541 | long vtbl_offset;
|
---|
[370] | 542 | long comVtblOffset;
|
---|
[342] | 543 | long vtblMasterListOffset;
|
---|
[345] | 544 | std::vector<long> vtblMasterList;
|
---|
[342] | 545 | public:
|
---|
[348] | 546 | void GetVtblMasterListIndexAndVtblIndex( const UserProc *pUserProc, int &vtblMasterListIndex, int &vtblIndex ) const;
|
---|
[350] | 547 | int GetVtblMasterListIndex( const CClass *pClass ) const;
|
---|
[370] | 548 | long GetComVtblOffset() const;
|
---|
[345] | 549 | long GetVtblMasterListOffset() const;
|
---|
| 550 | void GenerateVTableMasterList( const std::vector<long> &vtableMasterList, long &offset );
|
---|
[342] | 551 | void GenerateFullVTables();
|
---|
| 552 | void ActionVtblSchedule( LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection, LONG_PTR MemPos_DataSection );
|
---|
[206] | 553 | bool IsAbstract() const;
|
---|
| 554 |
|
---|
| 555 |
|
---|
[355] | 556 | // TypeInfo用
|
---|
| 557 | mutable int typeInfoDataTableOffset;
|
---|
| 558 | void SetTypeInfoDataTableOffset( int typeInfoDataTableOffset ) const
|
---|
| 559 | {
|
---|
| 560 | this->typeInfoDataTableOffset = typeInfoDataTableOffset;
|
---|
| 561 | }
|
---|
| 562 | int GetTypeInfoDataTableOffset() const
|
---|
| 563 | {
|
---|
| 564 | return typeInfoDataTableOffset;
|
---|
| 565 | }
|
---|
| 566 |
|
---|
[387] | 567 | // 動的型データ用のメンバデータを取得
|
---|
| 568 | std::string GetStaticDefiningStringAsMemberNames() const;
|
---|
| 569 | std::string GetStaticDefiningStringAsMemberTypeInfoNames() const;
|
---|
[412] | 570 | std::string GetStaticDefiningStringAsMemberOffsets() const;
|
---|
[417] | 571 | void GetReferenceOffsetsInitializeBuffer( std::string &referenceOffsetsBuffer, int &numOfReference, int baseOffset = 0 ) const;
|
---|
[355] | 572 |
|
---|
[387] | 573 |
|
---|
[206] | 574 | //線形リスト用
|
---|
| 575 | CClass *pobj_NextClass;
|
---|
| 576 | };
|
---|
| 577 |
|
---|
[270] | 578 | class Classes : public Jenga::Common::Hashmap<CClass>
|
---|
[206] | 579 | {
|
---|
[191] | 580 | // XMLシリアライズ用
|
---|
[206] | 581 | public:
|
---|
| 582 | Classes()
|
---|
| 583 | : pCompilingMethod( NULL )
|
---|
| 584 | , pStringClass( NULL )
|
---|
| 585 | , pObjectClass( NULL )
|
---|
[350] | 586 | , pInterfaceInfo( NULL )
|
---|
[206] | 587 | {
|
---|
| 588 | }
|
---|
| 589 | ~Classes()
|
---|
| 590 | {
|
---|
| 591 | }
|
---|
| 592 |
|
---|
| 593 | virtual CClass *Create( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name);
|
---|
[369] | 594 | bool Insert( CClass *pClass, int nowLine );
|
---|
[206] | 595 | CClass *Add( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name,int nowLine);
|
---|
| 596 | virtual void CollectClassesForNameOnly( const BasicSource &source );
|
---|
| 597 |
|
---|
[342] | 598 | // vtblを一時的に生成
|
---|
[282] | 599 | void GenerateVTables();
|
---|
[206] | 600 |
|
---|
[342] | 601 | // vtblのを正規のオフセットで再構築
|
---|
| 602 | void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection, LONG_PTR MemPos_DataSection );
|
---|
| 603 |
|
---|
[206] | 604 | virtual void InitStaticMember();
|
---|
| 605 |
|
---|
| 606 | private:
|
---|
| 607 | bool MemberVar_LoopRefCheck(const CClass &objClass);
|
---|
| 608 | public:
|
---|
| 609 | virtual void GetClass_recur(const char *lpszInheritsClass);
|
---|
[376] | 610 | void LookaheadClass( const char *className );
|
---|
| 611 | bool LoopRefCheck( const CClass &objClass );
|
---|
[206] | 612 | virtual void GetAllClassInfo();
|
---|
| 613 | virtual void Compile_System_InitializeUserTypes();
|
---|
[355] | 614 | virtual void Compile_System_InitializeUserTypesForBaseType();
|
---|
[206] | 615 |
|
---|
| 616 | const CClass *Find( const NamespaceScopes &namespaceScopes, const string &name ) const;
|
---|
| 617 | const CClass *Find( const string &fullName ) const;
|
---|
| 618 |
|
---|
| 619 |
|
---|
| 620 | /////////////////////////////
|
---|
| 621 | // 現在コンパイル中の情報
|
---|
| 622 | /////////////////////////////
|
---|
| 623 | private:
|
---|
| 624 | const CMethod *pCompilingMethod;
|
---|
| 625 | public:
|
---|
| 626 | void StartCompile( const UserProc *pUserProc );
|
---|
| 627 |
|
---|
| 628 | //現在コンパイル中のメソッド情報を取得
|
---|
| 629 | const CMethod *GetNowCompilingMethodInfo(){
|
---|
| 630 | return pCompilingMethod;
|
---|
| 631 | }
|
---|
| 632 |
|
---|
| 633 |
|
---|
| 634 | /////////////////////////////
|
---|
| 635 | // 特殊クラス
|
---|
| 636 | /////////////////////////////
|
---|
[272] | 637 | mutable const CClass *pStringClass;
|
---|
| 638 | mutable const CClass *pObjectClass;
|
---|
[349] | 639 | mutable const CClass *pInterfaceInfo;
|
---|
[272] | 640 | const CClass *GetStringClassPtr() const;
|
---|
| 641 | const CClass *GetObjectClassPtr() const;
|
---|
[349] | 642 | const CClass *GetInterfaceInfoClassPtr() const;
|
---|
[184] | 643 | };
|
---|