[Rock-dev] typelib enums...

Janosch Machowinski Janosch.Machowinski at dfki.de
Fri Jul 18 15:50:24 CEST 2014


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



More information about the Rock-dev mailing list