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