1 /** @file backendmanager_brass.cc
2 * @brief BackendManager subclass for brass databases.
3 */
4 /* Copyright (C) 2007,2008,2009 Olly Betts
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (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 #include <config.h>
22
23 #include "backendmanager_brass.h"
24
25 using namespace std;
26
27 std::string
get_dbtype() const28 BackendManagerBrass::get_dbtype() const
29 {
30 return "brass";
31 }
32
33 string
do_get_database_path(const vector<string> & files)34 BackendManagerBrass::do_get_database_path(const vector<string> & files)
35 {
36 return createdb_brass(files);
37 }
38
39 Xapian::WritableDatabase
get_writable_database(const string & name,const string & file)40 BackendManagerBrass::get_writable_database(const string & name,
41 const string & file)
42 {
43 last_wdb_name = name;
44 return getwritedb_brass(name, vector<string>(1, file));
45 }
46
47 string
get_writable_database_path(const string & name)48 BackendManagerBrass::get_writable_database_path(const string & name)
49 {
50 return getwritedb_brass_path(name);
51 }
52
53 Xapian::Database
get_writable_database_as_database()54 BackendManagerBrass::get_writable_database_as_database()
55 {
56 return Xapian::Brass::open(".brass/" + last_wdb_name);
57 }
58
59 Xapian::WritableDatabase
get_writable_database_again()60 BackendManagerBrass::get_writable_database_again()
61 {
62 return Xapian::Brass::open(".brass/" + last_wdb_name, Xapian::DB_OPEN);
63 }
64