libept
Main Page
Namespaces
Classes
Files
File List
File Members
ept
debtags
maint
debtags/maint/path.h
Go to the documentation of this file.
1
// -*- mode: c++; indent-tabs-mode: t -*-
6
/*
7
* Copyright (C) 2005,2006,2007 Enrico Zini <enrico@debian.org>
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
*/
23
24
#include <string>
25
26
struct
stat;
27
28
#ifndef EPT_DEBTAGS_PATH_H
29
#define EPT_DEBTAGS_PATH_H
30
31
namespace
ept {
32
namespace
debtags {
33
37
class
Path
38
{
39
public
:
40
static
std::string
vocabulary
();
41
static
std::string
userVocabulary
();
42
static
std::string
tagdb
();
43
static
std::string
userTagdb
();
44
45
static
std::string
debtagsSourceDir
();
46
static
std::string
debtagsIndexDir
();
47
static
std::string
debtagsUserSourceDir
();
48
static
std::string
debtagsUserIndexDir
();
49
50
// Directory where Debtags source data is found
51
static
void
setDebtagsSourceDir
(
const
std::string &s );
52
53
// Directory where Debtags indexes are kept
54
static
void
setDebtagsIndexDir
(
const
std::string &s );
55
56
// User-specific directory for Debtags source data
57
static
void
setDebtagsUserSourceDir
(
const
std::string &s );
58
59
// User-specific directory for Debtags index data
60
static
void
setDebtagsUserIndexDir
(
const
std::string &s );
61
62
static
int
access
(
const
std::string &,
int
);
63
static
time_t
timestamp
(
const
std::string& );
64
65
// RAII-style classes to temporarily override directories
66
class
OverrideDebtagsSourceDir
67
{
68
std::string old;
69
public
:
70
OverrideDebtagsSourceDir
(
const
std::string& path) : old(
Path
::debtagsSourceDir())
71
{
72
Path::setDebtagsSourceDir
(path);
73
}
74
~OverrideDebtagsSourceDir
() {
Path::setDebtagsSourceDir
(old); }
75
};
76
class
OverrideDebtagsIndexDir
77
{
78
std::string old;
79
public
:
80
OverrideDebtagsIndexDir
(
const
std::string& path) : old(
Path
::debtagsIndexDir())
81
{
82
Path::setDebtagsIndexDir
(path);
83
}
84
~OverrideDebtagsIndexDir
() {
Path::setDebtagsIndexDir
(old); }
85
};
86
class
OverrideDebtagsUserSourceDir
87
{
88
std::string old;
89
public
:
90
OverrideDebtagsUserSourceDir
(
const
std::string& path) : old(
Path
::debtagsUserSourceDir())
91
{
92
Path::setDebtagsUserSourceDir
(path);
93
}
94
~OverrideDebtagsUserSourceDir
() {
Path::setDebtagsUserSourceDir
(old); }
95
};
96
class
OverrideDebtagsUserIndexDir
97
{
98
std::string old;
99
public
:
100
OverrideDebtagsUserIndexDir
(
const
std::string& path) : old(
Path
::debtagsUserIndexDir())
101
{
102
Path::setDebtagsUserIndexDir
(path);
103
}
104
~OverrideDebtagsUserIndexDir
() {
Path::setDebtagsUserIndexDir
(old); }
105
};
106
protected
:
107
static
Path
*
s_instance
;
108
static
Path
&
instance
();
109
110
// Directory where Debtags source data is found
111
std::string
m_debtagsSourceDir
;
112
113
// Directory where Debtags indexes are kept
114
std::string
m_debtagsIndexDir
;
115
116
// User-specific directory for Debtags source data
117
std::string
m_debtagsUserSourceDir
;
118
119
// User-specific directory for Debtags index data
120
std::string
m_debtagsUserIndexDir
;
121
};
122
123
}
124
}
125
126
// vim:set ts=4 sw=4:
127
#endif
Generated on Sat Nov 2 2013 08:30:07 for libept by
1.8.1.2