source: box/trunk/lib/common/Database.h @ 2679

Revision 2679, 869 bytes checked in by chris, 2 years ago (diff)

Add header with macros for QDBM error logging.

Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    Database.h
5//              Purpose: Database (QDBM) utility macros
6//              Created: 2010/03/10
7//
8// --------------------------------------------------------------------------
9
10#ifndef DATABASE__H
11#define DATABASE__H
12
13#include "Logging.h"
14
15#define BOX_DBM_MESSAGE(stuff) stuff << " (qdbm): " << dperrmsg(dpecode)
16
17#define BOX_LOG_DBM_ERROR(stuff) \
18        BOX_ERROR(BOX_DBM_MESSAGE(stuff))
19
20#define THROW_DBM_ERROR(message, filename, exception, subtype) \
21        BOX_LOG_DBM_ERROR(message << ": " << filename); \
22        THROW_EXCEPTION_MESSAGE(exception, subtype, \
23                BOX_DBM_MESSAGE(message << ": " << filename));
24
25#define ASSERT_DBM_OK(operation, message, filename, exception, subtype) \
26        if(!(operation)) \
27        { \
28                THROW_DBM_ERROR(message, filename, exception, subtype); \
29        }
30
31#endif // DATABASE__H
Note: See TracBrowser for help on using the repository browser.