#41 C style enum not getting populated in Properties.

closed-fixed
nobody
None
5
2012-09-13
2012-09-13
bgrupczy
No

I need to take header files as is and can not make them more C++ like. Is there a way to get the parse to work for the following type of example?

from CppHeaderParser import CppHeader
code = """
enum eStep
{
START,
MIDDLE,
END
};

class StatusHdr
{
public:

bool boolTestFailed;
UINT8 goodCount;
UINT8 badCount;
enum eStep currentStep;
};
"""
cppheader = CppHeader(code, argType="string")
print cppheader
print cppheader.enums

class StatusHdr
{
public
// Properties
{'constant': 0, 'name': 'boolTestFailed', 'reference': 0, 'type': 'bool', 'static': 0, 'pointer': 0}
{'constant': 0, 'name': 'goodCount', 'reference': 0, 'type': 'UINT8', 'static': 0, 'pointer': 0}
{'constant': 0, 'name': 'badCount', 'reference': 0, 'type': 'UINT8', 'static': 0, 'pointer': 0}
protected
private
}

[{'values': [{'name': 'START', 'value': 0}, {'name': 'MIDDLE', 'value': 1}, {'name': 'END', 'value': 2}], 'namespace': '', 'type': <type 'int'>, 'name': 'eStep'}]

Discussion

  • Jashua Cloutier

    Jashua Cloutier - 2012-09-13

    Im not sure what you want it to do that it isnt doing. It looks like all the information you want is there.

    What is it not doing exactly that you want it to do. Please elaborate to help me understand.

     
  • bgrupczy

    bgrupczy - 2012-09-13

    Thanks for the quick response!

    I was expecting the declared enum to be in the properties. Something like the following:

    class StatusHdr
    {
    public
    // Properties
    {'constant': 0, 'name': 'boolTestFailed', 'reference': 0, 'type': 'bool', 'static': 0, 'pointer': 0}
    {'constant': 0, 'name': 'goodCount', 'reference': 0, 'type': 'UINT8', 'static': 0, 'pointer': 0}
    {'constant': 0, 'name': 'badCount', 'reference': 0, 'type': 'UINT8', 'static': 0, 'pointer': 0}
    {'constant': 0, 'name': 'currentStep', 'reference': 0, 'type': 'enum eStep', 'static': 0, 'pointer': 0}
    protected
    private
    }

    or this as the element:
    {'constant': 0, 'name': 'currentStep', 'reference': 0, 'type': 'eStep', 'static': 0, 'pointer': 0}

     
  • Jashua Cloutier

    Jashua Cloutier - 2012-09-13

    This has been fixed in 90:92070778ce4c

     
  • Jashua Cloutier

    Jashua Cloutier - 2012-09-13
    • status: open --> closed-fixed
     

Log in to post a comment.