Skip to content

Commit a7c2f3e

Browse files
committed
refactor(ThingType): convert ThingType to a namespace and remove the source file
1 parent 2d60d8e commit a7c2f3e

3 files changed

Lines changed: 3 additions & 63 deletions

File tree

Nostalgia/things/thing_type.cpp

Lines changed: 0 additions & 33 deletions
This file was deleted.

Nostalgia/things/thing_type.hpp

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,9 @@
33

44
#define TYPE_ID(CLASS) CLASS{#CLASS}
55

6-
struct ThingType
6+
namespace ThingType
77
{
8-
private:
9-
PID _type_id{};
10-
PID _base_type_id{};
11-
std::unordered_set<PID> _all_base_types{};
12-
13-
public:
14-
ThingType(FPID) noexcept;
15-
16-
using typeids_t = std::unordered_set<PID>;
17-
18-
ThingType() noexcept;
19-
20-
Farg<typeids_t> base_types() const noexcept;
21-
Farg<typeids_t> derived_types() const noexcept;
22-
PID base_type() const noexcept;
23-
PID type() const noexcept;
24-
PID operator()() const noexcept;
25-
bool is_derived_from(FPID inTypeID) const noexcept;
26-
std::string log() const noexcept;
27-
28-
bool operator<(Farg<ThingType> inOther) const noexcept
29-
{ return _type_id < inOther._type_id; }
30-
31-
bool operator==(Farg<ThingType> inOther) const noexcept
32-
{ return _type_id == inOther._type_id; }
33-
34-
inline static const PID Invalid{ID::Invalid, "Invalid"},
8+
inline const PID Invalid{ID::Invalid, "Invalid"},
359
TYPE_ID(Thing),
3610
TYPE_ID(Resource),
3711
TYPE_ID(Font),
@@ -61,7 +35,7 @@ struct ThingType
6135
TYPE_ID(Visual2D),
6236
TYPE_ID(Sprite2D),
6337
TYPE_ID(Text2D);
64-
};
38+
}
6539

6640
#undef TYPE_ID
6741
#endif // THING_TYPE_H

Sources.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ set(NOSTALGIA_SRC_FILES
8686
${NOSTALGIA_ROOT}/things/thinkers/2d/visual_2d.cpp
8787
${NOSTALGIA_ROOT}/things/thinkers/viewport.cpp
8888
${NOSTALGIA_ROOT}/things/thinkers/thinker.cpp
89-
${NOSTALGIA_ROOT}/things/thing_type.cpp
9089
${NOSTALGIA_ROOT}/things/thing_factory.cpp
9190
${NOSTALGIA_ROOT}/things/thing_data.cpp
9291
${NOSTALGIA_ROOT}/things/thing_variable.cpp

0 commit comments

Comments
 (0)