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
vocabularyIndex
();
42
static
std::string
userVocabulary
();
43
static
std::string
userVocabularyIndex
();
44
static
std::string
tagdb
();
45
static
std::string
tagdbIndex
();
46
static
std::string
userTagdb
();
47
static
std::string
userTagdbIndex
();
48
static
std::string
pkgidx
();
49
static
std::string
userPkgidx
();
50
51
static
std::string
debtagsSourceDir
();
52
static
std::string
debtagsIndexDir
();
53
static
std::string
debtagsUserSourceDir
();
54
static
std::string
debtagsUserIndexDir
();
55
56
// Directory where Debtags source data is found
57
static
void
setDebtagsSourceDir
(
const
std::string &s );
58
59
// Directory where Debtags indexes are kept
60
static
void
setDebtagsIndexDir
(
const
std::string &s );
61
62
// User-specific directory for Debtags source data
63
static
void
setDebtagsUserSourceDir
(
const
std::string &s );
64
65
// User-specific directory for Debtags index data
66
static
void
setDebtagsUserIndexDir
(
const
std::string &s );
67
68
static
int
access
(
const
std::string &,
int
);
69
static
time_t
timestamp
(
const
std::string& );
70
71
// RAII-style classes to temporarily override directories
72
class
OverrideDebtagsSourceDir
73
{
74
std::string old;
75
public
:
76
OverrideDebtagsSourceDir
(
const
std::string& path) : old(
Path
::debtagsSourceDir())
77
{
78
Path::setDebtagsSourceDir
(path);
79
}
80
~OverrideDebtagsSourceDir
() {
Path::setDebtagsSourceDir
(old); }
81
};
82
class
OverrideDebtagsIndexDir
83
{
84
std::string old;
85
public
:
86
OverrideDebtagsIndexDir
(
const
std::string& path) : old(
Path
::debtagsIndexDir())
87
{
88
Path::setDebtagsIndexDir
(path);
89
}
90
~OverrideDebtagsIndexDir
() {
Path::setDebtagsIndexDir
(old); }
91
};
92
class
OverrideDebtagsUserSourceDir
93
{
94
std::string old;
95
public
:
96
OverrideDebtagsUserSourceDir
(
const
std::string& path) : old(
Path
::debtagsUserSourceDir())
97
{
98
Path::setDebtagsUserSourceDir
(path);
99
}
100
~OverrideDebtagsUserSourceDir
() {
Path::setDebtagsUserSourceDir
(old); }
101
};
102
class
OverrideDebtagsUserIndexDir
103
{
104
std::string old;
105
public
:
106
OverrideDebtagsUserIndexDir
(
const
std::string& path) : old(
Path
::debtagsUserIndexDir())
107
{
108
Path::setDebtagsUserIndexDir
(path);
109
}
110
~OverrideDebtagsUserIndexDir
() {
Path::setDebtagsUserIndexDir
(old); }
111
};
112
protected
:
113
static
Path
*
s_instance
;
114
static
Path
&
instance
();
115
116
// Directory where Debtags source data is found
117
std::string
m_debtagsSourceDir
;
118
119
// Directory where Debtags indexes are kept
120
std::string
m_debtagsIndexDir
;
121
122
// User-specific directory for Debtags source data
123
std::string
m_debtagsUserSourceDir
;
124
125
// User-specific directory for Debtags index data
126
std::string
m_debtagsUserIndexDir
;
127
};
128
129
}
130
}
131
132
// vim:set ts=4 sw=4:
133
#endif
Generated on Tue Aug 6 2013 00:01:18 for libept by
1.8.1.2