1. senex
  2. cppheaderparser
  3. Issues
Issue #14 resolved

Global namespace "returns" attribute of MethodObj not parsed correctly

Daniel DeSousa
created an issue

When I attempt to parse a method with a return type referencing the global namespace, it seems as though it incorrectly parses the file:

struct Example {
    uint8_t foo() { return 4;}
    ::uint8_t bar() { return 0; }
};
#!/usr/bin/env python
# encoding: utf-8

import CppHeaderParser

f_str = open("sample.h", "rb").read()
header = CppHeaderParser.CppHeader(f_str, argType='string')

for classname, classobj in header.classes.iteritems():
    if 'methods' in classobj:
        for methodobj in classobj['methods']['public']:
            print methodobj['name'], methodobj['returns'], methodobj['rtnType']
>>
foo uint8_t uint8_t
bar : uint8_t uint8_t

Attached is a source header and script to reproduce the problem. It seems like the 'returns' attribute mangles the namespace, leaving one colon from the global namespace.

Comments (4)

  1. Log in to comment