SWIG parses all declarations in its input in an object tree. Each node of this
tree is a DOHHash and developer documentation
explains how to navigate this tree.
One thing to notice is that the tree is constructed in two stages: first, the
input is just parsed and then pseudo-language TypePass is used to update
some of the objects attributes and add new synthetic ones.
There are several different object attributes related to its name:
nameis always present for any names declaration (e.g. function, class or an enum -- but not if it's an anonymous one for the latter). It is based on the name used in SWIG input sources but, confusingly, this is neither the lead name nor the full name of the C++ identifier: it does include containing class name for a nested declaration but does not include the namespace, if any. Also, this is not a C++ identifier but rather a SWIG type string for the class names, e.g. it could bestd::vector<(int)>(notice the extra parentheses), and so can't be used directly in the generated code, useSwigType_str()to obtain a C String representing it.sym:nameis the name which will be used in SWIG output.classtype,enumtype, ... is the full C++ name without namespace, if any.
For example, for this code:
enum {
E0
};
enum E {
E1 = 1,
E2
};
class C {
public:
enum EInC { E3 };
};
namespace N {
enum EInN {
E4
};
class CInN {
enum EInCInN { E5 };
};
}The following values will be used for the listed attributes:
| Object | name | sym:name | xxxtype |
|---|---|---|---|
| Anon enum | enum |
||
| Global enum | E | E | enum E |
| Global class | C | C | C |
| Nested enum | C::EInC | EInC | C::EInC |