Scanning of anonymous containers is now disabled by default, due to a bug in gccxml and the problems it causes.

This commit is contained in:
Gustavo J. A. M. Carneiro committed 2008-08-29 14:39:43 +01:00
1 parent 992e902fad
commit 4e41b8c02e
4 files changed
+22 -6

No files matched your search

+15
View File
@@ -499,6 +499,15 @@ class PygenClassifier(object):
class ModuleParser(object):
"""
@ivar enable_anonymous_containers: if True, pybindgen will attempt
to scan for all std containers, even the ones that have no
typedef'ed name. However, due to a
U{bug<http://www.gccxml.org/Bug/view.php?id=7572>} in gccxml
this is disabled by default.
"""
def __init__(self, module_name, module_namespace_name='::'):
"""
Creates an object that will be able parse header files and
@@ -529,6 +538,7 @@ class ModuleParser(object):
self._anonymous_structs = [] # list of (pygccxml_anonymous_class, outer_pybindgen_class)
self._containers_to_register = []
self._containers_registered = {}
self.enable_anonymous_containers = False
def add_pre_scan_hook(self, hook):
"""
@@ -946,6 +956,8 @@ pybindgen.settings.error_handler = ErrorHandler()
if traits is None:
continue
name = normalize_name(type_info.partial_decl_string)
#print >> sys.stderr, "** type: %s; ---> partial_decl_string: %r; name: %r" %\
# (type_info, type_info.partial_decl_string, name)
self._containers_to_register.append((traits, type_info, None, name))
## scan enumerations
@@ -1312,6 +1324,9 @@ pybindgen.settings.error_handler = ErrorHandler()
pygen_sink.writeln()
def _register_container(self, module, traits, definition, outer_class, name):
if '<' in name and not self.enable_anonymous_containers:
return
kwargs = {}
if traits is container_traits.list_traits:
+1 -1
View File
@@ -554,7 +554,7 @@ class ModuleBase(dict):
"""
Add a container to the module.
@param container_: a Container object
@param container: a L{Container} object
"""
assert isinstance(container, Container)
container.module = self
+2 -2
View File
@@ -363,10 +363,10 @@ get_map ()
return rv;
}
std::set<std::string>
std::set<uint32_t>
get_set ()
{
std::set<std::string> rv;
std::set<uint32_t> rv;
return rv;
}
+4 -3
View File
@@ -742,6 +742,7 @@ struct simple_struct_t
// -- Containers:
typedef std::vector<simple_struct_t> SimpleStructList;
typedef std::vector<simple_struct_t> SimpleStructVec;
SimpleStructList get_simple_list ();
int set_simple_list (SimpleStructList list);
@@ -757,8 +758,8 @@ public:
// -#- @inout_list(direction=inout) -#-
virtual int set_simple_list_by_ref (SimpleStructList &inout_list);
virtual std::vector<simple_struct_t> get_simple_vec ();
virtual int set_simple_vec (std::vector<simple_struct_t> vec);
virtual SimpleStructVec get_simple_vec ();
virtual int set_simple_vec (SimpleStructVec vec);
private:
SimpleStructList m_simpleList;
@@ -766,6 +767,6 @@ private:
std::map<std::string, int> get_map ();
std::set<std::string> get_set ();
std::set<uint32_t> get_set ();
#endif /* !FOO_H_ */