CppHeaderParser (version 1.9) | index /home/senex/workspace/cppheaderparser/CppHeaderParser/CppHeaderParser.py

`Parse C++ header files and generate a data structure
representing the class`

Modules
`` |  |
inspect ply.lex | os re | sys |

Classes
`` |  | CppHeader __builtin__.dict(__builtin__.object) CppClass CppEnum CppMethod CppVariable exceptions.Exception(exceptions.BaseException) CppParseError
class CppClass(__builtin__.dict)
`` | `Takes a name stack and turns it into a class Contains the following Keys: self['name'] - Name of the class self['doxygen'] - Doxygen comments associated with the class if they exist self['inherits'] - List of Classes that this one inherits where the values are of the form {"access": Anything in supportedAccessSpecifier "class": Name of the class self['methods'] - Dictionary where keys are from supportedAccessSpecifier and values are a lists of CppMethod's self['properties'] - Dictionary where keys are from supportedAccessSpecifier and values are lists of CppVariable's self['enums'] - Dictionary where keys are from supportedAccessSpecifier and values are lists of CppEnum's An example of how this could look is as follows: #self = { 'name': "" 'inherits':[] 'methods': { 'public':[], 'protected':[], 'private':[] }, 'properties': { 'public':[], 'protected':[], 'private':[] }, 'enums': { 'public':[], 'protected':[], 'private':[] } }`
| Method resolution order: CppClass __builtin__.dict __builtin__.object Methods defined here: __init__(self, nameStack) __repr__(self) `Convert class to a string` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Methods inherited from __builtin__.dict: __cmp__(...) `x.__cmp__(y) <==> cmp(x,y)` __contains__(...) `D.__contains__(k) -> True if D has a key k, else False` __delitem__(...) `x.__delitem__(y) <==> del x[y]` __eq__(...) `x.__eq__(y) <==> x==y` __ge__(...) `x.__ge__(y) <==> x>=y` __getattribute__(...) `x.__getattribute__('name') <==> x.name` __getitem__(...) `x.__getitem__(y) <==> x[y]` __gt__(...) `x.__gt__(y) <==> x>y` __iter__(...) `x.__iter__() <==> iter(x)` __le__(...) `x.__le__(y) <==> x<=y` __len__(...) `x.__len__() <==> len(x)` __lt__(...) `x.__lt__(y) <==> x<y` __ne__(...) `x.__ne__(y) <==> x!=y` __setitem__(...) `x.__setitem__(i, y) <==> x[i]=y` __sizeof__(...) `D.__sizeof__() -> size of D in memory, in bytes` clear(...) `D.clear() -> None. Remove all items from D.` copy(...) `D.copy() -> a shallow copy of D` get(...) `D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.` has_key(...) `D.has_key(k) -> True if D has a key k, else False` items(...) `D.items() -> list of D's (key, value) pairs, as 2-tuples` iteritems(...) `D.iteritems() -> an iterator over the (key, value) items of D` iterkeys(...) `D.iterkeys() -> an iterator over the keys of D` itervalues(...) `D.itervalues() -> an iterator over the values of D` keys(...) `D.keys() -> list of D's keys` pop(...) `D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised` popitem(...) `D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.` setdefault(...) `D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D` update(...) `D.update(E, **F) -> None. Update D from dict/iterable E and F. If E has a .keys() method, does: for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]` values(...) `D.values() -> list of D's values` Data and other attributes inherited from __builtin__.dict: __hash__ = None __new__ = <built-in method __new__ of type object> `T.__new__(S, ...) -> a new object with type S, a subtype of T` fromkeys = <built-in method fromkeys of type object> `dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v. v defaults to None.`
class CppEnum(__builtin__.dict)
`` | `Takes a name stack and turns it into an Enum Contains the following Keys: self['name'] - Name of the enum (ex. "ItemState") self['namespace'] - Namespace containing the enum self['values'] - List of values where the values are a dictionary of the form {"name": name of the key (ex. "PARSING_HEADER"), "value": Specified value of the enum, this key will only exist if a value for a given enum value was defined }`
| Method resolution order: CppEnum __builtin__.dict __builtin__.object Methods defined here: __init__(self, nameStack) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Methods inherited from __builtin__.dict: __cmp__(...) `x.__cmp__(y) <==> cmp(x,y)` __contains__(...) `D.__contains__(k) -> True if D has a key k, else False` __delitem__(...) `x.__delitem__(y) <==> del x[y]` __eq__(...) `x.__eq__(y) <==> x==y` __ge__(...) `x.__ge__(y) <==> x>=y` __getattribute__(...) `x.__getattribute__('name') <==> x.name` __getitem__(...) `x.__getitem__(y) <==> x[y]` __gt__(...) `x.__gt__(y) <==> x>y` __iter__(...) `x.__iter__() <==> iter(x)` __le__(...) `x.__le__(y) <==> x<=y` __len__(...) `x.__len__() <==> len(x)` __lt__(...) `x.__lt__(y) <==> x<y` __ne__(...) `x.__ne__(y) <==> x!=y` __repr__(...) `x.__repr__() <==> repr(x)` __setitem__(...) `x.__setitem__(i, y) <==> x[i]=y` __sizeof__(...) `D.__sizeof__() -> size of D in memory, in bytes` clear(...) `D.clear() -> None. Remove all items from D.` copy(...) `D.copy() -> a shallow copy of D` get(...) `D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.` has_key(...) `D.has_key(k) -> True if D has a key k, else False` items(...) `D.items() -> list of D's (key, value) pairs, as 2-tuples` iteritems(...) `D.iteritems() -> an iterator over the (key, value) items of D` iterkeys(...) `D.iterkeys() -> an iterator over the keys of D` itervalues(...) `D.itervalues() -> an iterator over the values of D` keys(...) `D.keys() -> list of D's keys` pop(...) `D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised` popitem(...) `D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.` setdefault(...) `D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D` update(...) `D.update(E, **F) -> None. Update D from dict/iterable E and F. If E has a .keys() method, does: for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]` values(...) `D.values() -> list of D's values` Data and other attributes inherited from __builtin__.dict: __hash__ = None __new__ = <built-in method __new__ of type object> `T.__new__(S, ...) -> a new object with type S, a subtype of T` fromkeys = <built-in method fromkeys of type object> `dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v. v defaults to None.`
class CppHeader
`` | `Parsed C++ class header Variables produced: self.classes - Dictionary of classes found in a given header file where the key is the name of the class`
| Methods defined here: __init__(self, headerFileName, argType='file') __repr__(self) cur_namespace(self, add_double_colon=False) evaluate_class_stack(self) `Create a Class out of the name stack (but not its parts)` evaluate_enum_stack(self) `Create an Enum out of the name stack` evaluate_method_stack(self) `Create a method out of the name stack` evaluate_property_stack(self) `Create a Property out of the name stack` evaluate_stack(self) `Evaluates the current name stack`
class CppMethod(__builtin__.dict)
`` | `Takes a name stack and turns it into a method Contains the following Keys: self['rtnType'] - Return type of the method (ex. "int") self['name'] - Name of the method (ex. "getSize") self['doxygen'] - Doxygen comments associated with the method if they exist self['parameters'] - List of CppVariables`
| Method resolution order: CppMethod __builtin__.dict __builtin__.object Methods defined here: __init__(self, nameStack, curClass) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Methods inherited from __builtin__.dict: __cmp__(...) `x.__cmp__(y) <==> cmp(x,y)` __contains__(...) `D.__contains__(k) -> True if D has a key k, else False` __delitem__(...) `x.__delitem__(y) <==> del x[y]` __eq__(...) `x.__eq__(y) <==> x==y` __ge__(...) `x.__ge__(y) <==> x>=y` __getattribute__(...) `x.__getattribute__('name') <==> x.name` __getitem__(...) `x.__getitem__(y) <==> x[y]` __gt__(...) `x.__gt__(y) <==> x>y` __iter__(...) `x.__iter__() <==> iter(x)` __le__(...) `x.__le__(y) <==> x<=y` __len__(...) `x.__len__() <==> len(x)` __lt__(...) `x.__lt__(y) <==> x<y` __ne__(...) `x.__ne__(y) <==> x!=y` __repr__(...) `x.__repr__() <==> repr(x)` __setitem__(...) `x.__setitem__(i, y) <==> x[i]=y` __sizeof__(...) `D.__sizeof__() -> size of D in memory, in bytes` clear(...) `D.clear() -> None. Remove all items from D.` copy(...) `D.copy() -> a shallow copy of D` get(...) `D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.` has_key(...) `D.has_key(k) -> True if D has a key k, else False` items(...) `D.items() -> list of D's (key, value) pairs, as 2-tuples` iteritems(...) `D.iteritems() -> an iterator over the (key, value) items of D` iterkeys(...) `D.iterkeys() -> an iterator over the keys of D` itervalues(...) `D.itervalues() -> an iterator over the values of D` keys(...) `D.keys() -> list of D's keys` pop(...) `D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised` popitem(...) `D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.` setdefault(...) `D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D` update(...) `D.update(E, **F) -> None. Update D from dict/iterable E and F. If E has a .keys() method, does: for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]` values(...) `D.values() -> list of D's values` Data and other attributes inherited from __builtin__.dict: __hash__ = None __new__ = <built-in method __new__ of type object> `T.__new__(S, ...) -> a new object with type S, a subtype of T` fromkeys = <built-in method fromkeys of type object> `dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v. v defaults to None.`
class CppParseError(exceptions.Exception)
`` |  | Method resolution order: CppParseError exceptions.Exception exceptions.BaseException __builtin__.object Data descriptors defined here: __weakref__ `list of weak references to the object (if defined)` Methods inherited from exceptions.Exception: __init__(...) `x.__init__(...) initializes x; see x.__class__.__doc__ for signature` Data and other attributes inherited from exceptions.Exception: __new__ = <built-in method __new__ of type object> `T.__new__(S, ...) -> a new object with type S, a subtype of T` Methods inherited from exceptions.BaseException: __delattr__(...) `x.__delattr__('name') <==> del x.name` __getattribute__(...) `x.__getattribute__('name') <==> x.name` __getitem__(...) `x.__getitem__(y) <==> x[y]` __getslice__(...) `x.__getslice__(i, j) <==> x[i:j] Use of negative indices is not supported.` __reduce__(...) __repr__(...) `x.__repr__() <==> repr(x)` __setattr__(...) `x.__setattr__('name', value) <==> x.name = value` __setstate__(...) __str__(...) `x.__str__() <==> str(x)` __unicode__(...) Data descriptors inherited from exceptions.BaseException: __dict__ args message
class CppVariable(__builtin__.dict)
`` | `Takes a name stack and turns it into a method Contains the following Keys: self['type'] - Type for the variable (ex. "const string &") self['name'] - Name of the variable (ex. "numItems") self['namespace'] - Namespace containing the enum self['desc'] - Description of the variable if part of a method (optional) self['doxygen'] - Doxygen comments associated with the method if they exist self['defaltValue'] - Default value of the variable, this key will only exist if there is a default value`
| Method resolution order: CppVariable __builtin__.dict __builtin__.object Methods defined here: __init__(self, nameStack, **kwargs) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Methods inherited from __builtin__.dict: __cmp__(...) `x.__cmp__(y) <==> cmp(x,y)` __contains__(...) `D.__contains__(k) -> True if D has a key k, else False` __delitem__(...) `x.__delitem__(y) <==> del x[y]` __eq__(...) `x.__eq__(y) <==> x==y` __ge__(...) `x.__ge__(y) <==> x>=y` __getattribute__(...) `x.__getattribute__('name') <==> x.name` __getitem__(...) `x.__getitem__(y) <==> x[y]` __gt__(...) `x.__gt__(y) <==> x>y` __iter__(...) `x.__iter__() <==> iter(x)` __le__(...) `x.__le__(y) <==> x<=y` __len__(...) `x.__len__() <==> len(x)` __lt__(...) `x.__lt__(y) <==> x<y` __ne__(...) `x.__ne__(y) <==> x!=y` __repr__(...) `x.__repr__() <==> repr(x)` __setitem__(...) `x.__setitem__(i, y) <==> x[i]=y` __sizeof__(...) `D.__sizeof__() -> size of D in memory, in bytes` clear(...) `D.clear() -> None. Remove all items from D.` copy(...) `D.copy() -> a shallow copy of D` get(...) `D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.` has_key(...) `D.has_key(k) -> True if D has a key k, else False` items(...) `D.items() -> list of D's (key, value) pairs, as 2-tuples` iteritems(...) `D.iteritems() -> an iterator over the (key, value) items of D` iterkeys(...) `D.iterkeys() -> an iterator over the keys of D` itervalues(...) `D.itervalues() -> an iterator over the values of D` keys(...) `D.keys() -> list of D's keys` pop(...) `D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised` popitem(...) `D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.` setdefault(...) `D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D` update(...) `D.update(E, **F) -> None. Update D from dict/iterable E and F. If E has a .keys() method, does: for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]` values(...) `D.values() -> list of D's values` Data and other attributes inherited from __builtin__.dict: __hash__ = None __new__ = <built-in method __new__ of type object> `T.__new__(S, ...) -> a new object with type S, a subtype of T` fromkeys = <built-in method fromkeys of type object> `dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v. v defaults to None.`

Functions
`` |  | is_enum_namestack(nameStack) `Determines if a namestack is an enum namestack` is_namespace(nameStack) `Determines if a namespace is being specified` lineno() `Returns the current line number in our program.` t_COMMENT_MULTILINE(t) `/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/` t_COMMENT_SINGLELINE(t) `\/\/.*\n` t_NEWLINE(t) `\n+` t_error(v)

Data
`` |  | __version__ = '1.9' debug = 0 doxygenCommentCache = '' supportedAccessSpecifier = ['public', 'protected', 'private'] t_AMPERSTAND = '&' t_ASTERISK = r'\*' t_CHAR_LITERAL = "'.'" t_CLOSE_BRACE = '}' t_CLOSE_PAREN = r'\)' t_COLON = ':' t_COMMA = ',' t_DIVIDE = '/[^/]' t_EQUALS = '=' t_MINUS = r'\-' t_NAME = '[<>A-Za-z_~][A-Za-z0-9_]*' t_NUMBER = '[0-9][0-9XxA-Fa-f]*' t_OPEN_BRACE = '{' t_OPEN_PAREN = r'\(' t_OPERATOR_DIVIDE_OVERLOAD = '/=' t_PLUS = r'\+' t_PRECOMP_MACRO = r'\#.*' t_PRECOMP_MACRO_CONT = r'.*\\\n' t_SEMI_COLON = ';' t_STRING_LITERAL = r'"([^"\\]|\\.)*"' t_ignore = ' \t\r[].|!?%@' tokens = ['NUMBER', 'NAME', 'OPEN_PAREN', 'CLOSE_PAREN', 'OPEN_BRACE', 'CLOSE_BRACE', 'COLON', 'SEMI_COLON', 'COMMA', 'COMMENT_SINGLELINE', 'COMMENT_MULTILINE', 'PRECOMP_MACRO', 'PRECOMP_MACRO_CONT', 'ASTERISK', 'AMPERSTAND', 'EQUALS', 'MINUS', 'PLUS', 'DIVIDE', 'CHAR_LITERAL', ...] version = '1.9'