Rebuild autotool system
[construo.git] / path_manager.hxx
blob5f30f1005e3177832105e473a53ad1a4df0f35e9
1 // $Id: path_manager.hxx,v 1.1 2003/07/25 11:07:44 grumbel Exp $
2 //
3 // Pingus - A free Lemmings clone
4 // Copyright (C) 2000 Ingo Ruhnke <grumbel@gmx.de>
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef HEADER_PINGUS_PATH_MANAGER_HXX
21 #define HEADER_PINGUS_PATH_MANAGER_HXX
23 #include <string>
24 #include <list>
26 class PathManager
28 private:
29 std::list<std::string> path_list;
30 typedef std::list<std::string>::const_iterator PathIter;
32 bool path_found;
33 std::string base_path;
34 public:
35 PathManager ();
36 ~PathManager ();
38 /** Search for a path which contains all the files given in
39 file_list */
40 bool find_path (const std::list<std::string>& file_list);
42 /** Search for a path which contains the file 'file' */
43 bool find_path (const std::string& file);
45 /** Set the path directly without using find_path/add_path
46 Must include trailing slash */
47 void set_path (const std::string& path);
49 /** Add a path to the search list */
50 void add_path (const std::string& path);
52 std::string get_base_path () { return base_path; }
54 /** Complete a releative path to the absolute path, the returned
55 path contains a trailing slash */
56 std::string complete (const std::string& relative_path);
58 private:
59 PathManager (const PathManager&);
60 PathManager& operator= (const PathManager&);
63 extern PathManager path_manager;
65 #endif
67 /* EOF */