[Haiku-commits] r31119 - haiku/trunk/src/apps/debuganalyzer/util
bonefish at BerliOS
bonefish at mail.berlios.de
Fri Jun 19 19:27:01 CEST 2009
Author: bonefish
Date: 2009-06-19 19:26:59 +0200 (Fri, 19 Jun 2009)
New Revision: 31119
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31119&view=rev
Modified:
haiku/trunk/src/apps/debuganalyzer/util/Variant.cpp
haiku/trunk/src/apps/debuganalyzer/util/Variant.h
Log:
Added Is{Number,Integer,Float}() methods.
Modified: haiku/trunk/src/apps/debuganalyzer/util/Variant.cpp
===================================================================
--- haiku/trunk/src/apps/debuganalyzer/util/Variant.cpp 2009-06-19 15:28:00 UTC (rev 31118)
+++ haiku/trunk/src/apps/debuganalyzer/util/Variant.cpp 2009-06-19 17:26:59 UTC (rev 31119)
@@ -64,6 +64,59 @@
}
+bool
+Variant::IsNumber() const
+{
+ switch (fType) {
+ case B_INT8_TYPE:
+ case B_UINT8_TYPE:
+ case B_INT16_TYPE:
+ case B_UINT16_TYPE:
+ case B_INT32_TYPE:
+ case B_UINT32_TYPE:
+ case B_INT64_TYPE:
+ case B_UINT64_TYPE:
+ case B_FLOAT_TYPE:
+ case B_DOUBLE_TYPE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
+bool
+Variant::IsInteger() const
+{
+ switch (fType) {
+ case B_INT8_TYPE:
+ case B_UINT8_TYPE:
+ case B_INT16_TYPE:
+ case B_UINT16_TYPE:
+ case B_INT32_TYPE:
+ case B_UINT32_TYPE:
+ case B_INT64_TYPE:
+ case B_UINT64_TYPE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
+bool
+Variant::IsFloat() const
+{
+ switch (fType) {
+ case B_FLOAT_TYPE:
+ case B_DOUBLE_TYPE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
int8
Variant::ToInt8() const
{
Modified: haiku/trunk/src/apps/debuganalyzer/util/Variant.h
===================================================================
--- haiku/trunk/src/apps/debuganalyzer/util/Variant.h 2009-06-19 15:28:00 UTC (rev 31118)
+++ haiku/trunk/src/apps/debuganalyzer/util/Variant.h 2009-06-19 17:26:59 UTC (rev 31119)
@@ -55,6 +55,11 @@
type_code Type() const { return fType; }
+ bool IsNumber() const;
+ bool IsInteger() const;
+ bool IsFloat() const;
+ // floating point, not just float
+
int8 ToInt8() const;
uint8 ToUInt8() const;
int16 ToInt16() const;
More information about the Haiku-commits
mailing list