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

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

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

File size: 1.6 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 std::string paramStr;
15 std::string returnTypeName;
16 int sourceIndex;
17
18 Parameters dynamicParams;
19
20 // XMLシリアライズ用
21private:
22 friend class boost::serialization::access;
23 template<class Archive> void serialize(Archive& ar, const unsigned int version)
24 {
25 trace_for_serialize( "serializing - Delegate" );
26
27 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure );
28 ar & BOOST_SERIALIZATION_NVP( dynamicParams );
29 }
30
31public:
32 Delegate( const NamespaceScopes &namespaceScopes, const std::string &name, Procedure::Kind procKind, const char *paramStr, const std::string &returnTypeName, int sourceIndex )
33 : Procedure( namespaceScopes, name, procKind, false )
34 , paramStr( paramStr )
35 , returnTypeName( returnTypeName )
36 , sourceIndex( sourceIndex )
37 {
38 }
39 Delegate()
40 {
41 }
42
43 void RefleshParameterAndReturnType();
44
45 virtual const std::string &GetKeyName() const
46 {
47 return GetName();
48 }
49
50 const Parameters &GetDynamicParams() const
51 {
52 return dynamicParams;
53 }
54
55 /*!
56 @brief オーバーライド用にデリゲート同士が等しいかどうかをチェックする
57 @param dgt 照らし合わせるデリゲート
58 */
59 bool IsSimilar( const Delegate &dgt ) const;
60};
61
62class Delegates : public Jenga::Common::Hashmap<Delegate>
63{
64public:
65 void Collect( const BasicSource &source );
66 void GenerateSourceCode( std::string &destSource );
67 void RefleshParameterAndReturnType();
68};
Note: See TracBrowser for help on using the repository browser.