| 1 | #pragma once | 
|---|
| 2 |  | 
|---|
| 3 | #include <Hashmap.h> | 
|---|
| 4 | #include <Procedure.h> | 
|---|
| 5 |  | 
|---|
| 6 | class Delegates; | 
|---|
| 7 |  | 
|---|
| 8 | class Delegate | 
|---|
| 9 | : public Procedure | 
|---|
| 10 | , public Jenga::Common::ObjectInHashmap<Delegate> | 
|---|
| 11 | { | 
|---|
| 12 | friend Delegates; | 
|---|
| 13 |  | 
|---|
| 14 | // importされている名前空間 | 
|---|
| 15 | NamespaceScopesCollection importedNamespaces; | 
|---|
| 16 |  | 
|---|
| 17 | std::string paramStr; | 
|---|
| 18 | std::string returnTypeName; | 
|---|
| 19 | int sourceIndex; | 
|---|
| 20 |  | 
|---|
| 21 | Parameters dynamicParams; | 
|---|
| 22 |  | 
|---|
| 23 | // XMLシリアライズ用 | 
|---|
| 24 | private: | 
|---|
| 25 | friend class boost::serialization::access; | 
|---|
| 26 | template<class Archive> void serialize(Archive& ar, const unsigned int version) | 
|---|
| 27 | { | 
|---|
| 28 | trace_for_serialize( "serializing - Delegate" ); | 
|---|
| 29 |  | 
|---|
| 30 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure ); | 
|---|
| 31 | ar & BOOST_SERIALIZATION_NVP( importedNamespaces ); | 
|---|
| 32 | ar & BOOST_SERIALIZATION_NVP( dynamicParams ); | 
|---|
| 33 | } | 
|---|
| 34 |  | 
|---|
| 35 | public: | 
|---|
| 36 | Delegate( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Procedure::Kind procKind, const char *paramStr, const std::string &returnTypeName, int sourceIndex ) | 
|---|
| 37 | : Procedure( namespaceScopes, name, procKind, false ) | 
|---|
| 38 | , importedNamespaces( importedNamespaces ) | 
|---|
| 39 | , paramStr( paramStr ) | 
|---|
| 40 | , returnTypeName( returnTypeName ) | 
|---|
| 41 | , sourceIndex( sourceIndex ) | 
|---|
| 42 | { | 
|---|
| 43 | } | 
|---|
| 44 | Delegate() | 
|---|
| 45 | { | 
|---|
| 46 | } | 
|---|
| 47 |  | 
|---|
| 48 | void RefleshParameterAndReturnType(); | 
|---|
| 49 |  | 
|---|
| 50 | virtual const std::string &GetKeyName() const | 
|---|
| 51 | { | 
|---|
| 52 | return GetName(); | 
|---|
| 53 | } | 
|---|
| 54 |  | 
|---|
| 55 | const Parameters &GetDynamicParams() const | 
|---|
| 56 | { | 
|---|
| 57 | return dynamicParams; | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 | /*! | 
|---|
| 61 | @brief  オーバーライド用にデリゲート同士が等しいかどうかをチェックする | 
|---|
| 62 | @param  dgt 照らし合わせるデリゲート | 
|---|
| 63 | */ | 
|---|
| 64 | bool IsSimilar( const Delegate &dgt ) const; | 
|---|
| 65 | }; | 
|---|
| 66 |  | 
|---|
| 67 | class Delegates : public Jenga::Common::Hashmap<Delegate> | 
|---|
| 68 | { | 
|---|
| 69 | public: | 
|---|
| 70 | void Collect( const BasicSource &source ); | 
|---|
| 71 | void GenerateSourceCode( std::string &destSource ); | 
|---|
| 72 | void RefleshParameterAndReturnType(); | 
|---|
| 73 | }; | 
|---|