Rename IsNXTBitMask and NxtReference/Release to dawn

This commit is contained in:
Corentin Wallez 2018-07-18 15:26:19 +02:00 committed by Corentin Wallez
parent a5ee52d33e
commit 923574eed5
5 changed files with 16 additions and 16 deletions

View File

@ -112,12 +112,12 @@ namespace dawn {
{% endif %} {% endif %}
} }
{% endfor %} {% endfor %}
void {{CppType}}::NxtReference({{CType}} handle) { void {{CppType}}::DawnReference({{CType}} handle) {
if (handle != nullptr) { if (handle != nullptr) {
{{as_cMethod(type.name, Name("reference"))}}(handle); {{as_cMethod(type.name, Name("reference"))}}(handle);
} }
} }
void {{CppType}}::NxtRelease({{CType}} handle) { void {{CppType}}::DawnRelease({{CType}} handle) {
if (handle != nullptr) { if (handle != nullptr) {
{{as_cMethod(type.name, Name("release"))}}(handle); {{as_cMethod(type.name, Name("release"))}}(handle);
} }

View File

@ -41,7 +41,7 @@ namespace dawn {
{% for type in by_category["bitmask"] %} {% for type in by_category["bitmask"] %}
template<> template<>
struct IsNXTBitmask<{{as_cppType(type.name)}}> { struct IsDawnBitmask<{{as_cppType(type.name)}}> {
static constexpr bool enable = true; static constexpr bool enable = true;
}; };
@ -72,10 +72,10 @@ namespace dawn {
public: public:
ObjectBase() = default; ObjectBase() = default;
ObjectBase(CType handle): mHandle(handle) { ObjectBase(CType handle): mHandle(handle) {
if (mHandle) Derived::NxtReference(mHandle); if (mHandle) Derived::DawnReference(mHandle);
} }
~ObjectBase() { ~ObjectBase() {
if (mHandle) Derived::NxtRelease(mHandle); if (mHandle) Derived::DawnRelease(mHandle);
} }
ObjectBase(ObjectBase const& other) = delete; ObjectBase(ObjectBase const& other) = delete;
@ -88,7 +88,7 @@ namespace dawn {
Derived& operator=(ObjectBase&& other) { Derived& operator=(ObjectBase&& other) {
if (&other == this) return static_cast<Derived&>(*this); if (&other == this) return static_cast<Derived&>(*this);
if (mHandle) Derived::NxtRelease(mHandle); if (mHandle) Derived::DawnRelease(mHandle);
mHandle = other.mHandle; mHandle = other.mHandle;
other.mHandle = 0; other.mHandle = 0;
@ -152,8 +152,8 @@ namespace dawn {
private: private:
friend ObjectBase<{{CppType}}, {{CType}}>; friend ObjectBase<{{CppType}}, {{CType}}>;
static void NxtReference({{CType}} handle); static void DawnReference({{CType}} handle);
static void NxtRelease({{CType}} handle); static void DawnRelease({{CType}} handle);
}; };
{% endfor %} {% endfor %}

View File

@ -39,7 +39,7 @@ namespace dawn {
#endif #endif
template <typename T> template <typename T>
struct IsNXTBitmask { struct IsDawnBitmask {
static constexpr bool enable = false; static constexpr bool enable = false;
}; };
@ -49,7 +49,7 @@ namespace dawn {
}; };
template <typename T> template <typename T>
struct LowerBitmask<T, typename std::enable_if<IsNXTBitmask<T>::enable>::type> { struct LowerBitmask<T, typename std::enable_if<IsDawnBitmask<T>::enable>::type> {
static constexpr bool enable = true; static constexpr bool enable = true;
using type = T; using type = T;
constexpr static T Lower(T t) { constexpr static T Lower(T t) {
@ -130,7 +130,7 @@ namespace dawn {
template <typename T, template <typename T,
typename T2, typename T2,
typename = typename std::enable_if<IsNXTBitmask<T>::enable && typename = typename std::enable_if<IsDawnBitmask<T>::enable &&
LowerBitmask<T2>::enable>::type> LowerBitmask<T2>::enable>::type>
constexpr T& operator&=(T& l, T2 right) { constexpr T& operator&=(T& l, T2 right) {
T r = LowerBitmask<T2>::Lower(right); T r = LowerBitmask<T2>::Lower(right);
@ -140,7 +140,7 @@ namespace dawn {
template <typename T, template <typename T,
typename T2, typename T2,
typename = typename std::enable_if<IsNXTBitmask<T>::enable && typename = typename std::enable_if<IsDawnBitmask<T>::enable &&
LowerBitmask<T2>::enable>::type> LowerBitmask<T2>::enable>::type>
constexpr T& operator|=(T& l, T2 right) { constexpr T& operator|=(T& l, T2 right) {
T r = LowerBitmask<T2>::Lower(right); T r = LowerBitmask<T2>::Lower(right);
@ -150,7 +150,7 @@ namespace dawn {
template <typename T, template <typename T,
typename T2, typename T2,
typename = typename std::enable_if<IsNXTBitmask<T>::enable && typename = typename std::enable_if<IsDawnBitmask<T>::enable &&
LowerBitmask<T2>::enable>::type> LowerBitmask<T2>::enable>::type>
constexpr T& operator^=(T& l, T2 right) { constexpr T& operator^=(T& l, T2 right) {
T r = LowerBitmask<T2>::Lower(right); T r = LowerBitmask<T2>::Lower(right);

View File

@ -26,7 +26,7 @@ namespace dawn {
}; };
template<> template<>
struct IsNXTBitmask<Color> { struct IsDawnBitmask<Color> {
static constexpr bool enable = true; static constexpr bool enable = true;
}; };

View File

@ -21,11 +21,11 @@ class Object : public dawn::ObjectBase<Object, int*> {
using ObjectBase::ObjectBase; using ObjectBase::ObjectBase;
using ObjectBase::operator=; using ObjectBase::operator=;
static void NxtReference(int* handle) { static void DawnReference(int* handle) {
ASSERT_LT(0, *handle); ASSERT_LT(0, *handle);
*handle += 1; *handle += 1;
} }
static void NxtRelease(int* handle) { static void DawnRelease(int* handle) {
ASSERT_LT(0, *handle); ASSERT_LT(0, *handle);
*handle -= 1; *handle -= 1;
} }