Graphite  Version 3
An experimental 3D geometry processing program
file_manager.h
Go to the documentation of this file.
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 
38 #ifndef H_OGF_BASIC_OS_FILE_MANAGER_H
39 #define H_OGF_BASIC_OS_FILE_MANAGER_H
40 
42 #include <string>
43 #include <vector>
44 
50 namespace OGF {
51 
52 //_________________________________________________________
53 
54 
63  class BASIC_API FileManager : public Environment {
64  public:
70  static void initialize() ;
71 
77  static void terminate() ;
78 
83  static FileManager* instance() ;
84 
96  bool find_file(
97  std::string& file_name,
98  bool verbose=true, const std::string& sub_path="lib/"
99  ) const ;
100 
114  std::string& file_name, bool verbose=true
115  ) const ;
116 
122  std::string dll_prefix() const ;
123 
130  std::string dll_extension() const ;
131 
140  std::string libraries_subdirectory() const;
141 
148  const std::vector<std::string>& ogf_path() const {
149  return ogf_path_;
150  }
151 
158  const std::string& project_root() const {
159  ogf_assert(ogf_path().size() >= 1);
160  return ogf_path_[0];
161  }
162 
168  const std::string& name, std::string& value
169  ) const override;
170 
177  const std::string& name, const std::string& value
178  ) override;
179 
180  protected:
181  FileManager() ;
182 
183 
184  private:
185  static FileManager* instance_;
186  std::vector<std::string> ogf_path_;
187  std::string libraries_subdirectory_;
188  } ;
189 
190 //_________________________________________________________
191 
192 }
193 #endif
194 
Application environment.
Definition: environment.h:211
FileManager retreives the files used by Graphite (icons, plugins).
Definition: file_manager.h:63
bool get_local_value(const std::string &name, std::string &value) const override
Retrieves a variable value locally.
static void terminate()
Terminates the FileManager.
bool find_binary_file(std::string &file_name, bool verbose=true) const
Finds a binary file, such as the DLL of a plugin.
bool find_file(std::string &file_name, bool verbose=true, const std::string &sub_path="lib/") const
Finds a file.
static FileManager * instance()
Gets a pointer to the instance of the FileManager.
bool set_local_value(const std::string &name, const std::string &value) override
Sets a variable value locally.
std::string libraries_subdirectory() const
Gets the relative subdirectory where dynamic libraries are stored.
static void initialize()
Initializes the FileManager.
const std::string & project_root() const
Gets Graphite project root.
Definition: file_manager.h:158
std::string dll_extension() const
Gets the extension of dynamically loadable libraries file names.
const std::vector< std::string > & ogf_path() const
Gets the OGF Path, i.e. the list of directories where files are searched.
Definition: file_manager.h:148
std::string dll_prefix() const
Gets the prefix of dynamically loadable libraries file names.
Global Graphite namespace.
Definition: common.h:76
Definitions common to all include files in the basic library.