Debugger: Add some type utility functions.

Add helper function for converting a type code to a type name.
This commit is contained in:
Rene Gollent
2014-11-08 10:49:00 -05:00
parent 0b21bf1038
commit 6d9f98fd95
2 changed files with 34 additions and 1 deletions
@@ -1,6 +1,6 @@
/*
* Copyright 2012, Ingo Weinhold, [email protected].
* Copyright 2012-2013, Rene Gollent, [email protected].
* Copyright 2012-2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
@@ -453,3 +453,33 @@ UiUtils::ParseRangeExpression(const BString& rangeExpression, int32 lowerBound,
return B_OK;
}
/*static*/ const char*
UiUtils::TypeCodeToString(type_code type)
{
switch (type) {
case B_INT8_TYPE:
return "int8";
case B_UINT8_TYPE:
return "uint8";
case B_INT16_TYPE:
return "int16";
case B_UINT16_TYPE:
return "uint16";
case B_INT32_TYPE:
return "int32";
case B_UINT32_TYPE:
return "uint32";
case B_INT64_TYPE:
return "int64";
case B_UINT64_TYPE:
return "uint64";
case B_FLOAT_TYPE:
return "float";
case B_DOUBLE_TYPE:
return "double";
default:
return "unknown";
}
}
@@ -1,4 +1,5 @@
/*
* Copyright 2014, Rene Gollent, [email protected].
* Copyright 2012, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
@@ -57,6 +58,8 @@ public:
int32 lowerBound, int32 upperBound,
bool fixedRange,
RangeList& _output);
static const char* TypeCodeToString(type_code type);
};