mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Make As*() functions const-correct.
This commit is contained in:
committed by
Baldur Karlsson
parent
e8c5cc7628
commit
ac3efb681e
@@ -399,34 +399,34 @@ struct SDObject
|
||||
#if !defined(SWIG)
|
||||
// templated enum cast
|
||||
template <typename EnumType>
|
||||
EnumType AsEnum()
|
||||
EnumType AsEnum() const
|
||||
{
|
||||
return (EnumType)data.basic.u;
|
||||
}
|
||||
inline double AsDouble() { return data.basic.d; }
|
||||
inline float AsFloat() { return (float)data.basic.d; }
|
||||
inline float AsChar() { return (float)data.basic.c; }
|
||||
inline std::string AsString() { return data.str; }
|
||||
inline uint64_t AsUInt64() { return (uint64_t)data.basic.u; }
|
||||
inline int64_t AsInt64() { return (int64_t)data.basic.i; }
|
||||
inline uint32_t AsUInt32() { return (uint32_t)data.basic.u; }
|
||||
inline int32_t AsInt32() { return (int32_t)data.basic.i; }
|
||||
inline uint16_t AsUInt16() { return (uint16_t)data.basic.u; }
|
||||
inline int16_t AsInt16() { return (int16_t)data.basic.i; }
|
||||
inline uint8_t AsUInt8() { return (uint8_t)data.basic.u; }
|
||||
inline int8_t AsInt8() { return (int8_t)data.basic.i; }
|
||||
inline double AsDouble() const { return data.basic.d; }
|
||||
inline float AsFloat() const { return (float)data.basic.d; }
|
||||
inline float AsChar() const { return (float)data.basic.c; }
|
||||
inline std::string AsString() const { return data.str; }
|
||||
inline uint64_t AsUInt64() const { return (uint64_t)data.basic.u; }
|
||||
inline int64_t AsInt64() const { return (int64_t)data.basic.i; }
|
||||
inline uint32_t AsUInt32() const { return (uint32_t)data.basic.u; }
|
||||
inline int32_t AsInt32() const { return (int32_t)data.basic.i; }
|
||||
inline uint16_t AsUInt16() const { return (uint16_t)data.basic.u; }
|
||||
inline int16_t AsInt16() const { return (int16_t)data.basic.i; }
|
||||
inline uint8_t AsUInt8() const { return (uint8_t)data.basic.u; }
|
||||
inline int8_t AsInt8() const { return (int8_t)data.basic.i; }
|
||||
#endif
|
||||
|
||||
// these are common to both python and C++
|
||||
DOCUMENT(R"(Interprets the object as a ``bool`` and returns its value.
|
||||
Invalid if the object is not actually a ``bool``.
|
||||
)");
|
||||
inline bool AsBool() { return data.basic.b; }
|
||||
inline bool AsBool() const { return data.basic.b; }
|
||||
// these are common to both python and C++
|
||||
DOCUMENT(R"(Interprets the object as a :class:`ResourceId` and returns its value.
|
||||
Invalid if the object is not actually a :class:`ResourceId`.
|
||||
)");
|
||||
inline ResourceId AsResourceId() { return data.basic.id; }
|
||||
inline ResourceId AsResourceId() const { return data.basic.id; }
|
||||
#if defined(RENDERDOC_QT_COMPAT)
|
||||
operator QVariant() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user