~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/dbinc/cxx_int.h

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*-
2
 
 * See the file LICENSE for redistribution information.
3
 
 *
4
 
 * Copyright (c) 1997-2002
5
 
 *      Sleepycat Software.  All rights reserved.
6
 
 *
7
 
 * $Id$
8
 
 */
9
 
 
10
 
#ifndef _CXX_INT_H_
11
 
#define _CXX_INT_H_
12
 
 
13
 
// private data structures known to the implementation only
14
 
 
15
 
//
16
 
// Using FooImp classes will allow the implementation to change in the
17
 
// future without any modification to user code or even to header files
18
 
// that the user includes. FooImp * is just like void * except that it
19
 
// provides a little extra protection, since you cannot randomly assign
20
 
// any old pointer to a FooImp* as you can with void *.  Currently, a
21
 
// pointer to such an opaque class is always just a pointer to the
22
 
// appropriate underlying implementation struct.  These are converted
23
 
// back and forth using the various overloaded wrap()/unwrap() methods.
24
 
// This is essentially a use of the "Bridge" Design Pattern.
25
 
//
26
 
// WRAPPED_CLASS implements the appropriate wrap() and unwrap() methods
27
 
// for a wrapper class that has an underlying pointer representation.
28
 
//
29
 
#define WRAPPED_CLASS(_WRAPPER_CLASS, _IMP_CLASS, _WRAPPED_TYPE)           \
30
 
                                                                           \
31
 
        class _IMP_CLASS {};                                               \
32
 
                                                                           \
33
 
        inline _WRAPPED_TYPE unwrap(_WRAPPER_CLASS *val)                   \
34
 
        {                                                                  \
35
 
                if (!val) return (0);                                      \
36
 
                return ((_WRAPPED_TYPE)((void *)(val->imp())));            \
37
 
        }                                                                  \
38
 
                                                                           \
39
 
        inline const _WRAPPED_TYPE unwrapConst(const _WRAPPER_CLASS *val)  \
40
 
        {                                                                  \
41
 
                if (!val) return (0);                                      \
42
 
                return ((const _WRAPPED_TYPE)((void *)(val->constimp()))); \
43
 
        }                                                                  \
44
 
                                                                           \
45
 
        inline _IMP_CLASS *wrap(_WRAPPED_TYPE val)                         \
46
 
        {                                                                  \
47
 
                return ((_IMP_CLASS*)((void *)val));                       \
48
 
        }
49
 
 
50
 
WRAPPED_CLASS(DbMpoolFile, DbMpoolFileImp, DB_MPOOLFILE*)
51
 
WRAPPED_CLASS(Db, DbImp, DB*)
52
 
WRAPPED_CLASS(DbEnv, DbEnvImp, DB_ENV*)
53
 
WRAPPED_CLASS(DbTxn, DbTxnImp, DB_TXN*)
54
 
 
55
 
// A tristate integer value used by the DB_ERROR macro below.
56
 
// We chose not to make this an enumerated type so it can
57
 
// be kept private, even though methods that return the
58
 
// tristate int can be declared in db_cxx.h .
59
 
//
60
 
#define ON_ERROR_THROW     1
61
 
#define ON_ERROR_RETURN    0
62
 
#define ON_ERROR_UNKNOWN   (-1)
63
 
 
64
 
// Macros that handle detected errors, in case we want to
65
 
// change the default behavior.  The 'policy' is one of
66
 
// the tristate values given above.  If UNKNOWN is specified,
67
 
// the behavior is taken from the last initialized DbEnv.
68
 
//
69
 
#define DB_ERROR(caller, ecode, policy) \
70
 
    DbEnv::runtime_error(caller, ecode, policy)
71
 
 
72
 
#define DB_ERROR_DBT(caller, dbt, policy) \
73
 
    DbEnv::runtime_error_dbt(caller, dbt, policy)
74
 
 
75
 
#define DB_OVERFLOWED_DBT(dbt) \
76
 
        (F_ISSET(dbt, DB_DBT_USERMEM) && dbt->size > dbt->ulen)
77
 
 
78
 
/* values for Db::flags_ */
79
 
#define DB_CXX_PRIVATE_ENV      0x00000001
80
 
 
81
 
#endif /* !_CXX_INT_H_ */