| 1 | /*************************************************************************** |
| 2 | CType.cpp - description |
| 3 | ------------------- |
| 4 | begin : December 29th, 2008 |
| 5 | copyright : (C) 2008 by Duong Khang NGUYEN |
| 6 | email : neoneurone @ gmail com |
| 7 | |
| 8 | $Id: CType.cpp 449 2010-05-20 18:46:59Z neoneurone $ |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | /*************************************************************************** |
| 12 | * * |
| 13 | * This program is free software; you can redistribute it and/or modify * |
| 14 | * it under the terms of the GNU General Public License as published by * |
| 15 | * the Free Software Foundation; either version 2 of the License, or * |
| 16 | * any later version. * |
| 17 | * * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | // Framework headers |
| 21 | #include "CType.h" // System::Type class |
| 22 | |
| 23 | // GCC headers // GCC demangle functionality |
| 24 | #include "cxxabi.h" |
| 25 | |
| 26 | // Standard C++ headers |
| 27 | #include <cstdlib> // free() |
| 28 | |
| 29 | |
| 30 | SPF_NAMESPACE_BEGIN(System) |
| 31 | |
| 32 | |
| 33 | /*=====================================================================*/ |
| 34 | Type::Type() {} |
| 35 | |
| 36 | |
| 37 | Type::Type(const NullValue& null): Reflection::MemberInfo(null) {} |
| 38 | |
| 39 | |
| 40 | Type::Type(const std::type_info& typeInfo) |
| 41 | { |
| 42 | int iStatus; |
| 43 | char* sRealName = abi::__cxa_demangle(typeInfo.name(), 0, 0, &iStatus); |
| 44 | |
| 45 | msName = sRealName; |
| 46 | msFullName = sRealName; |
| 47 | free(sRealName); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | Type::~Type() {} |
| 52 | |
| 53 | |
| 54 | /*=====================================================================*/ |
| 55 | const String& Type::GetNamespace() const |
| 56 | { |
| 57 | return msNamespace; |
| 58 | } |
| 59 | |
| 60 | |
| 61 | /*=====================================================================*/ |
| 62 | const String& Type::GetFullName() const |
| 63 | { |
| 64 | return msFullName; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | /*=====================================================================*/ |
| 69 | String Type::ToString() const |
| 70 | { |
| 71 | return String("System::Type"); |
| 72 | } |
| 73 | |
| 74 | |
| 75 | /*=====================================================================*/ |
| 76 | Type& Type::operator=(const Type& type) |
| 77 | { |
| 78 | msName = type.msName; |
| 79 | msNamespace = type.msNamespace; |
| 80 | msFullName = type.msFullName; |
| 81 | |
| 82 | return *this; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | bool Type::operator==(const Type& type) const |
| 87 | { |
| 88 | return (msFullName == type.msFullName); |
| 89 | } |
| 90 | |
| 91 | |
| 92 | SPF_NAMESPACE_END |