xapian-core  1.4.26
chert_version.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2006,2007,2008,2009 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef OM_HGUARD_CHERT_VERSION_H
22 #define OM_HGUARD_CHERT_VERSION_H
23 
24 #include <cstring>
25 #include <string>
26 
27 #include "backends/uuids.h"
28 
34 class ChertVersion {
36  std::string filename;
37 
40 
41  public:
42  explicit ChertVersion(const std::string & dbdir) : filename(dbdir) {
43  filename += "/iamchert";
44  }
45 
47  void create();
48 
53  void read_and_check();
54 
56  const char * get_uuid() const {
57  return uuid.data();
58  }
59 
61  std::string get_uuid_string() const {
62  return uuid.to_string();
63  }
64 };
65 
66 #endif
void read_and_check()
Read the version file and check it&#39;s a version we understand.
std::string get_uuid_string() const
Return UUID in the standard 36 character string format.
Definition: chert_version.h:61
The ChertVersion class manages the "iamchert" file.
Definition: chert_version.h:34
ChertVersion(const std::string &dbdir)
Definition: chert_version.h:42
std::string filename
The filename of the version file.
Definition: chert_version.h:36
std::string to_string() const
Definition: uuids.cc:120
const char * get_uuid() const
Return pointer to 16 byte UUID.
Definition: chert_version.h:56
Uuid uuid
The UUID of this database.
Definition: chert_version.h:39
void create()
Create the version file.
Definition: uuids.h:28
Class for handling UUIDs.
const char * data() const
Definition: uuids.h:60