#ifndef _H_DEBUGGING
#define _H_DEBUGGING
#include <security_utilities/debugging_internal.h>
#ifdef __cplusplus
#include <security_utilities/utilities.h>
#include <cstdarg>
#include <typeinfo>
namespace Security {
namespace Debug {
bool dumping(const char *scope);
void dump(const char *format, ...) __attribute((format(printf,1,2)));
void dumpData(const void *data, size_t length);
void dumpData(const char *title, const void *data, size_t length);
template <class Data> inline void dumpData(const Data &obj)
{ dumpData(obj.data(), obj.length()); }
template <class Data> inline void dumpData(const char *title, const Data &obj)
{ dumpData(title, obj.data(), obj.length()); }
string makeTypeName(const type_info &info);
template <class Object>
string typeName(const Object &obj)
{
return makeTypeName(typeid(obj));
}
template <class Object>
string typeName()
{
return makeTypeName(typeid(Object));
}
#undef DEBUGGING
#if !defined(NDEBUG)
# define DEBUGGING 1
# define DEBUGDUMP 1
#else //NDEBUG
# define DEBUGGING 0
#endif //NDEBUG
#if defined(DEBUGDUMP)
# define IFDUMP(code) code
# define IFDUMPING(scope,code) if (Debug::dumping(scope)) code; else
#else
# define IFDUMP(code)
# define IFDUMPING(scope,code)
#endif
inline bool debugging(const char *scope) DEPRECATED_ATTRIBUTE;
inline void debug(const char *scope, const char *format, ...) DEPRECATED_ATTRIBUTE;
inline void vdebug(const char *scope, const char *format, va_list args) DEPRECATED_ATTRIBUTE;
inline bool debugging(const char *scope) { return false; }
inline void debug(const char *scope, const char *format, ...) { }
inline void vdebug(const char *scope, const char *format, va_list args) { }
} }
using Security::Debug::debug;
#else //__cplusplus
#include <stdio.h>
#endif //__cplusplus
#include <CoreFoundation/CFString.h>
#endif //_H_DEBUGGING