40 #define CHERT_VERSION 200912150    45 #define MAGIC_STRING "IAmChert"    47 #define MAGIC_LEN CONST_STRLEN(MAGIC_STRING)    49 #define VERSIONFILE_SIZE (MAGIC_LEN + 4 + 16)    54 #define VERSIONFILE_SIZE_LITERAL 28    60     unsigned char *v = 
reinterpret_cast<unsigned char *
>(buf) + 
MAGIC_LEN;
    62     v[1] = 
static_cast<unsigned char>((
CHERT_VERSION >> 8) & 0xff);
    63     v[2] = 
static_cast<unsigned char>((
CHERT_VERSION >> 16) & 0xff);
    64     v[3] = 
static_cast<unsigned char>((
CHERT_VERSION >> 24) & 0xff);
    67     memcpy(buf + 
MAGIC_LEN + 4, uuid.data(), 16);
    72         string msg(
"Failed to create chert version file: ");
    86         string msg(
"Failed to create chert version file: ");
    98         string msg = filename;
    99         msg += 
": Failed to open chert version file for reading";
   100         if (errno == ENOENT || errno == ENOTDIR) {
   119                       "VERSIONFILE_SIZE_LITERAL needs updating");
   120         string msg = filename;
   121         msg += 
": Chert version file should be "   128         string msg = filename;
   129         msg += 
": Chert version file doesn't contain the right magic string";
   133     const unsigned char *v;
   134     v = 
reinterpret_cast<const unsigned char *
>(buf) + 
MAGIC_LEN;
   135     unsigned int version = v[0] | (v[1] << 8) | (v[2] << 16) | (v[3] << 24);
   137         string msg = filename;
   138         msg += 
": Chert version file is version ";
 
void io_write(int fd, const char *p, size_t n)
Write n bytes from block pointed to by p to file descriptor fd. 
 
void read_and_check()
Read the version file and check it's a version we understand. 
 
#define VERSIONFILE_SIZE_LITERAL
 
DatabaseOpeningError indicates failure to open a database. 
 
bool io_sync(int fd)
Ensure all data previously written to file descriptor fd has been written to disk. 
 
WritableDatabase open()
Construct a WritableDatabase object for a new, empty InMemory database. 
 
#define STRINGIZE(X)
The STRINGIZE macro converts its parameter into a string constant. 
 
Convert types to std::string. 
 
Hierarchy of classes which Xapian can throw as exceptions. 
 
string str(int value)
Convert int to std::string. 
 
size_t io_read(int fd, char *p, size_t n, size_t min)
Read n bytes (or until EOF) into block pointed to by p from file descriptor fd. 
 
Indicates an attempt to access a database not present. 
 
DatabaseVersionError indicates that a database is in an unsupported format. 
 
DatabaseCorruptError indicates database corruption was detected. 
 
void create()
Create the version file. 
 
Wrappers for low-level POSIX I/O routines. 
 
Various handy helpers which std::string really should provide. 
 
Class for handling UUIDs.