Discussion:
[Rock-dev] typelib enums...
Janosch Machowinski
2014-07-18 13:50:24 UTC
Permalink
Hey,
I try to generate a typlib enum, but typelib throws an BadName()...

enum FOO
{
BAR = -5,
SEMMEL,
FOOBAR,
};

This is what I get from Clang:
TypeClassName Enum
DeclName FOO
Enum CONST BAR Value -5
Enum CONST SEMMEL Value -4
Enum CONST FOOBAR Value -3

This is the code I use to add the type :
Typelib::Enum *enumVal =new
Typelib::Enum(decl->getQualifiedNameAsString());

for(clang::EnumDecl::enumerator_iterator it =
decl->enumerator_begin(); it != decl->enumerator_end(); it++)
{
enumVal->add(it->getDeclName().getAsString(),
it->getInitVal().getSExtValue());
std::cout << "Enum CONST " << it->getDeclName().getAsString()
<< " Value " << it->getInitVal().getSExtValue() << std::endl;
}

registry.add(enumVal);

And this is my Error message :
terminate called after throwing an instance of 'Typelib::BadName'
what(): FOO is not a valid type name

I don't get the error, a enum should be allowed to be named FOO...
Greetings
Janosch
--
Dipl. Inf. Janosch Machowinski
SAR- & Sicherheitsrobotik

Universit?t Bremen
FB 3 - Mathematik und Informatik
AG Robotik
Robert-Hooke-Stra?e 1
28359 Bremen, Germany

Zentrale: +49 421 178 45-6611

Besuchsadresse der Nebengesch?ftstelle:
Robert-Hooke-Stra?e 5
28359 Bremen, Germany

Tel.: +49 421 178 45-6614
Empfang: +49 421 178 45-6600
Fax: +49 421 178 45-4150
E-Mail: jmachowinski at informatik.uni-bremen.de

Weitere Informationen: http://www.informatik.uni-bremen.de/robotik
Sylvain Joyeux
2014-07-18 14:17:46 UTC
Permalink
My guess is that there is a leading space (seem to be in the error
message). Should add quotes in the error message ...

Sylvain

On Fri, Jul 18, 2014 at 3:50 PM, Janosch Machowinski
Post by Janosch Machowinski
Hey,
I try to generate a typlib enum, but typelib throws an BadName()...
enum FOO
{
BAR = -5,
SEMMEL,
FOOBAR,
};
TypeClassName Enum
DeclName FOO
Enum CONST BAR Value -5
Enum CONST SEMMEL Value -4
Enum CONST FOOBAR Value -3
Typelib::Enum *enumVal =new
Typelib::Enum(decl->getQualifiedNameAsString());
for(clang::EnumDecl::enumerator_iterator it =
decl->enumerator_begin(); it != decl->enumerator_end(); it++)
{
enumVal->add(it->getDeclName().getAsString(),
it->getInitVal().getSExtValue());
std::cout << "Enum CONST " << it->getDeclName().getAsString()
<< " Value " << it->getInitVal().getSExtValue() << std::endl;
}
registry.add(enumVal);
terminate called after throwing an instance of 'Typelib::BadName'
what(): FOO is not a valid type name
I don't get the error, a enum should be allowed to be named FOO...
Greetings
Janosch
--
Dipl. Inf. Janosch Machowinski
SAR- & Sicherheitsrobotik
Universit?t Bremen
FB 3 - Mathematik und Informatik
AG Robotik
Robert-Hooke-Stra?e 1
28359 Bremen, Germany
Zentrale: +49 421 178 45-6611
Robert-Hooke-Stra?e 5
28359 Bremen, Germany
Tel.: +49 421 178 45-6614
Empfang: +49 421 178 45-6600
Fax: +49 421 178 45-4150
E-Mail: jmachowinski at informatik.uni-bremen.de
Weitere Informationen: http://www.informatik.uni-bremen.de/robotik
_______________________________________________
Rock-dev mailing list
Rock-dev at dfki.de
http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev
Loading...