32 #include <sys/types.h>    36 #ifdef USE_PROC_FOR_UUID    38 #elif defined HAVE_UUID_UUID_H    40 # include <uuid/uuid.h>    41 #elif defined HAVE_UUID_H    43 # include <arpa/inet.h>     46 #elif defined USE_WIN32_UUID_API    53 #  include <arpa/inet.h>     65 #ifdef USE_PROC_FOR_UUID    66     char buf[STRING_SIZE];
    67     int fd = 
open(
"/proc/sys/kernel/random/uuid", O_RDONLY);
    71     bool failed = (read(fd, buf, STRING_SIZE) != STRING_SIZE);
    77 #elif defined HAVE_UUID_UUID_H    80     memcpy(uuid_data, &uu, BINARY_SIZE);
    81 #elif defined HAVE_UUID_H    84     uuid_create(&uu, &status);
    85     if (status != uuid_s_ok) {
    87         throw std::bad_alloc();
    89     uu.time_low = htonl(uu.time_low);
    90     uu.time_mid = htons(uu.time_mid);
    91     uu.time_hi_and_version = htons(uu.time_hi_and_version);
    92     memcpy(uuid_data, &uu, BINARY_SIZE);
    93 #elif defined USE_WIN32_UUID_API    95     if (
rare(UuidCreate(&uuid) != RPC_S_OK)) {
   101     uuid.Data1 = htonl(uuid.Data1);
   102     uuid.Data2 = htons(uuid.Data2);
   103     uuid.Data3 = htons(uuid.Data3);
   104     memcpy(uuid_data, &uuid, BINARY_SIZE);
   106 # error Do not know how to generate UUIDs   113     for (
unsigned i = 0; i != BINARY_SIZE; ++i) {
   123     result.reserve(STRING_SIZE);
   124     for (
unsigned i = 0; i != BINARY_SIZE; ++i) {
   125         unsigned char ch = uuid_data[i];
   126         result += 
"0123456789abcdef"[ch >> 4];
   127         result += 
"0123456789abcdef"[ch & 0x0f];
 
WritableDatabase open()
Construct a WritableDatabase object for a new, empty InMemory database. 
 
static constexpr unsigned UUID_GAP_MASK
Bit-mask to determine where to put hyphens in the string representation. 
 
include <sys/stat.h> with portability enhancements 
 
Hierarchy of classes which Xapian can throw as exceptions. 
 
DatabaseCreateError indicates a failure to create a database. 
 
include <winsock2.h> but working around problems. 
 
std::string to_string() const
 
void parse(const char *in)
 
include <windows.h> without all the bloat and damage. 
 
char hex_decode(char ch1, char ch2)
Decode a pair of ASCII hex digits. 
 
Various handy helpers which std::string really should provide. 
 
Class for handling UUIDs. 
 
<unistd.h>, but with compat. 
 
include <fcntl.h>, but working around broken platforms.