Hello everybody,
i have an xml file which i read during start-up and write when the programm is quit.
The dataset is read into a qmap during parsing. Two parameters i read through the process are form typ enum.
///*! Enum for xxx names*/
typedef enum {
x1 = 0, /***/
x3, /***/
x8, /***/
undefined_xxNames /***/
}EnumxxNames;
QString getEnumxxNames
(EnumxxNames element
);
///*! Enum for xxx names*/
typedef enum {
x1 = 0, /***/
x3, /***/
x8, /***/
undefined_xxNames /***/
}EnumxxNames;
QString getEnumxxNames(EnumxxNames element);
To copy to clipboard, switch view to plain text mode
QString graphicsEnum
::getEnumxxNames(EnumxxNames element
) {
switch(element)
{
case x1:
case x3:
case x8:
default:
}
}
QString graphicsEnum::getEnumxxNames(EnumxxNames element)
{
switch(element)
{
case x1:
return QString("x1");
case x3:
return QString("x3");
case x8:
return QString("x8");
default:
return QString::number(element);
}
}
To copy to clipboard, switch view to plain text mode
in xml parser
qDebug()<<readItem(xx,getStringXMLItem(Properties),getStringXMLItemProperties(xxName));
qDebug()<<readItem(xx,getStringXMLItem(Properties),getStringXMLItemProperties(xxName));
To copy to clipboard, switch view to plain text mode
Note readItem gives back a Qstring -->
reads out x1, x3,x8
if i want to conert that back to the enum using static cast
qDebug()<<getEnumxxNames(static_cast<EnumxxNames>(readItem(xx,getStringXMLItem(Properties),getStringXMLItemProperties(xxName)));
qDebug()<<getEnumxxNames(static_cast<EnumxxNames>(readItem(xx,getStringXMLItem(Properties),getStringXMLItemProperties(xxName)));
To copy to clipboard, switch view to plain text mode
reads out x8
why is that...what is wrong here....
Is there a other way to get this done ?
Bookmarks