@ -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,25 +598,29 @@ 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 " ) ;
method . async = hasAnnotation ( element , " org.freedesktop.DBus.GLib.Async " ) ;
classData . methods . append ( method ) ;
if ( method . async ) {
method . async = false ;
classData . methods . append ( method ) ;
if ( method . async ) {
method . async = false ;
classData . methods . append ( method ) ;
}
}
else
classData . msignals . append ( method ) ;
}
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 < < " 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 ;
@ -938,39 +949,36 @@ void MethodGenerator::writeSignalEmitter(const Class& classData,
it = method . arguments . begin ( ) ;
for ( ; it ! = endIt ; + + it )
{
if ( ( * it ) . direction = = Argument : : In )
if ( ! ( * it ) . annotatedType. isEmpty ( ) )
{
if ( ! ( * it ) . annotatedType . isEmpty ( ) )
// TODO: error handling
stream < < " TQT_DBusData " < < ( * it ) . name < < " Data; " < < endl ;
stream < < " if (TQT_DBusDataConverter:convertToTQT_DBusData< "
< < ( * it ) . annotatedType < < " >( "
< < ( * it ) . name < < " , " < < ( * it ) . name < < " Data "
< < " ) != TQT_DBusDataConverter::Success) return false; "
< < endl ;
stream < < " message << " < < ( * it ) . name < < " Data " ;
}
else if ( ! ( * it ) . accessor . isEmpty ( ) )
{
stream < < " message << TQT_DBusData::from " < < ( * it ) . accessor ;
if ( ! ( * it ) . subAccessor . isEmpty ( ) )
{
// TODO: error handling
stream < < " TQT_DBusData " < < ( * it ) . name < < " Data; " < < endl ;
stream < < " if (TQT_DBusDataConverter:convertToTQT_DBusData< "
< < ( * it ) . annotatedType < < " >( "
< < ( * it ) . name < < " , " < < ( * it ) . name < < " Data "
< < " ) != TQT_DBusDataConverter::Success) return false; "
< < endl ;
stream < < " message << " < < ( * it ) . name < < " Data " ;
stream < < " ( " < < ( * it ) . containerClass ;
}
else if ( ! ( * it ) . accessor . isEmpty ( ) )
{
stream < < " message << TQT_DBusData::from " < < ( * it ) . accessor ;
if ( ! ( * it ) . subAccessor . isEmpty ( ) )
{
stream < < " ( " < < ( * it ) . containerClass ;
}
stream < < " ( " < < ( * it ) . name < < " ) " ;
stream < < " ( " < < ( * it ) . name < < " ) " ;
if ( ! ( * it ) . subAccessor . isEmpty ( ) )
{
stream < < " ) " ;
}
if ( ! ( * it ) . subAccessor . isEmpty ( ) )
{
stream < < " ) " ;
}
else
stream < < " message << " < < ( * it ) . name ;
stream < < " ; " < < endl ;
}
else
stream < < " message << " < < ( * it ) . name ;
stream < < " ; " < < endl ;
}
stream < < 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 ) ;