3#include "../StringView.h"
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));
107 return this->
id == other.id;
112 const std::string &
getName()
const {
return name; }
116 const char *
c_str()
const {
return name.c_str(); }
#define COGSFOUNDATION_API
Definition: FoundationBase.h:31
Cogs::StringView getNameImpl(T *)
All types in Cogs TypeDatabase must provide specialization of this function returning name of type as...
Definition: Name.h:16
Cogs::StringView getName< void * >()
Definition: Name.h:28
Cogs::StringView getName()
Definition: Name.h:23
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Resepy from: https://developercommunity.visualstudio.com/t/C2607-after-upgrading-to-Visual-Studio-1/1...
Definition: Name.h:9
constexpr bool always_false
Definition: Name.h:11
uint16_t TypeId
Built in type used to uniquely identify a single type instance.
Definition: Name.h:48
void(*)(void *) DestroyInstance
Object destroy function type. Comparable to regular delete.
Definition: Name.h:42
void *(*)(void *) ConstructInstance
Object construction function type. Comparable to placement new.
Definition: Name.h:39
uint16_t FieldId
Type used to index fields.
Definition: Name.h:54
constexpr FieldId NoField
No field id.
Definition: Name.h:60
constexpr TypeId NoType
Definition of no type.
Definition: Name.h:51
constexpr MethodId NoMethod
No method id.
Definition: Name.h:63
void *(*)() CreateInstance
Object creation function type. Comparable to regular new.
Definition: Name.h:36
void(*)(void *) DestructInstance
Object destruction function type. Comparable to calling the destructor.
Definition: Name.h:45
uint16_t MethodId
Type used to index methods.
Definition: Name.h:57
Main Cogs namespace.
Definition: MortonCode.h:5
constexpr size_t hash() noexcept
Simple getter function that returns the initial value for fnv1a hashing.
Definition: HashFunctions.h:62
Represents an unique name.
Definition: Name.h:70
Name(const char *name)
Construct a new unique name from the given null terminated C string.
Definition: Name.h:84
Name()=default
Default constructor.
const char * c_str() const
Gets the name as a null-terminated string.
Definition: Name.h:116
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.
Definition: Name.h:79
size_t getId() const
Get the unique identifier of this name.
Definition: Name.h:120
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.
Definition: Name.h:112
bool operator==(const Name &other) const
Compare to other. Considered equal if the identifier is the same.
Definition: Name.h:105
Name(const std::string &name)
Construct a new unique name from the given standard string.
Definition: Name.h:89