@ -332,11 +332,11 @@ static TQValueList<Argument> extractArguments(const TQDomElement& methodElement,
argument . name = TQString ( " arg%1 " ) . arg ( inCount + outCount ) ;
argument . direction = Argument : : In ;
if ( ! isSignal & & element . attribute ( " direction " , " in " ) = = " out " )
if ( isSignal | | element . attribute ( " direction " , " in " ) = = " out " )
argument . direction = Argument : : Out ;
TQString annotation ;
if ( ! isSignal & & argument . direction = = Argument : : In )
if ( argument . direction = = Argument : : In )
{
annotation = argAnnotations [ TQString ( " In%1 " ) . arg ( inCount ) ] ;
+ + inCount ;
@ -598,16 +598,13 @@ bool MethodGenerator::extractMethods(const TQDomElement& interfaceElement,
TQDomElement element = node . toElement ( ) ;
if ( element . attribute ( " name " ) . isEmpty ( ) ) continue ;
if ( element . tagName ( ) = = " method " | | element . tagName ( ) = = " signal " )
if ( element . tagName ( ) = = " method " )
{
Method method ;
method . name = element . attribute ( " name " ) ;
method . type = Method : : _Method ;
method . arguments = extractArguments ( element , classData ) ;
method . noReply = false ;
method . async = false ;
if ( element . tagName ( ) = = " method " )
{
method . async = hasAnnotation ( element , " org.freedesktop.DBus.GLib.Async " ) ;
classData . methods . append ( method ) ;
if ( method . async ) {
@ -615,7 +612,14 @@ bool MethodGenerator::extractMethods(const TQDomElement& interfaceElement,
classData . methods . append ( method ) ;
}
}
else
else if ( element . tagName ( ) = = " signal " )
{
Method method ;
method . name = element . attribute ( " name " ) ;
method . type = Method : : _Signal ;
method . arguments = extractArguments ( element , classData ) ;
method . noReply = false ;
method . async = false ;
classData . msignals . append ( method ) ;
}
else if ( element . tagName ( ) = = " property " )
@ -669,12 +673,17 @@ void MethodGenerator::writeMethodDeclaration(const Method& method, bool pureVirt
TQValueList < Argument > : : const_iterator endIt = method . arguments . end ( ) ;
for ( ; it ! = endIt ; )
{
if ( ! ( * it ) . isPrimitive & & ( * it ) . direction = = Argument : : In )
if ( ! ( * it ) . isPrimitive & & ( ( * it ) . direction = = Argument : : In | | method . type = = Method : : _Signal ) )
{
stream < < " const " ;
}
stream < < ( * it ) . signature ;
if ( ! ( * it ) . isPrimitive | | ( * it ) . direction = = Argument : : Out ) stream < < " & " ;
if ( ! ( * it ) . isPrimitive | | ( ( * it ) . direction = = Argument : : Out & & method . type ! = Method : : _Signal ) )
{
stream < < " & " ;
}
stream < < " " < < ( * it ) . name ;
@ -903,23 +912,25 @@ void MethodGenerator::writeMethodCall(const Class& classData,
void MethodGenerator : : writeSignalEmitter ( const Class & classData ,
const Method & method , TQTextStream & stream )
{
if ( method . type ! = Method : : _Signal )
{
return ;
}
stream < < " bool " < < classData . name < < " ::emit " < < method . name < < " ( " ;
TQValueList < Argument > : : const_iterator it = method . arguments . begin ( ) ;
TQValueList < Argument > : : const_iterator endIt = method . arguments . end ( ) ;
for ( ; it ! = endIt ; )
{
if ( ! ( * it ) . isPrimitive & & ( * it ) . direction = = Argument : : In )
stream < < " const " ;
stream < < ( * it ) . signature ;
if ( ! ( * it ) . isPrimitive | | ( * it ) . direction = = Argument : : Out ) stream < < " & " ;
stream < < " " < < ( * it ) . name ;
stream < < " & " < < ( * it ) . name ;
+ + it ;
if ( it ! = endIt ) stream < < " , " ;
if ( it ! = endIt )
{
stream < < " , " ;
}
}
stream < < " ) " < < endl ;
@ -937,8 +948,6 @@ void MethodGenerator::writeSignalEmitter(const Class& classData,
it = method . arguments . begin ( ) ;
for ( ; it ! = endIt ; + + it )
{
if ( ( * it ) . direction = = Argument : : In )
{
if ( ! ( * it ) . annotatedType . isEmpty ( ) )
{
@ -971,7 +980,6 @@ void MethodGenerator::writeSignalEmitter(const Class& classData,
stream < < " ; " < < endl ;
}
}
stream < < endl ;
stream < < " return handleSignalSend(message); " < < endl ;
@ -1140,7 +1148,28 @@ void MethodGenerator::writeSignalHandler(const Class& classData,
stream < < " if (message.member() == \" " < < ( * it ) . name < < " \" ) " < < endl ;
stream < < " { " < < endl ;
writeVariables ( " " , * it , stream ) ;
int count = 0 ;
TQValueList < Argument > : : const_iterator it1 = ( * it ) . arguments . begin ( ) ;
TQValueList < Argument > : : const_iterator endIt1 = ( * it ) . arguments . end ( ) ;
for ( ; it1 ! = endIt1 ; + + it1 )
{
stream < < " " < < ( * it1 ) . signature < < " _ " < < ( * it1 ) . name ;
if ( ! ( * it1 ) . accessor . isEmpty ( ) )
{
stream < < TQString : : fromUtf8 ( " = message[%1].to " ) . arg ( count + + ) ;
stream < < ( * it1 ) . accessor ;
if ( ! ( * it1 ) . subAccessor . isEmpty ( ) )
{
stream < < TQString ( " ().to%1 " ) . arg ( ( * it1 ) . subAccessor ) ;
}
stream < < " () " ;
}
stream < < " ; " < < endl ;
}
stream < < endl ;
writeSignalEmit ( * it , stream ) ;