Fawkes API  Fawkes Development Version
eclipse_path.h
1 
2 /***************************************************************************
3  * eclipse_path.h - Eclipse-CLP path externals
4  *
5  * Created: Thu Feb 27 15:21:35 2014
6  * Copyright 2014 Gesche Gierse
7  * 2014 Tim Niemueller
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _PLUGINS_ECLIPSE_CLP_EXTERNALS_ECLIPSE_PATH_H_
24 #define _PLUGINS_ECLIPSE_CLP_EXTERNALS_ECLIPSE_PATH_H_
25 
26 #include <boost/filesystem.hpp>
27 #include <boost/regex.hpp>
28 #include <string>
29 #include <vector>
30 
31 class EclipsePath
32 {
33 private:
34  EclipsePath();
35 
36 public:
37  static void create_initial_object();
38  static EclipsePath *instance();
39  void add_path(const std::string &path);
40  void add_path_check(const std::string &path);
41  std::string locate_file(const std::string &filename);
42  void add_regex(boost::regex re, const std::string &str);
43  void apply_regexes();
44  void print_all_paths();
45 
46 private:
47  static EclipsePath *m_instance;
48 
49 public: /* members */
50  std::vector<std::string> paths; //!< all paths known
51  std::map<boost::regex, std::string>
52  regexes; /**< regexes and strings they should be replaced with */
53 };
54 
55 extern "C" int p_locate_file(...);
56 
57 #endif
EclipsePath::instance
static EclipsePath * instance()
Get the EclipsePath instance.
Definition: eclipse_path.cpp:68
EclipsePath::add_path_check
void add_path_check(const std::string &path)
Add a new path and apply regexes to all paths.
Definition: eclipse_path.cpp:87
EclipsePath::apply_regexes
void apply_regexes()
Apply the regexes to all paths.
Definition: eclipse_path.cpp:127
EclipsePath::locate_file
std::string locate_file(const std::string &filename)
Locate a file by filename.
Definition: eclipse_path.cpp:98
EclipsePath::regexes
std::map< boost::regex, std::string > regexes
regexes and strings they should be replaced with
Definition: eclipse_path.h:56
EclipsePath::print_all_paths
void print_all_paths()
Debug method to print all path to the command line.
Definition: eclipse_path.cpp:145
EclipsePath::add_path
void add_path(const std::string &path)
Add a new path.
Definition: eclipse_path.cpp:78
EclipsePath::paths
std::vector< std::string > paths
all paths known
Definition: eclipse_path.h:54
EclipsePath::add_regex
void add_regex(boost::regex re, const std::string &str)
Add a regex.
Definition: eclipse_path.cpp:158
EclipsePath::create_initial_object
static void create_initial_object()
Create the initial EclipsePath object.
Definition: eclipse_path.cpp:53
EclipsePath
Definition: eclipse_path.h:30