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