fixed SF bug:
ID: 2991229 Summary: nested type wrong generation
This commit is contained in:
parent
9e25833870
commit
796c96d34e
4 changed files with 113 additions and 10 deletions
2
README
2
README
|
@ -1,6 +1,6 @@
|
|||
Debugging
|
||||
---------
|
||||
To compile debugging code configure the project with the --enable-debug option. Then at runtime you may set the environment variable "DBUSXX_VERBOSE=1" to activate debugging and to '0' to deactivate debugging.
|
||||
To compile debugging code configure the project with the --enable-debug option. Then at runtime you may export the environment variable "DBUSXX_VERBOSE" to any value.
|
||||
|
||||
|
||||
BUGS:
|
||||
|
|
|
@ -26,5 +26,10 @@
|
|||
<method name="Info">
|
||||
<arg type="a{ss}" name="info" direction="out"/>
|
||||
</method>
|
||||
|
||||
<method name="Foo">
|
||||
<arg type="a(a(uu)s)" name="array" direction="out" />
|
||||
</method>
|
||||
|
||||
</interface>
|
||||
</node>
|
||||
|
|
|
@ -24,6 +24,8 @@ public:
|
|||
int32_t Sum(const std::vector<int32_t> & ints);
|
||||
|
||||
std::map< std::string, std::string > Info();
|
||||
|
||||
std::vector< ::DBus::Struct< std::vector< ::DBus::Struct< uint32_t, uint32_t > >, std::string > > Foo() {};
|
||||
};
|
||||
|
||||
#endif//__DEMO_ECHO_SERVER_H
|
||||
|
|
|
@ -87,6 +87,10 @@ const char *atomic_type_to_string(char t)
|
|||
|
||||
void _parse_signature(const string &signature, string &type, unsigned int &i)
|
||||
{
|
||||
cout << "signature: " << signature << endl;
|
||||
cout << "type: " << type << endl;
|
||||
cout << "i: " << i << ", signature[i]: " << signature[i] << endl;
|
||||
|
||||
for (; i < signature.length(); ++i)
|
||||
{
|
||||
switch (signature[i])
|
||||
|
@ -98,6 +102,80 @@ void _parse_signature(const string &signature, string &type, unsigned int &i)
|
|||
case '{':
|
||||
{
|
||||
type += "std::map< ";
|
||||
++i;
|
||||
_parse_signature(signature, type, i);
|
||||
type += " >";
|
||||
|
||||
break;
|
||||
}
|
||||
case '(':
|
||||
{
|
||||
type += "std::vector< ::DBus::Struct< ";
|
||||
++i;
|
||||
_parse_signature(signature, type, i);
|
||||
type += " > >";
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
type += "std::vector< ";
|
||||
_parse_signature(signature, type, i);
|
||||
|
||||
type += " >";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i+1 < signature.length() && signature[i+1] != ')' && signature[i+1] != '}')
|
||||
{
|
||||
type += ", ";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ')':
|
||||
case '}':
|
||||
{
|
||||
return;
|
||||
}
|
||||
default:
|
||||
{
|
||||
const char *atom = atomic_type_to_string(signature[i]);
|
||||
if (!atom)
|
||||
{
|
||||
cerr << "invalid signature" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
type += atom;
|
||||
|
||||
if (i+1 < signature.length() && signature[i+1] != ')' && signature[i+1] != '}')
|
||||
{
|
||||
type += ", ";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*{
|
||||
for (; i < signature.length(); ++i)
|
||||
{
|
||||
cout << "i: " << i << ", sig(i): " << signature[i] << endl;
|
||||
cout << "Type: " << type << endl;
|
||||
|
||||
switch (signature[i])
|
||||
{
|
||||
case 'a':
|
||||
{
|
||||
bool multi = false;
|
||||
switch (signature[++i])
|
||||
{
|
||||
case '{':
|
||||
{
|
||||
type += "std::map< ";
|
||||
|
||||
const char *atom = atomic_type_to_string(signature[++i]);
|
||||
if (!atom)
|
||||
|
@ -108,16 +186,27 @@ void _parse_signature(const string &signature, string &type, unsigned int &i)
|
|||
type += atom;
|
||||
type += ", ";
|
||||
++i;
|
||||
_parse_signature(signature, type, i);
|
||||
multi = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
type += "std::vector< ";
|
||||
_parse_signature(signature, type, i);
|
||||
type += " >V";
|
||||
multi = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_parse_signature(signature, type, i);
|
||||
type += " >";
|
||||
if (!multi)
|
||||
{
|
||||
_parse_signature(signature, type, i);
|
||||
}
|
||||
cout << "signature1: " << signature << endl;
|
||||
cout << "type1: " << type << endl;
|
||||
cout << "i1: " << i << ", sig(i): " << signature[i-1] << endl;
|
||||
|
||||
continue;
|
||||
}
|
||||
case '(':
|
||||
|
@ -125,9 +214,12 @@ void _parse_signature(const string &signature, string &type, unsigned int &i)
|
|||
type += "::DBus::Struct< ";
|
||||
++i;
|
||||
_parse_signature(signature, type, i);
|
||||
type += " >";
|
||||
if (signature[i+1])
|
||||
{
|
||||
type += " >S";
|
||||
cout << "signature2: " << signature << endl;
|
||||
cout << "type2: " << type << endl;
|
||||
cout << "i2: " << i << ", sig(i): " << signature[i] << endl;
|
||||
if ((i+1 < signature.length()) && (signature[i+1] != ')') )
|
||||
{
|
||||
type += ", ";
|
||||
}
|
||||
continue;
|
||||
|
@ -135,7 +227,11 @@ void _parse_signature(const string &signature, string &type, unsigned int &i)
|
|||
case ')':
|
||||
case '}':
|
||||
{
|
||||
return;
|
||||
type += " >?";
|
||||
cout << "close tag>" << endl;
|
||||
cout << "type3: " << type << endl;
|
||||
|
||||
return;
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
@ -147,7 +243,7 @@ void _parse_signature(const string &signature, string &type, unsigned int &i)
|
|||
}
|
||||
type += atom;
|
||||
|
||||
if (signature[i+1] != ')' && signature[i+1] != '}' && i+1 < signature.length())
|
||||
if (i+1 < signature.length() && signature[i+1] != ')' && signature[i+1] != '}')
|
||||
{
|
||||
type += ", ";
|
||||
}
|
||||
|
@ -155,7 +251,7 @@ void _parse_signature(const string &signature, string &type, unsigned int &i)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
string signature_to_type(const string &signature)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue