[136] | 1 | #include "../common.h"
|
---|
| 2 | #include <Method.h>
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | Methods::Methods()
|
---|
| 6 | {
|
---|
| 7 | }
|
---|
| 8 | Methods::~Methods()
|
---|
| 9 | {
|
---|
| 10 | Methods &methods = *this;
|
---|
| 11 | BOOST_FOREACH( CMethod *pMethod, methods ){
|
---|
| 12 | delete pMethod;
|
---|
| 13 | }
|
---|
| 14 | }
|
---|
| 15 |
|
---|
[137] | 16 | void Methods::Add( UserProc *pUserProc,Prototype::Accessibility accessibility, bool isConst, bool isAbstract, bool isVirtual ){
|
---|
| 17 | CMethod *pMethod = new DynamicMethod( pUserProc, accessibility, isAbstract, isVirtual, isConst );
|
---|
[136] | 18 | this->push_back( pMethod );
|
---|
| 19 | pUserProc->SetMethod( pMethod );
|
---|
| 20 | }
|
---|
[137] | 21 | void Methods::AddStatic(UserProc *pUserProc, Prototype::Accessibility accessibility ){
|
---|
| 22 | CMethod *pMethod = new StaticMethod( pUserProc, accessibility );
|
---|
[136] | 23 | this->push_back( pMethod );
|
---|
| 24 | pUserProc->SetMethod( pMethod );
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | const CMethod *Methods::GetMethodPtr( UserProc *pUserProc ) const
|
---|
| 28 | {
|
---|
| 29 | const Methods &methods = *this;
|
---|
| 30 | for( int i=(int)methods.size()-1; i>=0; i-- ){
|
---|
| 31 | if( pUserProc == methods[i]->pUserProc ){
|
---|
| 32 | return methods[i];
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 | return NULL;
|
---|
| 36 | }
|
---|
| 37 | bool Methods::IsExist( const char *name ) const
|
---|
| 38 | {
|
---|
| 39 | const Methods &methods = *this;
|
---|
| 40 | foreach( const CMethod *pMethod, methods ){
|
---|
| 41 | if( pMethod->pUserProc->GetName() == name ) return true;
|
---|
| 42 | }
|
---|
| 43 | return false;
|
---|
| 44 | }
|
---|
| 45 | void Methods::Enum( const char *methodName, vector<UserProc *> &subs ) const
|
---|
| 46 | {
|
---|
| 47 | //オブジェクトのメンバ関数の場合
|
---|
| 48 | //※オーバーライドされた関数を先にサーチする必要があるため、バックサーチを行う
|
---|
| 49 | const Methods &methods = *this;
|
---|
| 50 | for( int i=(int)methods.size()-1; i>=0; i-- ){
|
---|
| 51 | if( methods[i]->pUserProc->GetName() == methodName ){
|
---|
| 52 | subs.push_back( methods[i]->pUserProc );
|
---|
| 53 | }
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 | void Methods::Enum( const BYTE idOperatorCalc, vector<UserProc *> &subs ) const
|
---|
| 57 | {
|
---|
| 58 | //オブジェクトのメンバ関数の場合
|
---|
| 59 | //※オーバーライドされた関数を先にサーチする必要があるため、バックサーチを行う
|
---|
| 60 | const Methods &methods = *this;
|
---|
| 61 | for( int i=(int)methods.size()-1; i>=0; i-- ){
|
---|
| 62 | UserProc *pUserProc = methods[i]->pUserProc;
|
---|
| 63 | const char *temp = pUserProc->GetName().c_str();
|
---|
| 64 | if(temp[0]==1&&temp[1]==ESC_OPERATOR){
|
---|
| 65 | if((BYTE)temp[2]==idOperatorCalc){
|
---|
| 66 | subs.push_back( pUserProc );
|
---|
| 67 | }
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 | }
|
---|