| eRPC Generator (erpcgen) Rev. 1.8.1 NXP Semiconductors

- Main Page
- Classes
- Files

- File List

SearchPath.h
1 /*
2 * Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
3 * Copyright 2016 NXP
4 * All rights reserved.
5 *
6 *
7 * SPDX-License-Identifier: BSD-3-Clause
8 */
9 #if !defined(_searchpath_h_)
10 #define _searchpath_h_
11
12 #include <list>
13 #include <string>
14
16 // Classes
18
22 class PathSearcher
23 {
24 public:
26 enum _target_type
27 {
28 kFindFile,
29 kFindDirectory
30 };
32 typedef enum _target_type target_type_t;
35 protected:
37 static PathSearcher *s_searcher;
38
39 public:
41 static PathSearcher &getGlobalSearcher();
42
43 public:
45 PathSearcher() {}
46
48 void addSearchPath(const std::string &path);
49
51 void setTempPath(const std::string &path);
52
54 bool search(const std::string &base, target_type_t targetType, bool searchCwd, std::string &result);
55
56 protected:
57 typedef std::list<std::string> string_list_t;
58 string_list_t m_paths;
59 std::string m_tempPath;
60
62 bool isAbsolute(const std::string &path);
63
65 std::string joinPaths(const std::string &first, const std::string &second);
66 };
67
68 #endif // _searchpath_h_
PathSearcher::m_tempPath
std::string m_tempPath
Possibility to add temporary path.
Definition: SearchPath.h:59
PathSearcher::getGlobalSearcher
static PathSearcher & getGlobalSearcher()
Access global path searching object.
Definition: SearchPath.cpp:30
PathSearcher::addSearchPath
void addSearchPath(const std::string &path)
Add a new search path to the end of the list.
Definition: SearchPath.cpp:40
PathSearcher::search
bool search(const std::string &base, target_type_t targetType, bool searchCwd, std::string &result)
Attempts to locate a file by using the search paths.
Definition: SearchPath.cpp:66
PathSearcher::setTempPath
void setTempPath(const std::string &path)
Set temporary path.
Definition: SearchPath.cpp:45
PathSearcher::isAbsolute
bool isAbsolute(const std::string &path)
Returns whether path is absolute.
Definition: SearchPath.cpp:122
PathSearcher::string_list_t
std::list< std::string > string_list_t
Linked list of strings.
Definition: SearchPath.h:57
PathSearcher::joinPaths
std::string joinPaths(const std::string &first, const std::string &second)
Combines two paths into a single one.
Definition: SearchPath.cpp:131
PathSearcher::target_type_t
enum _target_type target_type_t
Definition: SearchPath.h:33
PathSearcher::m_paths
string_list_t m_paths
Ordered list of paths to search.
Definition: SearchPath.h:58
PathSearcher
Handles searching a list of paths for a file.
Definition: SearchPath.h:22
PathSearcher::PathSearcher
PathSearcher()
Constructor.
Definition: SearchPath.h:45
PathSearcher::s_searcher
static PathSearcher * s_searcher
Global search object singleton.
Definition: SearchPath.h:37