3#include "../StringView.h"
11 constexpr bool always_false =
false;
18 static_assert(Cogs::Reflection::detail::always_false<T> &&
"No name specialization provided. Implement getName<Type>() or getNameImpl(Type *).");
25 return getNameImpl(
static_cast<typename std::remove_extent_t<typename std::remove_pointer_t<T>
>*>(
nullptr));
69 struct COGSFOUNDATION_API
Name
107 return this->
id == other.id;
112 const std::string &
getName()
const {
return name; }
116 const char *
c_str()
const {
return name.c_str(); }
Provides a weakly referenced view over the contents of a string.
Resepy from: https://developercommunity.visualstudio.com/t/C2607-after-upgrading-to-Visual-Studio-1/1...
uint16_t TypeId
Built in type used to uniquely identify a single type instance.
void(*)(void *) DestroyInstance
Object destroy function type. Comparable to regular delete.
void *(*)(void *) ConstructInstance
Object construction function type. Comparable to placement new.
uint16_t FieldId
Type used to index fields.
constexpr FieldId NoField
No field id.
constexpr TypeId NoType
Definition of no type.
constexpr MethodId NoMethod
No method id.
void *(*)() CreateInstance
Object creation function type. Comparable to regular new.
void(*)(void *) DestructInstance
Object destruction function type. Comparable to calling the destructor.
uint16_t MethodId
Type used to index methods.
Contains all Cogs related functionality.
constexpr size_t hash() noexcept
Simple getter function that returns the initial value for fnv1a hashing.
Represents an unique name.
Name(const char *name)
Construct a new unique name from the given null terminated C string.
Name()=default
Default constructor.
const char * c_str() const
Gets the name as a null-terminated string.
Name(const Name &other)=default
Defaulted copy constructor.
Name & operator=(Name &&other) noexcept=default
Default move assignment operator.
Name(const StringView &name)
Construct a new unique name instance from the given name string.
size_t getId() const
Get the unique identifier of this name.
Name & operator=(const Name &other)=default
Default copy assignment operator.
Name(Name &&other) noexcept=default
Default move constructor.
const std::string & getName() const
Get the string name. This can be empty, even in valid instances of Name.
bool operator==(const Name &other) const
Compare to other. Considered equal if the identifier is the same.
Name(const std::string &name)
Construct a new unique name from the given standard string.