source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/include/Delegate.h@ 449

Last change on this file since 449 was 449, checked in by dai_9181, 16 years ago

・デリゲートの共変戻り値、反変引数に対応した。
・core.libで定義されたデリゲートがアプリケーションプロジェクトで利用できないバグを修正。

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