[pygccxml-commit] SF.net SVN: pygccxml:[1696] pyplusplus_dev
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2009-02-22 20:23:34
|
Revision: 1696
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1696&view=rev
Author: roman_yakovenko
Date: 2009-02-22 20:23:32 +0000 (Sun, 22 Feb 2009)
Log Message:
-----------
adding support for hash_map container
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py
pyplusplus_dev/unittests/data/indexing_suites2_to_be_exported.hpp
pyplusplus_dev/unittests/indexing_suites2_tester.py
Modified: pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2009-02-22 13:56:26 UTC (rev 1695)
+++ pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2009-02-22 20:23:32 UTC (rev 1696)
@@ -100,7 +100,10 @@
if self.declaration.indexing_suite.use_container_suite:
answer.append( bpi + '::container_suite' )
else:
- answer.append( bpi + '::' + self.declaration.name.split( '<' )[0] + '_suite' )
+ container_name = self.declaration.name.split( '<' )[0]
+ if container_name.startswith( 'hash_' ):
+ container_name = container_name[len( 'hash_'):]
+ answer.append( bpi + '::' + container_name + '_suite' )
answer.append( '< ' )
answer.append( self.decl_identifier )
if self.does_user_disable_methods():
Modified: pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py
===================================================================
--- pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py 2009-02-22 13:56:26 UTC (rev 1695)
+++ pyplusplus_dev/pyplusplus/decl_wrappers/indexing_suite2.py 2009-02-22 20:23:32 UTC (rev 1696)
@@ -40,9 +40,10 @@
, 'map' : "indexing_suite/map.hpp"
, 'multimap' : "indexing_suite/multimap.hpp"
, 'hash_map' : "indexing_suite/map.hpp"
+ #, 'hash_multimap' : "indexing_suite/multimap.hpp"
, 'set' : "indexing_suite/set.hpp"
, 'hash_set' : "indexing_suite/set.hpp"
- #TODO: queue, priority, stack, hash_multimap, multiset, hash_multiset
+ #TODO: queue, priority, stack, multiset, hash_multiset
}
class indexing_suite2_t( object ):
Modified: pyplusplus_dev/unittests/data/indexing_suites2_to_be_exported.hpp
===================================================================
--- pyplusplus_dev/unittests/data/indexing_suites2_to_be_exported.hpp 2009-02-22 13:56:26 UTC (rev 1695)
+++ pyplusplus_dev/unittests/data/indexing_suites2_to_be_exported.hpp 2009-02-22 20:23:32 UTC (rev 1696)
@@ -6,7 +6,20 @@
#ifndef __indexing_suites2_to_be_exported_hpp__
#define __indexing_suites2_to_be_exported_hpp__
-#include <hash_map>
+#if defined( __GNUC__ )
+ #include <ext/hash_set>
+ #include <ext/hash_map>
+ #define HASH_XXX_NS __gnu_cxx
+#else
+ #include <hash_set>
+ #include <hash_map>
+ #if defined( __GCCXML__ ) && !defined( __PYGCCXML_MSVC9__ )
+ #define HASH_XXX_NS std
+ #else
+ #define HASH_XXX_NS stdext
+ #endif//GCCXML
+#endif
+
#include <vector>
#include <string>
#include <map>
@@ -59,10 +72,18 @@
typedef std::vector<float> fvector;
fvector empty_fvector(){ return fvector(); }
-stdext::hash_map< int, int > get_int_mapping(){
- return stdext::hash_map< int, int >();
+HASH_XXX_NS::hash_map< int, int > get_int_mapping(){
+ HASH_XXX_NS::hash_map< int, int > x;
+ x[ 1 ] = 1;
+ return x;
}
+HASH_XXX_NS::hash_multimap< int, int > get_int_multimapping(){
+ HASH_XXX_NS::hash_multimap< int, int > x;
+ x.insert( HASH_XXX_NS::hash_multimap< int, int >::value_type( 1,1) );
+ return x;
+}
+
typedef std::map< std::string, std::string > name2value_t;
inline std::string get_first_name( name2value_t const * names ){
if( !names ){
Modified: pyplusplus_dev/unittests/indexing_suites2_tester.py
===================================================================
--- pyplusplus_dev/unittests/indexing_suites2_tester.py 2009-02-22 13:56:26 UTC (rev 1695)
+++ pyplusplus_dev/unittests/indexing_suites2_tester.py 2009-02-22 20:23:32 UTC (rev 1696)
@@ -80,6 +80,14 @@
set_of_strings.add("s1")
set_of_strings.add("s")
+ x = module.get_int_mapping()
+ self.failUnless( x[1] == 1 )
+ try:
+ x = module.get_int_multimapping()
+ self.failUnless( x[1] == 1 )
+ except TypeError:
+ pass
+
def create_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|