Skip to content

Commit 0e50c7f

Browse files
committed
mpp: remove compact namespace
Originally there were two families: compact and bitmask. In order not to be confused compact was placed in 'compact' namespace. Since family bitmask was removed in the previous commit, there's no more need in compact namespace.
1 parent bb0b9f8 commit 0e50c7f

File tree

7 files changed

+167
-173
lines changed

7 files changed

+167
-173
lines changed

src/mpp/Constants.hpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
namespace mpp {
3838

39-
namespace compact {
4039
enum Family : uint8_t {
4140
MP_NIL /* = 0x00 */,
4241
MP_IGNR /* = 0x01 */,
@@ -50,7 +49,6 @@ enum Family : uint8_t {
5049
MP_EXT /* = 0x09 */,
5150
MP_END
5251
};
53-
} // namespace compact {
5452

5553
inline const char *FamilyName[] = {
5654
"MP_NIL",
@@ -66,7 +64,7 @@ inline const char *FamilyName[] = {
6664
"MP_BAD",
6765
"MP_NONE"
6866
};
69-
static_assert(std::size(FamilyName) == compact::MP_END + 2, "Smth is forgotten");
67+
static_assert(std::size(FamilyName) == MP_END + 2, "Smth is forgotten");
7068

7169
inline const char *FamilyHumanName[] = {
7270
"nil",
@@ -82,32 +80,32 @@ inline const char *FamilyHumanName[] = {
8280
"bad",
8381
"none"
8482
};
85-
static_assert(std::size(FamilyHumanName) == compact::MP_END + 2, "Smth is forgotten");
83+
static_assert(std::size(FamilyHumanName) == MP_END + 2, "Smth is forgotten");
8684

8785
inline std::ostream&
88-
operator<<(std::ostream& strm, compact::Family t)
86+
operator<<(std::ostream& strm, Family t)
8987
{
90-
if (t >= compact::Family::MP_END)
91-
return strm << FamilyName[compact::Family::MP_END]
88+
if (t >= Family::MP_END)
89+
return strm << FamilyName[Family::MP_END]
9290
<< "(" << static_cast<uint64_t>(t) << ")";
9391
return strm << FamilyName[t];
9492
}
9593

96-
template <compact::Family ...FAMILY>
94+
template <Family ...FAMILY>
9795
struct family_sequence {
9896
static constexpr std::size_t size() noexcept
9997
{
10098
return sizeof ...(FAMILY);
10199
}
102100
};
103101

104-
template <compact::Family NEW_FAMILY, compact::Family... FAMILY>
102+
template <Family NEW_FAMILY, Family... FAMILY>
105103
static constexpr auto family_sequence_populate(struct family_sequence<FAMILY...>)
106104
{
107105
return family_sequence<NEW_FAMILY, FAMILY...>{};
108106
}
109107

110-
template <compact::Family ...FAMILY_A, compact::Family ...FAMILY_B>
108+
template <Family ...FAMILY_A, Family ...FAMILY_B>
111109
inline constexpr auto
112110
operator+(family_sequence<FAMILY_A...>, family_sequence<FAMILY_B...>)
113111
{
@@ -116,51 +114,51 @@ operator+(family_sequence<FAMILY_A...>, family_sequence<FAMILY_B...>)
116114

117115
namespace details {
118116

119-
template <compact::Family NEEDLE, compact::Family HEAD, compact::Family ...TAIL>
117+
template <Family NEEDLE, Family HEAD, Family ...TAIL>
120118
struct family_sequence_contains_impl_h {
121119
static constexpr bool value =
122120
family_sequence_contains_impl_h<NEEDLE, TAIL...>::value;
123121
};
124122

125-
template <compact::Family NEEDLE, compact::Family LAST>
123+
template <Family NEEDLE, Family LAST>
126124
struct family_sequence_contains_impl_h<NEEDLE, LAST> {
127125
static constexpr bool value = false;
128126
};
129127

130-
template <compact::Family NEEDLE, compact::Family ...TAIL>
128+
template <Family NEEDLE, Family ...TAIL>
131129
struct family_sequence_contains_impl_h<NEEDLE, NEEDLE, TAIL...> {
132130
static constexpr bool value = true;
133131
};
134132

135-
template <compact::Family NEEDLE>
133+
template <Family NEEDLE>
136134
struct family_sequence_contains_impl_h<NEEDLE, NEEDLE> {
137135
static constexpr bool value = true;
138136
};
139137

140-
template <compact::Family NEEDLE, compact::Family ...HAYSTACK>
138+
template <Family NEEDLE, Family ...HAYSTACK>
141139
struct family_sequence_contains_h {
142140
static constexpr bool value =
143141
family_sequence_contains_impl_h<NEEDLE, HAYSTACK...>::value;
144142
};
145143

146-
template <compact::Family NEEDLE>
144+
template <Family NEEDLE>
147145
struct family_sequence_contains_h<NEEDLE> {
148146
static constexpr bool value = false;
149147
};
150148

151149
} // namespace details
152150

153-
template <compact::Family NEEDLE, compact::Family ...HAYSTACK>
151+
template <Family NEEDLE, Family ...HAYSTACK>
154152
static constexpr bool family_sequence_contains(family_sequence<HAYSTACK...>) {
155153
return details::family_sequence_contains_h<NEEDLE, HAYSTACK...>::value;
156154
}
157155

158-
template <compact::Family ...FAMILY>
156+
template <Family ...FAMILY>
159157
std::ostream&
160158
operator<<(std::ostream& strm, family_sequence<FAMILY...>)
161159
{
162160
if (sizeof ...(FAMILY) == 0)
163-
return strm << FamilyName[compact::Family::MP_END + 1];
161+
return strm << FamilyName[Family::MP_END + 1];
164162
size_t count = 0;
165163
((strm << (count++ ? ", " : "") << FamilyName[FAMILY]), ...);
166164
return strm;

0 commit comments

Comments
 (0)