Added convenience formatting function for image types.

This commit is contained in:
Rene Gollent 2012-11-22 10:56:26 -05:00
parent 37ddff87ec
commit 3d09339ddd
2 changed files with 29 additions and 2 deletions

View File

@ -109,3 +109,28 @@ UiUtils::FunctionNameForFrame(StackFrame* frame, char* buffer,
return buffer;
}
/*static*/ const char*
UiUtils::ImageTypeToString(image_type type, char* buffer, size_t bufferSize)
{
switch (type) {
case B_APP_IMAGE:
snprintf(buffer, bufferSize, "Application");
break;
case B_LIBRARY_IMAGE:
snprintf(buffer, bufferSize, "Library");
break;
case B_ADD_ON_IMAGE:
snprintf(buffer, bufferSize, "Add-on");
break;
case B_SYSTEM_IMAGE:
snprintf(buffer, bufferSize, "System");
break;
default:
snprintf(buffer, bufferSize, "Unknown");
break;
}
return buffer;
}

View File

@ -7,11 +7,11 @@
#include <size_t.h>
class StackFrame;
#include <image.h>
class BVariant;
class StackFrame;
class UiUtils {
@ -23,6 +23,8 @@ public:
char* buffer, size_t bufferSize);
static const char* FunctionNameForFrame(StackFrame* frame,
char* buffer, size_t bufferSize);
static const char* ImageTypeToString(image_type type,
char* buffer, size_t bufferSize);
};