* Added operators == and !=.
* Added "bool* _isSigned" parameter to IsInteger().
* Added static TypeIs{Number,Integer,Float}() operating on type codes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33308 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -64,13 +64,16 @@ public:
|
||||
|
||||
inline BVariant& operator=(const BVariant& other);
|
||||
|
||||
bool operator==(const BVariant& other) const;
|
||||
inline bool operator!=(const BVariant& other) const;
|
||||
|
||||
inline type_code Type() const { return fType; }
|
||||
size_t Size() const;
|
||||
const uint8* Bytes() const;
|
||||
|
||||
bool IsNumber() const;
|
||||
bool IsInteger() const;
|
||||
bool IsFloat() const;
|
||||
inline bool IsNumber() const;
|
||||
inline bool IsInteger(bool* _isSigned = NULL) const;
|
||||
inline bool IsFloat() const;
|
||||
// floating point, not just float
|
||||
|
||||
bool ToBool() const;
|
||||
@@ -93,6 +96,10 @@ public:
|
||||
// counting as scalar, not string, though)
|
||||
|
||||
static size_t SizeOfType(type_code type);
|
||||
static bool TypeIsNumber(type_code type);
|
||||
static bool TypeIsInteger(type_code type,
|
||||
bool* _isSigned = NULL);
|
||||
static bool TypeIsFloat(type_code type);
|
||||
|
||||
private:
|
||||
void _SetTo(const BVariant& other);
|
||||
@@ -245,6 +252,13 @@ BVariant::operator=(const BVariant& other)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BVariant::operator!=(const BVariant& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BVariant::SetTo(const BVariant& other)
|
||||
{
|
||||
@@ -365,4 +379,25 @@ BVariant::SetTo(BReferenceable* value, type_code type)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BVariant::IsNumber() const
|
||||
{
|
||||
return TypeIsNumber(fType);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BVariant::IsInteger(bool* _isSigned) const
|
||||
{
|
||||
return TypeIsInteger(fType, _isSigned);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BVariant::IsFloat() const
|
||||
{
|
||||
return TypeIsFloat(fType);
|
||||
}
|
||||
|
||||
|
||||
#endif // _VARIANT_H
|
||||
|
||||
Reference in New Issue
Block a user