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

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

Location:
trunk/abdev/BasicCompiler_Common/include
Files:
3 edited

Legend:

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

    r206 r208  
    7373
    7474    // XMLシリアライズ用
     75    // TODO: xml未完成
    7576private:
    7677    friend class boost::serialization::access;
  • 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    }
  • trunk/abdev/BasicCompiler_Common/include/Symbol.h

    r206 r208  
    77
    88#include <jenga/include/smoothie/Namespace.h>
     9#include <jenga/include/smoothie/LexicalAnalysis.h>
    910
    1011using namespace std;
     
    1819private:
    1920    friend class boost::serialization::access;
    20     template<class Archive> void serialize(Archive& ar, const unsigned int version)
     21    BOOST_SERIALIZATION_SPLIT_MEMBER();
     22    template<class Archive> void load(Archive& ar, const unsigned int version)
    2123    {
     24        trace_for_serialize( "serializing(load) - Symbol" );
     25
    2226        ar & BOOST_SERIALIZATION_NVP( namespaceScopes );
    23         ar & BOOST_SERIALIZATION_NVP( name );
     27
     28        std::string _name;
     29        ar & BOOST_SERIALIZATION_NVP( _name );
     30        this->name = Operator_NaturalStringToCalcMarkString( _name );
     31    }
     32    template<class Archive> void save(Archive& ar, const unsigned int version) const
     33    {
     34        trace_for_serialize( "serializing(save) - Symbol" );
     35
     36        ar & BOOST_SERIALIZATION_NVP( namespaceScopes );
     37
     38        std::string _name = Operator_CalcMarkStringToNaturalString( name );
     39        ar & BOOST_SERIALIZATION_NVP( _name );
    2440    }
    2541
     
    4157    }
    4258
    43     const NamespaceScopes &GetNamespaceScopes() const
     59    virtual const NamespaceScopes &GetNamespaceScopes() const
    4460    {
    4561        return namespaceScopes;
     
    5369    bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
    5470    bool IsEqualSymbol( const Symbol &symbol ) const;
    55     bool IsEqualSymbol( const string &name ) const;
     71    bool IsEqualSymbol( const char *fullName ) const;
     72    bool IsEqualSymbol( const string &fullName ) const
     73    {
     74        return IsEqualSymbol( fullName.c_str() );
     75    }
    5676};
Note: See TracChangeset for help on using the changeset viewer.