3 #include "core/idlast/namespace.h"
8 using namespace awful::awic
;
11 void awful::awic::GenerateSignalTraits( std::ostream
& Out_
,
12 const idlast::Class
* pClass_
,
13 const idlast::Signal
* pSig_
)
15 string
FullClassName( pClass_
->getName() );
16 const idlast::Namespace
* pCurrentNS
= pClass_
->getNamespace();
17 while( pCurrentNS
->getParent() )
19 FullClassName
= pCurrentNS
->getName() + "::" + FullClassName
;
20 pCurrentNS
= pCurrentNS
->getParent();
24 std::stringstream tagstring
;
25 tagstring
<< "class_traits< " << FullClassName
<< " >::signal_tags::" << pSig_
->getName();
26 OutputFlags( Out_
, pSig_
->getFlags(), tagstring
.str() );
28 const idlast::Signal::paramlist_type
& params
= pSig_
->getParamTypes();
30 Out_
<< "\ttemplate< class C > struct signal_traits< C,\n"
31 "\t\t" << tagstring
.str() << " >\n"
33 "\t\ttypedef awful::Signal<";
35 idlast::Signal::paramlist_type::const_iterator it
;
36 for( it
= params
.begin(); it
!= params
.end(); ++it
)
38 if( it
!= params
.begin() )
41 PrintType( Out_
, *it
);
48 "\t\tstatic const char* Name() { return \"" << pSig_
->getName() << "\"; }\n"
49 "\t\tstatic type C::* MemberPointer() { return &C::m_" << pSig_
->getName() << "; }\n"
51 "\t\ttemplate< class CC > struct CallWrapper\n"
53 "\t\t\tstatic bool Call( CC& CallContext_ )\n"
55 "\t\t\t\tC& Obj = CallContext_.getObject();\n"
56 "\t\t\t\tCallContext_.numExpectedParams( " << params
.size() << " );\n";
59 for( it
= params
.begin(); it
!= params
.end(); ++it
)
62 PrintType( Out_
, *it
);
63 Out_
<< " param" << paramid
<< ";\n"
64 "\t\t\t\tif( !CallContext_.template getParam< ";
66 PrintTypeCategory( Out_
, *it
);
68 Out_
<< " >( param" << paramid
<< " ) ) return false;\n";
76 Out_
<< "\t\t\t\tObj." << pSig_
->getName() << '(';
79 for( it
= params
.begin(); it
!= params
.end(); ++it
)
83 Out_
<< " param" << paramid
;
92 "\t\t\t\treturn true;\n"
96 "\t\ttemplate< class CC > struct SlotWrapper : public awful::RefCounted\n"
98 //"\t\t\tSlotWrapper( const CC& CallContext_ ) : m_CallContext( CallContext_ ) {}\n\n"
102 for( it
= params
.begin(); it
!= params
.end(); ++it
)
107 PrintType( Out_
, *it
);
108 Out_
<< " param" << paramid
<< '_';
113 if( !params
.empty() )
118 "\t\t\t\tm_CallContext.prepare();\n";
121 for( it
= params
.begin(); it
!= params
.end(); ++it
)
123 Out_
<< "\t\t\t\tm_CallContext.template addParam< ";
124 PrintTypeCategory( Out_
, *it
);
125 Out_
<< " >( param" << paramid
<< "_ );\n";
129 Out_
<< "\t\t\t\tm_CallContext.call();\n"
131 "\t\t\tCC m_CallContext;\n"