* 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:
Ingo Weinhold
2009-09-27 04:08:45 +00:00
parent 5daa1139f6
commit 7dde9c1dab
2 changed files with 145 additions and 57 deletions
+38 -3
View File
@@ -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