9 #include "Reflex/Object.h"
10 #include "Reflex/Base.h"
24 m_type.Destruct( ptr );
28 static std::string
const prefix(
"LCGReflex/");
36 if( type == castType ){
38 }
else if( type.HasBase( castType )){
39 Reflex::Object theObj( type, ptr );
40 ret = theObj.CastObject( castType ).Address();
48 if( type == baseType || type.HasBase( baseType )){
55 const std::string& mappedTypeName ){
57 return (mappedTypeName==
"std::basic_string<char>" || mappedTypeName==
"basic_string<char>" || mappedTypeName==
"std::string" || mappedTypeName==
"string");
58 }
else if ( type.IsEnum() ){
59 return mappedTypeName==
"int";
63 return type.Name(Reflex::SCOPED)==mappedTypeName;
69 for (
unsigned int i=0;
i<type.BaseSize() && !
found;
i++){
73 func = base.OffsetFP();
85 char* realname = abi::__cxa_demangle( typeInfo.name(), 0, 0, &
status);
86 if( status == 0 && realname ){
95 if( typeInfo ==
typeid(std::string) ){
97 type = Reflex::Type::ByName(
"std::string");
101 type = Reflex::Type::ByTypeInfo( typeInfo );
103 if( !type && throwFlag ){
105 "ClassUtils::lookupDictionary" );
112 if( className ==
"std::basic_string<char>" ){
114 type = Reflex::Type::ByName(
"std::string");
118 type = Reflex::Type::ByName( className );
120 if( !type && throwFlag ){
121 throwException(
"Class \""+className+
"\" has not been found in the dictionary.",
122 "ClassUtils::lookupDictionary" );
129 if( typ.Name(Reflex::SCOPED)==
"std::string"){
130 ptr =
new std::string(
"");
132 ptr = typ.Construct().Address();
138 std::string
name = typ.Name(Reflex::SCOPED|Reflex::FINAL);
139 return ( name ==
"std::string" ||
140 name ==
"std::basic_string<char>" );
144 return ( typ.IsFundamental() || typ.IsEnum() ||
isTypeString( typ ) );
148 Reflex::TypeTemplate templ = typ.TemplateFamily();
152 std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL);
153 if( contName ==
"std::vector" ||
154 contName ==
"std::list" ||
155 contName ==
"std::deque" ||
156 contName ==
"std::stack" ||
157 contName ==
"std::set" ||
158 contName ==
"std::multiset" ||
159 contName ==
"__gnu_cxx::hash_set" ||
160 contName ==
"__gnu_cxx::hash_multiset" ||
161 contName ==
"std::map" ||
162 contName ==
"std::multimap" ||
163 contName ==
"__gnu_cxx::hash_map" ||
164 contName ==
"__gnu_cxx::hash_multimap" ||
165 contName ==
"ora::PVector" ||
166 contName ==
"ora::QueryableVector" ){
174 Reflex::TypeTemplate
tt = typ.TemplateFamily();
178 std::string contName = tt.Name(Reflex::SCOPED|Reflex::FINAL);
179 if( contName ==
"std::map" ||
180 contName ==
"std::multimap" ||
181 contName ==
"std::set" ||
182 contName ==
"std::multiset" ||
183 contName ==
"__gnu_cxx::hash_set" ||
184 contName ==
"__gnu_cxx::hash_multiset" ||
185 contName ==
"__gnu_cxx::hash_map" ||
186 contName ==
"__gnu_cxx::hash_multimap" ){
194 Reflex::TypeTemplate templ = typ.TemplateFamily();
198 std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL);
199 if( contName ==
"std::vector" ||
200 contName ==
"std::list" ||
201 contName ==
"std::deque" ||
202 contName ==
"std::stack" ||
203 contName ==
"ora::PVector" ||
204 contName ==
"ora::QueryableVector" ){
212 Reflex::TypeTemplate
tt = typ.TemplateFamily();
216 std::string contName = tt.Name(Reflex::SCOPED|Reflex::FINAL);
217 if( contName ==
"std::map" ||
218 contName ==
"std::multimap" ||
219 contName ==
"__gnu_cxx::hash_map" ||
220 contName ==
"__gnu_cxx::hash_multimap" ){
228 Reflex::TypeTemplate
tt = typ.TemplateFamily();
232 std::string contName = tt.Name(Reflex::SCOPED|Reflex::FINAL);
233 if( contName ==
"std::vector" ||
234 contName ==
"std::list" ||
235 contName ==
"std::deque" ||
236 contName ==
"std::stack" ||
237 contName ==
"std::set" ||
238 contName ==
"std::multiset" ||
239 contName ==
"__gnu_cxx::hash_set" ||
240 contName ==
"__gnu_cxx::hash_multiset" ||
241 contName ==
"ora::PVector" ||
242 contName ==
"ora::QueryableVector"){
251 Reflex::TypeTemplate templ = typ.TemplateFamily();
255 std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL);
256 if( contName ==
"ora::Ptr" ){
264 return typ.HasBase(Reflex::Type::ByTypeInfo(
typeid(
ora::Reference)));
272 Reflex::TypeTemplate templ = typ.TemplateFamily();
276 std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL);
277 if( contName ==
"ora::UniqueRef" ){
285 Reflex::TypeTemplate templ = typ.TemplateFamily();
289 std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL);
290 if( contName ==
"ora::PVector" ){
298 Reflex::TypeTemplate templ = typ.TemplateFamily();
302 std::string contName = templ.Name(Reflex::SCOPED|Reflex::FINAL);
303 if( contName ==
"ora::QueryableVector" ){
318 size_t idx = typeName.find(
'<');
319 if( idx != std::string::npos ){
320 std::string tname = typeName.substr( 0, idx );
321 return (tname ==
"ora::PVector" || tname ==
"ora::QueryableVector" || tname ==
"pool::PVector" );
332 if( resType.IsArray() )
return false;
344 size_t subTypeSize = typ.SubTypeSize();
346 while(i<subTypeSize){
348 if(sti.Name()==
"value_type") {
360 size_t subTypeSize = typ.SubTypeSize();
362 while(i<subTypeSize){
364 if(sti.Name()==
"key_type") {
376 size_t subTypeSize = typ.SubTypeSize();
378 while(i<subTypeSize){
380 if(sti.Name()==
"mapped_type") {
391 size_t subTypeSize = typ.SubTypeSize();
393 while(i<subTypeSize){
395 if(sti.Name()==subTypeName) {
406 while(resolvedType.IsTypedef()){
407 resolvedType = resolvedType.ToType();
bool isTypeOraPointer(const Reflex::Type &typ)
bool isTypeNonKeyedContainer(const Reflex::Type &typ)
bool isTypeAssociativeContainer(const Reflex::Type &typ)
bool isTypeString(const Reflex::Type &typ)
void * constructObject(const Reflex::Type &typ)
bool isTypePVector(const Reflex::Type &typ)
bool isTypeOraReference(const Reflex::Type &typ)
void operator()(void *ptr)
bool findBaseType(Reflex::Type &type, Reflex::Type &baseType, Reflex::OffsetFunction &func)
bool isTypeUniqueReference(const Reflex::Type &typ)
std::string demangledName(const std::type_info &typeInfo)
Reflex::Type containerSubType(const Reflex::Type &typ, const std::string &subTypeName)
Reflex::Type containerDataType(const Reflex::Type &typ)
bool checkMappedType(const Reflex::Type &type, const std::string &mappedTypeName)
bool isTypeNameOraVector(const std::string &typeName)
void loadDictionary(const std::string &className)
RflxDeleter(const Reflex::Type &type)
bool isTypeContainer(const Reflex::Type &typ)
static PluginCapabilities * get()
Reflex::Type containerKeyType(const Reflex::Type &typ)
Reflex::Type containerValueType(const Reflex::Type &typ)
Reflex::Type resolvedType(const Reflex::Type &typ)
bool isTypeKeyedContainer(const Reflex::Type &typ)
bool isTypePrimitive(const Reflex::Type &typ)
bool isTypeNamedReference(const Reflex::Type &typ)
void * upCast(const Reflex::Type &type, void *ptr, const Reflex::Type &asType)
void throwException(const std::string &message, const std::string &methodName)
void load(const std::string &iName)
bool isTypeNonAssociativeContainer(const Reflex::Type &typ)
bool isTypeOraVector(const Reflex::Type &typ)
Reflex::Type lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
bool isTypeObject(const Reflex::Type &typ)
std::string className(const T &t)
bool isType(const Reflex::Type &type, const Reflex::Type &baseType)
bool isTypeQueryableVector(const Reflex::Type &typ)