2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: SearchPath.h /main/4 1996/03/27 14:39:41 barstow $ */
24 /*******************************************************************
25 ** (c) Copyright Hewlett-Packard Company, 1990, 1991, 1992, 1993.
26 ** All rights are reserved. Copying or other reproduction of this
27 ** program except for archival purposes is prohibited without prior
28 ** written consent of Hewlett-Packard Company.
29 ********************************************************************
30 ****************************<+>*************************************/
32 #ifndef _SEARCHPATH_H_
33 #define _SEARCHPATH_H_
37 #if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
47 SearchPath (CDEEnvironment *, const char *, const char *);
48 virtual ~SearchPath();
50 virtual void ExportPath();
52 virtual void AddPredefinedPath();
54 #if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
55 virtual void PrettyPrint (std::ostream &) const;
57 friend std::ostream & operator<< (std::ostream &, const SearchPath &);
59 virtual void PrettyPrint (ostream &) const;
61 friend ostream & operator<< (ostream &, const SearchPath &);
64 const char * GetEnvVar() const { return environment_var; }
65 CString GetSearchPath() const { return final_search_path; }
68 void AssembleString (const CString &);
70 void AddToPath (const CString &);
73 virtual void MakePath (const CString &) {}
74 virtual CString ConstructPath (const CString &, const CString *,
75 unsigned char useTT = 1);
77 int ParseState() const { return parse_state; }
78 CString Separator() const { return separator; }
80 virtual int validSearchPath (const CString &) const;
81 virtual int useSystemPath();
83 void setSeparator (const char * sep) { separator = sep; }
86 CString norm_search_path;
87 CString final_search_path;
88 CDEEnvironment * user;
91 const char * environment_var;
98 class AppSearchPath : public SearchPath {
100 AppSearchPath (CDEEnvironment *,
101 const char * = "DTAPP",
103 virtual ~AppSearchPath() {}
108 virtual void MakePath (const CString &);
114 class IconSearchPath : public SearchPath {
116 IconSearchPath (CDEEnvironment *,
117 const char * = "XMICON",
118 const char * = ".pm",
119 const char * = ".bm",
121 virtual ~IconSearchPath() {}
124 virtual void MakePath (const CString &);
125 virtual int validSearchPath (const CString &) const;
133 class DatabaseSearchPath : public SearchPath {
135 DatabaseSearchPath (CDEEnvironment *,
136 const char * = "DTDATABASE",
138 virtual ~DatabaseSearchPath() {}
141 virtual void MakePath (const CString &);
142 virtual CString ConstructPath (const CString &, const CString *,
143 unsigned char useTT = 0);
149 class HelpSearchPath : public SearchPath {
151 HelpSearchPath (CDEEnvironment *,
152 const char * = "DTHELP",
154 virtual ~HelpSearchPath() {}
157 virtual void MakePath (const CString &);
158 virtual int validSearchPath (const CString &) const;
164 class InfoLibSearchPath : public SearchPath {
166 InfoLibSearchPath (CDEEnvironment *,
167 const char * = "DTINFOLIB",
169 virtual ~InfoLibSearchPath() {}
172 virtual void MakePath (const CString &);
173 virtual int validSearchPath (const CString &) const;
179 class ManSearchPath : public SearchPath {
181 ManSearchPath (CDEEnvironment *,
182 const char * = "MANPATH",
184 virtual ~ManSearchPath() {}
186 virtual void ExportPath ();
187 virtual void Print();
189 #if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
190 friend std::ostream & operator<< (std::ostream &, const ManSearchPath &);
192 friend ostream & operator<< (ostream &, const ManSearchPath &);
196 virtual void MakePath (const CString &);
197 #if defined(__FreeBSD__)
198 virtual int useSystemPath();