mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Correções em type.hpp
This commit is contained in:
parent
3f875f916e
commit
f4a839eac9
@ -1,7 +1,8 @@
|
||||
#ifndef XNA_CSHARP_TYPE_HPP
|
||||
#define XNA_CSHARP_TYPE_HPP
|
||||
|
||||
#include "xna/helpers.hpp"
|
||||
#include "../helpers.hpp"
|
||||
#include "../exception.hpp"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@ -60,38 +61,30 @@ namespace xna {
|
||||
|
||||
template <class T>
|
||||
inline std::shared_ptr<Type> typeof() {
|
||||
if (std::is_arithmetic<T>::value) {
|
||||
auto primitiveType = std::make_shared<Type>();
|
||||
primitiveType->fullName = typeid(T).name();
|
||||
primitiveType->isPrimitive = true;
|
||||
primitiveType->isValueType = true;
|
||||
return primitiveType;
|
||||
}
|
||||
|
||||
if (std::is_enum<T>::value) {
|
||||
auto enumType = std::make_shared<Type>();
|
||||
enumType->fullName = typeid(T).name();
|
||||
enumType->isValueType = true;
|
||||
enumType->isEnum = true;
|
||||
return enumType;
|
||||
}
|
||||
auto type = std::make_shared<Type>();
|
||||
type->fullName = typeid(T).name();
|
||||
|
||||
if (std::is_pointer<T>::value) {
|
||||
auto pointerType = std::make_shared<Type>();
|
||||
pointerType->fullName = typeid(T).name();
|
||||
pointerType->isPointer = true;
|
||||
return pointerType;
|
||||
if (std::is_arithmetic<T>::value) {
|
||||
type->isPrimitive = true;
|
||||
type->isValueType = true;
|
||||
}
|
||||
|
||||
if (std::is_class<T>::value) {
|
||||
auto classType = std::make_shared<Type>();
|
||||
classType->fullName = typeid(T).name();
|
||||
classType->isClass = true;
|
||||
|
||||
return classType;
|
||||
else if (std::is_enum<T>::value) {
|
||||
type->isValueType = true;
|
||||
type->isEnum = true;
|
||||
}
|
||||
else if (std::is_pointer<T>::value) {
|
||||
type->isPointer = true;
|
||||
}
|
||||
else if (std::is_class<T>::value) {
|
||||
type->isClass = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Exception::Throw(Exception::INVALID_OPERATION);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return type;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
Loading…
x
Reference in New Issue
Block a user