File: MetaDataBackup.h

package info (click to toggle)
pinot 0.95-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 6,860 kB
  • ctags: 4,511
  • sloc: cpp: 39,387; sh: 9,973; ansic: 4,174; makefile: 657; xml: 372; python: 260
file content (79 lines) | stat: -rw-r--r-- 2,424 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 *  Copyright 2005-2009 Fabrice Colin
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef _META_DATA_BACKUP_H
#define _META_DATA_BACKUP_H

#include <time.h>
#include <string>
#include <set>

#include "DocumentInfo.h"
#include "SQLiteBase.h"

/// Handles the MetaDataBackup table.
class MetaDataBackup : public SQLiteBase
{
	public:
		MetaDataBackup(const std::string &database);
		virtual ~MetaDataBackup();

		/// Creates the MetaDataBackup table in the database.
		static bool create(const std::string &database);

		/// Adds an item.
		bool addItem(const DocumentInfo &docInfo, DocumentInfo::SerialExtent extent);

		/// Gets an item.
		bool getItem(DocumentInfo &docInfo, DocumentInfo::SerialExtent extent);

		/// Gets items.
		bool getItems(const std::string &likeUrl,
			std::set<std::string> &urls,
			unsigned long min, unsigned long max);

		/// Deletes an item.
		bool deleteItem(const DocumentInfo &docInfo, DocumentInfo::SerialExtent extent,
			const std::string &value = "");

		/// Deletes a label.
		bool deleteLabel(const std::string &value);

        protected:
		bool setAttribute(const DocumentInfo &docInfo,
			const std::string &name, const std::string &value,
			bool noXAttr = false);

		bool getAttribute(const DocumentInfo &docInfo,
			const std::string &name, std::string &value,
			bool noXAttr = false);

		bool getAttributes(const DocumentInfo &docInfo,
			const std::string &name, std::set<std::string> &values);

		bool removeAttribute(const DocumentInfo &docInfo,
			const std::string &name,
			bool noXAttr = false, bool likeName = false);

        private:
		MetaDataBackup(const MetaDataBackup &other);
		MetaDataBackup &operator=(const MetaDataBackup &other);

};

#endif // _META_DATA_BACKUP_H