diff options
| author | Mathias Agopian <mathias@google.com> | 2009-06-04 23:29:29 -0700 |
|---|---|---|
| committer | Mathias Agopian <mathias@google.com> | 2009-06-04 23:29:29 -0700 |
| commit | eb22c5b358af775a5f1192fc248594c7a0025d56 (patch) | |
| tree | 970cc409d50ba943b6d8fd14fc4198173bbdc94d /include/utils/Debug.h | |
| parent | 2d5ee25556cb363700dc5127f88ca05fb9493e14 (diff) | |
| download | frameworks_base-eb22c5b358af775a5f1192fc248594c7a0025d56.zip frameworks_base-eb22c5b358af775a5f1192fc248594c7a0025d56.tar.gz frameworks_base-eb22c5b358af775a5f1192fc248594c7a0025d56.tar.bz2 | |
cleanup Debug.h a bit
Diffstat (limited to 'include/utils/Debug.h')
| -rw-r--r-- | include/utils/Debug.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/include/utils/Debug.h b/include/utils/Debug.h index a662b9c..21d04bd 100644 --- a/include/utils/Debug.h +++ b/include/utils/Debug.h @@ -14,10 +14,6 @@ * limitations under the License. */ -// -// Debugging tools. These should be able to be stripped -// in release builds. -// #ifndef ANDROID_DEBUG_H #define ANDROID_DEBUG_H @@ -25,9 +21,30 @@ #include <sys/types.h> namespace android { +// --------------------------------------------------------------------------- +#ifdef __cplusplus template<bool> struct CompileTimeAssert; template<> struct CompileTimeAssert<true> {}; +#define COMPILE_TIME_ASSERT(_exp) \ + template class CompileTimeAssert< (_exp) >; +#endif + +// --------------------------------------------------------------------------- + +#ifdef __cplusplus +template<bool C, typename LSH, typename RHS> struct CompileTimeIfElse; +template<typename LHS, typename RHS> +struct CompileTimeIfElse<true, LHS, RHS> { typedef LHS TYPE; }; +template<typename LHS, typename RHS> +struct CompileTimeIfElse<false, LHS, RHS> { typedef RHS TYPE; }; +#endif + +// --------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif const char* stringForIndent(int32_t indentLevel); @@ -35,11 +52,17 @@ typedef void (*debugPrintFunc)(void* cookie, const char* txt); void printTypeCode(uint32_t typeCode, debugPrintFunc func = 0, void* cookie = 0); + void printHexData(int32_t indent, const void *buf, size_t length, size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16, size_t alignment=0, bool cArrayStyle=false, debugPrintFunc func = 0, void* cookie = 0); +#ifdef __cplusplus +} +#endif + +// --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_DEBUG_H |
