Skip to content

Commit be5c51c

Browse files
committed
xrCore/_flags.h formatting
1 parent b83da98 commit be5c51c

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

src/xrCore/_flags.h

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,57 @@
66
template <class T>
77
struct _flags
88
{
9-
public:
10-
typedef T TYPE;
11-
typedef _flags<T> Self;
12-
typedef Self& SelfRef;
13-
typedef const Self& SelfCRef;
9+
using TYPE = T;
10+
using Self =_flags<T>;
11+
using SelfRef = Self&;
12+
using SelfCRef = const Self&;
1413

15-
public:
1614
T flags;
1715

1816
TYPE get() const throw() { return flags; }
17+
1918
SelfRef zero() throw()
2019
{
2120
flags = T(0);
2221
return *this;
2322
}
23+
2424
SelfRef one() throw()
2525
{
2626
flags = T(-1);
2727
return *this;
2828
}
29+
2930
SelfRef invert() throw()
3031
{
3132
flags = ~flags;
3233
return *this;
3334
}
35+
3436
SelfRef invert(const Self& f) throw()
3537
{
3638
flags = ~f.flags;
3739
return *this;
3840
}
41+
3942
SelfRef invert(const T mask) throw()
4043
{
4144
flags ^= mask;
4245
return *this;
4346
}
47+
4448
SelfRef assign(const Self& f) throw()
4549
{
4650
flags = f.flags;
4751
return *this;
4852
}
53+
4954
SelfRef assign(const T mask) throw()
5055
{
5156
flags = mask;
5257
return *this;
5358
}
59+
5460
SelfRef set(const T mask, bool value) throw()
5561
{
5662
if (value)
@@ -59,40 +65,46 @@ struct _flags
5965
flags &= ~mask;
6066
return *this;
6167
}
68+
6269
bool is(const T mask) const throw() { return mask == (flags & mask); }
6370
bool is_any(const T mask) const throw() { return !!(flags & mask); }
6471
bool test(const T mask) const throw() { return !!(flags & mask); }
72+
6573
SelfRef or (const T mask) throw()
6674
{
6775
flags |= mask;
6876
return *this;
6977
}
78+
7079
SelfRef or (const Self& f, const T mask) throw()
7180
{
7281
flags = f.flags | mask;
7382
return *this;
7483
}
84+
7585
SelfRef and (const T mask) throw()
7686
{
7787
flags &= mask;
7888
return *this;
7989
}
90+
8091
SelfRef and (const Self& f, const T mask) throw()
8192
{
8293
flags = f.flags & mask;
8394
return *this;
8495
}
96+
8597
bool equal(const Self& f) const throw() { return flags == f.flags; }
8698
bool equal(const Self& f, const T mask) const throw() { return (flags & mask) == (f.flags & mask); }
8799
};
88100

89-
typedef _flags<u8> Flags8;
90-
typedef _flags<u8> flags8;
91-
typedef _flags<u16> Flags16;
92-
typedef _flags<u16> flags16;
93-
typedef _flags<u32> Flags32;
94-
typedef _flags<u32> flags32;
95-
typedef _flags<u64> Flags64;
96-
typedef _flags<u64> flags64;
101+
using Flags8 = _flags<u8>;
102+
using flags8 = _flags<u8>;
103+
using Flags16 = _flags<u16>;
104+
using flags16 = _flags<u16>;
105+
using Flags32 = _flags<u32>;
106+
using flags32 = _flags<u32>;
107+
using Flags64 = _flags<u64>;
108+
using flags64 = _flags<u64>;
97109

98110
#endif //__FLAGS_H__

0 commit comments

Comments
 (0)