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
#include <time.h>
26
27
#ifndef EPT_DEBTAGS_PATH_H
28
#define EPT_DEBTAGS_PATH_H
29
30
namespace
ept
{
31
namespace
debtags {
32
36
class
Path
37
{
38
public
:
39
static
std::string
vocabulary
();
40
static
std::string
userVocabulary
();
41
static
std::string
tagdb
();
42
static
std::string
userTagdb
();
43
44
static
std::string
debtagsSourceDir
();
45
static
std::string
debtagsIndexDir
();
46
static
std::string
debtagsUserSourceDir
();
47
static
std::string
debtagsUserIndexDir
();
48
49
// Directory where Debtags source data is found
50
static
void
setDebtagsSourceDir
(
const
std::string &s );
51
52
// Directory where Debtags indexes are kept
53
static
void
setDebtagsIndexDir
(
const
std::string &s );
54
55
// User-specific directory for Debtags source data
56
static
void
setDebtagsUserSourceDir
(
const
std::string &s );
57
58
// User-specific directory for Debtags index data
59
static
void
setDebtagsUserIndexDir
(
const
std::string &s );
60
61
static
int
access
(
const
std::string &,
int
);
62
static
time_t
timestamp
(
const
std::string& );
63
64
// RAII-style classes to temporarily override directories
65
class
OverrideDebtagsSourceDir
66
{
67
std::string old;
68
public
:
69
OverrideDebtagsSourceDir
(
const
std::string& path) : old(
Path
::debtagsSourceDir())
70
{
71
Path::setDebtagsSourceDir
(path);
72
}
73
~OverrideDebtagsSourceDir
() {
Path::setDebtagsSourceDir
(old); }
74
};
75
class
OverrideDebtagsIndexDir
76
{
77
std::string old;
78
public
:
79
OverrideDebtagsIndexDir
(
const
std::string& path) : old(
Path
::debtagsIndexDir())
80
{
81
Path::setDebtagsIndexDir
(path);
82
}
83
~OverrideDebtagsIndexDir
() {
Path::setDebtagsIndexDir
(old); }
84
};
85
class
OverrideDebtagsUserSourceDir
86
{
87
std::string old;
88
public
:
89
OverrideDebtagsUserSourceDir
(
const
std::string& path) : old(
Path
::debtagsUserSourceDir())
90
{
91
Path::setDebtagsUserSourceDir
(path);
92
}
93
~OverrideDebtagsUserSourceDir
() {
Path::setDebtagsUserSourceDir
(old); }
94
};
95
class
OverrideDebtagsUserIndexDir
96
{
97
std::string old;
98
public
:
99
OverrideDebtagsUserIndexDir
(
const
std::string& path) : old(
Path
::debtagsUserIndexDir())
100
{
101
Path::setDebtagsUserIndexDir
(path);
102
}
103
~OverrideDebtagsUserIndexDir
() {
Path::setDebtagsUserIndexDir
(old); }
104
};
105
protected
:
106
static
Path
*
s_instance
;
107
static
Path
&
instance
();
108
109
// Directory where Debtags source data is found
110
std::string
m_debtagsSourceDir
;
111
112
// Directory where Debtags indexes are kept
113
std::string
m_debtagsIndexDir
;
114
115
// User-specific directory for Debtags source data
116
std::string
m_debtagsUserSourceDir
;
117
118
// User-specific directory for Debtags index data
119
std::string
m_debtagsUserIndexDir
;
120
};
121
122
}
123
}
124
125
// vim:set ts=4 sw=4:
126
#endif
ept::debtags::Path::m_debtagsUserSourceDir
std::string m_debtagsUserSourceDir
Definition:
debtags/maint/path.h:116
ept::debtags::Path::OverrideDebtagsIndexDir
Definition:
debtags/maint/path.h:75
ept::debtags::Path::OverrideDebtagsIndexDir::~OverrideDebtagsIndexDir
~OverrideDebtagsIndexDir()
Definition:
debtags/maint/path.h:83
ept::debtags::Path::setDebtagsUserIndexDir
static void setDebtagsUserIndexDir(const std::string &s)
Definition:
debtags/maint/path.cc:82
ept::debtags::Path::OverrideDebtagsUserIndexDir::OverrideDebtagsUserIndexDir
OverrideDebtagsUserIndexDir(const std::string &path)
Definition:
debtags/maint/path.h:99
ept::debtags::Path::OverrideDebtagsUserSourceDir::OverrideDebtagsUserSourceDir
OverrideDebtagsUserSourceDir(const std::string &path)
Definition:
debtags/maint/path.h:89
ept::debtags::Path::tagdb
static std::string tagdb()
Definition:
debtags/maint/path.cc:100
ept::debtags::Path::setDebtagsSourceDir
static void setDebtagsSourceDir(const std::string &s)
Definition:
debtags/maint/path.cc:70
ept::debtags::Path::OverrideDebtagsIndexDir::OverrideDebtagsIndexDir
OverrideDebtagsIndexDir(const std::string &path)
Definition:
debtags/maint/path.h:79
ept::debtags::Path::OverrideDebtagsSourceDir
Definition:
debtags/maint/path.h:65
ept
Definition:
apt.cc:42
ept::debtags::Path::OverrideDebtagsSourceDir::OverrideDebtagsSourceDir
OverrideDebtagsSourceDir(const std::string &path)
Definition:
debtags/maint/path.h:69
ept::debtags::Path::instance
static Path & instance()
Definition:
debtags/maint/path.cc:51
ept::debtags::Path::access
static int access(const std::string &, int)
Definition:
debtags/maint/path.cc:62
ept::debtags::Path::debtagsUserSourceDir
static std::string debtagsUserSourceDir()
Definition:
debtags/maint/path.cc:89
ept::debtags::Path::debtagsIndexDir
static std::string debtagsIndexDir()
Definition:
debtags/maint/path.cc:88
ept::debtags::Path::m_debtagsUserIndexDir
std::string m_debtagsUserIndexDir
Definition:
debtags/maint/path.h:119
ept::debtags::Path::OverrideDebtagsUserSourceDir
Definition:
debtags/maint/path.h:85
ept::debtags::Path::s_instance
static Path * s_instance
Definition:
debtags/maint/path.h:106
ept::debtags::Path::OverrideDebtagsSourceDir::~OverrideDebtagsSourceDir
~OverrideDebtagsSourceDir()
Definition:
debtags/maint/path.h:73
ept::debtags::Path::debtagsSourceDir
static std::string debtagsSourceDir()
Definition:
debtags/maint/path.cc:87
ept::debtags::Path::OverrideDebtagsUserIndexDir::~OverrideDebtagsUserIndexDir
~OverrideDebtagsUserIndexDir()
Definition:
debtags/maint/path.h:103
ept::debtags::Path::timestamp
static time_t timestamp(const std::string &)
Definition:
debtags/maint/path.cc:66
ept::debtags::Path::m_debtagsSourceDir
std::string m_debtagsSourceDir
Definition:
debtags/maint/path.h:110
ept::debtags::Path::OverrideDebtagsUserSourceDir::~OverrideDebtagsUserSourceDir
~OverrideDebtagsUserSourceDir()
Definition:
debtags/maint/path.h:93
ept::debtags::Path::debtagsUserIndexDir
static std::string debtagsUserIndexDir()
Definition:
debtags/maint/path.cc:90
ept::debtags::Path::OverrideDebtagsUserIndexDir
Definition:
debtags/maint/path.h:95
ept::debtags::Path::userVocabulary
static std::string userVocabulary()
Definition:
debtags/maint/path.cc:96
ept::debtags::Path::setDebtagsUserSourceDir
static void setDebtagsUserSourceDir(const std::string &s)
Definition:
debtags/maint/path.cc:78
ept::debtags::Path::setDebtagsIndexDir
static void setDebtagsIndexDir(const std::string &s)
Definition:
debtags/maint/path.cc:74
ept::debtags::Path::userTagdb
static std::string userTagdb()
Definition:
debtags/maint/path.cc:104
ept::debtags::Path
Singleton class to configure and access the various Debtags paths.
Definition:
debtags/maint/path.h:36
ept::debtags::Path::m_debtagsIndexDir
std::string m_debtagsIndexDir
Definition:
debtags/maint/path.h:113
ept::debtags::Path::vocabulary
static std::string vocabulary()
Definition:
debtags/maint/path.cc:92
Generated by
1.8.9.1