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
Line 
1#pragma once
2
3#include <Hashmap.h>
4#include <Procedure.h>
5
6class Delegates;
7
8class 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シリアライズ用
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 );
31 ar & BOOST_SERIALIZATION_NVP( importedNamespaces );
32 ar & BOOST_SERIALIZATION_NVP( dynamicParams );
33 }
34
35public:
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
67class Delegates : public Jenga::Common::Hashmap<Delegate>
68{
69public:
70 void Collect( const BasicSource &source );
71 void GenerateSourceCode( std::string &destSource );
72 void RefleshParameterAndReturnType();
73};
Note: See TracBrowser for help on using the repository browser.