Ignore:
Timestamp:
Jul 13, 2007, 2:49:56 AM (17 years ago)
Author:
dai_9181
Message:

UserProc/DllProc/ProcPointerクラスをSymbolクラスからの派生にした

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/include/Procedure.h

    r206 r208  
    33#include <jenga/include/common/Hashmap.h>
    44#include <jenga/include/smoothie/Source.h>
    5 #include <jenga/include/smoothie/LexicalAnalysis.h>
    65
    76#include <option.h>
     
    1615class CMethod;
    1716
    18 class Procedure
     17class Procedure : public Symbol
    1918{
    2019public:
     
    2625
    2726private:
    28     string name;                        // プロシージャ名
    29 
    3027    Kind kind;
    3128
     
    4845private:
    4946    friend class boost::serialization::access;
    50     BOOST_SERIALIZATION_SPLIT_MEMBER();
    51     template<class Archive> void load(Archive& ar, const unsigned int version)
     47    template<class Archive> void serialize(Archive& ar, const unsigned int version)
    5248    {
    5349        trace_for_serialize( "serializing - Procedure" );
    5450
    55         std::string _name;
    56         ar & BOOST_SERIALIZATION_NVP( _name );
    57         this->name = Operator_NaturalStringToCalcMarkString( _name );
    58 
     51        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
    5952        ar & BOOST_SERIALIZATION_NVP( kind );
    6053        ar & BOOST_SERIALIZATION_NVP( isCdecl );
     
    6457        ar & BOOST_SERIALIZATION_NVP( codePos );
    6558    }
    66     template<class Archive> void save(Archive& ar, const unsigned int version) const
    67     {
    68         trace_for_serialize( "serializing - Procedure" );
    69 
    70         std::string _name = Operator_CalcMarkStringToNaturalString( name );
    71         ar & BOOST_SERIALIZATION_NVP( _name );
    72 
    73         ar & BOOST_SERIALIZATION_NVP( kind );
    74         ar & BOOST_SERIALIZATION_NVP( isCdecl );
    75         ar & BOOST_SERIALIZATION_NVP( isUsing );
    76         ar & BOOST_SERIALIZATION_NVP( params );
    77         ar & BOOST_SERIALIZATION_NVP( returnType );
    78         ar & BOOST_SERIALIZATION_NVP( codePos );
    79     }
    80 
    81 public:
    82     Procedure( const string &name, Kind kind, bool isCdecl )
    83         : name( name )
     59
     60public:
     61    Procedure( const NamespaceScopes &namespaceScopes, const string &name, Kind kind, bool isCdecl )
     62        : Symbol( namespaceScopes, name )
    8463        , kind( kind )
    8564        , isCdecl( isCdecl )
     
    9776    }
    9877
    99     const string &GetName() const
    100     {
    101         return name;
    102     }
    103 
    10478    bool IsSub() const
    10579    {
     
    145119
    146120private:
    147     NamespaceScopes namespaceScopes;
    148121    NamespaceScopesCollection importedNamespaces;
    149122
     
    183156        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure );
    184157        ar & BOOST_SERIALIZATION_NVP( _paramStr );
    185         ar & BOOST_SERIALIZATION_NVP( namespaceScopes );
    186158        ar & BOOST_SERIALIZATION_NVP( importedNamespaces );
    187159        ar & boost::serialization::make_nvp("pParentClass", const_cast<CClass *&>(pParentClass) );
     
    204176
    205177    UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport, int id )
    206         : Procedure( name, kind, isCdecl )
    207         , namespaceScopes( namespaceScopes )
     178        : Procedure( namespaceScopes, name, kind, isCdecl )
    208179        , importedNamespaces( importedNamespaces )
    209180        , pParentClass( NULL )
     
    314285    }
    315286
    316     const NamespaceScopes &GetNamespaceScopes() const;
     287    virtual const NamespaceScopes &GetNamespaceScopes() const;
    317288    const NamespaceScopesCollection &GetImportedNamespaces() const;
    318289
     
    340311    }
    341312
    342     bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
    343     bool IsEqualSymbol( const UserProc &globalProc ) const;
    344     bool IsEqualSymbol( const string &name ) const;
    345 
    346313    bool IsVirtual() const;
    347314
     
    360327    {
    361328        return ( pParentClass != NULL );
     329    }
     330    bool IsGlobalProcedure() const
     331    {
     332        return ( pParentClass == NULL );
    362333    }
    363334    void SetMethod( CMethod *pMethod ){
     
    428399class DllProc : public Procedure
    429400{
    430     NamespaceScopes namespaceScopes;
    431 
    432401    string dllFileName;
    433402    string alias;
     
    442411
    443412        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure );
    444         ar & BOOST_SERIALIZATION_NVP( namespaceScopes );
    445413        ar & BOOST_SERIALIZATION_NVP( dllFileName );
    446414        ar & BOOST_SERIALIZATION_NVP( alias );
     
    453421
    454422    DllProc( const NamespaceScopes &namespaceScopes, const string &name, Kind kind, bool isCdecl, const string &dllFileName, const string &alias ):
    455       Procedure( name, kind, isCdecl ),
    456       namespaceScopes( namespaceScopes ),
     423      Procedure( namespaceScopes, name, kind, isCdecl ),
    457424      dllFileName( dllFileName ),
    458425      alias( alias ),
     
    463430    ~DllProc(){}
    464431
    465     virtual bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
    466     bool IsEqualSymbol( const string &name ) const;
    467 
    468     const NamespaceScopes &GetNamespaceScopes() const
    469     {
    470         return namespaceScopes;
    471     }
    472 
    473432    const string &GetDllFileName() const
    474433    {
     
    505464public:
    506465    ProcPointer( Kind kind )
    507         : Procedure( "", kind, false )
     466        : Procedure( NamespaceScopes(), std::string(), kind, false )
    508467    {
    509468    }
Note: See TracChangeset for help on using the changeset viewer.