13 #ifndef OGLPLUS_OBJECT_DESC_1107121519_HPP
14 #define OGLPLUS_OBJECT_DESC_1107121519_HPP
16 #include <oglplus/config/object.hpp>
20 #if !OGLPLUS_NO_OBJECT_DESC
30 #if !OGLPLUS_NO_OBJECT_DESC
36 ObjectDesc(std::string&& str)
37 #if !OGLPLUS_NO_OBJECT_DESC
38 : _str(std::forward<std::string>(str))
41 OGLPLUS_FAKE_USE(str);
44 ObjectDesc(ObjectDesc&& tmp)
45 #if !OGLPLUS_NO_OBJECT_DESC
46 : _str(std::move(tmp._str))
49 OGLPLUS_FAKE_USE(tmp);
52 const std::string& Str(
void)
54 #if !OGLPLUS_NO_OBJECT_DESC
57 return EmptyStdString();
61 #if !OGLPLUS_NO_OBJECT_DESC
62 std::string&& Release(
void)
64 return std::move(_str);
71 #if !OGLPLUS_NO_OBJECT_DESC
72 ::std::map<unsigned, std::string>& ObjectDescRegistryStorage(
int id);
75 #if !OGLPLUS_NO_OBJECT_DESC
76 class ObjectDescRegistryBase
79 typedef ::std::map<unsigned, std::string> _desc_map;
81 static void _do_register_desc(
87 static void _do_unregister_desc(
92 static const std::string& _do_get_desc(
97 #endif // !OGLPLUS_NO_OBJECT_DESC
99 class ObjectDescRegistry
100 #if !OGLPLUS_NO_OBJECT_DESC
101 :
public ObjectDescRegistryBase
105 #if !OGLPLUS_NO_OBJECT_DESC
106 typedef ObjectDescRegistryBase _base;
107 typedef ::std::map<unsigned, std::string> _desc_map;
109 static _desc_map& _storage(
int id)
111 return ObjectDescRegistryStorage(
id);
116 static void _register_desc(
int id,
unsigned name, ObjectDesc&& desc)
117 #if OGLPLUS_NO_OBJECT_DESC
118 OGLPLUS_NOEXCEPT(
true) { (void)
id; (void)name; (void)desc; }
121 _base::_do_register_desc(
130 static void _unregister_desc(
int id,
unsigned name)
131 #if OGLPLUS_NO_OBJECT_DESC
132 OGLPLUS_NOEXCEPT(
true) { (void)
id; (void)name; }
135 _base::_do_unregister_desc(_storage(
id), name);
140 #if OGLPLUS_NO_OBJECT_DESC
141 static const std::string& _get_desc(
int,
unsigned)
142 OGLPLUS_NOEXCEPT(true)
144 return EmptyStdString();
147 static const std::string& _get_desc(
int id,
unsigned name)
149 return _base::_do_get_desc(_storage(
id), name);
156 template <
typename ObjTag>
157 inline const std::string& DescriptionOf(ObjectName<ObjTag>
object)
159 return aux::ObjectDescRegistry::_get_desc(
167 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
168 #include <oglplus/object/desc.ipp>
169 #endif // OGLPLUS_LINK_LIBRARY
171 #endif // include guard
ObjTag::NameType GetName(ObjectName< ObjTag >)
Returns the base name assigned to named object.
Definition: name_tpl.hpp:128
Base template for all "named" objects.