summaryrefslogtreecommitdiff
path: root/support/highlight/src/core/datadir.h
blob: 1c180156e26a08a651a0988814c9edca2a473d4b (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/***************************************************************************
                          datadir.h  -  description
                             -------------------
    begin                : Sam March 1 2003
    copyright            : (C) 2003 by Andre Simon
    email                : andre.simon1@gmx.de
 ***************************************************************************/


/*
This file is part of Highlight.

Highlight 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 3 of the License, or
(at your option) any later version.

Highlight 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 Highlight.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef DATADIR_H
#define DATADIR_H

using namespace std;

/** \brief Manages access to installation directories.

    Apart from the standard installation directory, one can define additional
    search paths. If the additonal paths do not exist, the default paths are
    returned.
 **/

class DataDir
{
		string dataDir;
		string additionalDataDir;
		string additionalConfDir;
		bool fileExists ( const string& );

	public:

		DataDir();

		static string LSB_DATA_DIR;
		static string LSB_CFG_DIR;
		static string LSB_DOC_DIR;

		/** search for a valid installation directory
		    \param  userDefinedDir Directory defined by user
		    \return True if directory was found */
		bool searchDataDir ( const string &userDefinedDir );

		/** add another installation directory, which is added to search path
		    \param  dir Directory defined by user */
		void setAdditionalDataDir ( const string& dir );

		/** add another installation directory, which is added to search path
		    \param  dir Directory defined by user */
		void setAdditionalConfDir ( const string& dir );

		/** \return data Directory defined by user */
		const string & getAdditionalDataDir();

		/** \return data Directory defined by user */
		const string & getAdditionalConfDir();

		/** \return Data installation directory */
		const string & getDir() ;

		/**  \param file filename
		     \param forceDefault set tue if additional directory should be ignored
		     \return Location of languafe definitions */
		const string getLangPath ( const string & file="", bool forceDefault=false ) ;

		/** \param file filename
		    \param forceDefault set tue if additional directory should be ignored
		    \return Location of themes */
		const string getThemePath ( const string & file="", bool forceDefault=false ) ;

		/** \return User defined location of languafe definitions */
		const string getAdditionalLangDefDir() ;

		/** \return User defined location of themes */
		const string getAdditionalThemeDir() ;

		/** \param forceDefault set tue if additional directory should be ignored
		    \return Location of configuration files */
		const string getConfDir ( bool forceDefault=false ) ;

		/** \return Location of GUI menu translation files */
		const string getI18nDir();

		/** \return Location of GUI file extension filter files */
		const string getExtDir();

		/** \return Location of documentation (README) files (GUI) */
		const string getDocDir();

};

#endif