1 from . import enums
2 from pygccxml import declarations
11
14 self.__full_name = full_name
15 self.__identifiers = self.__split_scope_identifiers()
16 self.__scope_identifiers = None
17
18 @property
20 return self.__identifiers[-1]
21
22 @property
24 if None is self.__scope_identifiers:
25 self.__scope_identifiers = []
26 for i in range( len(self.__identifiers) - 1):
27 self.__scope_identifiers.append( '::'.join( self.__identifiers[0:i+1] ) )
28 return self.__scope_identifiers
29
30 @property
32 return self.__identifiers
33
35 try:
36 result = []
37 tmp = self.__full_name.split( '::' )
38 tmp.reverse()
39 while tmp:
40 token = tmp.pop()
41 less_count = token.count( '<' )
42 greater_count = token.count( '>' )
43 if less_count != greater_count:
44 while less_count != greater_count and tmp:
45 next_token = tmp.pop()
46 token = token + '::' + next_token
47 less_count += next_token.count( '<' )
48 greater_count += next_token.count( '>' )
49 result.append( token )
50 return result
51 except Exception, err:
52 msg = 'Unable to split scope for identifiers. The full scope name is: "%s". Error: %s'
53 msg = msg % ( self.__full_name, str(err) )
54 raise RuntimeError( msg )
55
56 __name_splitters = {}
64
65 if '__main__' == __name__:
66 name = "boost::detail::is_base_and_derived_impl2<engine_objects::universal_base_t,engine_objects::erroneous_transactions_file_configuration_t>::Host"
67 fnsp = full_name_splitter_t( name )
68 for x in fnsp.scope_names:
69 print x
70
71 fnsp = full_name_splitter_t( 'x' )
72 for x in fnsp.scope_names:
73 print x
74