AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
FilePathContainer.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGXIO_FILEPATHCONTAINER_H
18#define AGXIO_FILEPATHCONTAINER_H
19
20#ifdef _MSC_VER
21# pragma warning(push)
22# pragma warning(disable:4786) // Disable warnings about long names
23#endif
24
25#include <agxIO/FileSystem.h>
26#include <agx/agxCore_export.h>
27#include <agx/List.h>
28
29namespace agxIO
30{
33 {
34
35 public:
37
38 public:
43
48
51
55 void clear();
56
63 void setFilePathList(const agx::String& paths,
64 bool clearPrevious = true,
66
70 bool setFromEnvironmentVariable(const agx::String& env, bool clearPrevious = true );
71
75 void setFilePath(const agx::String& path);
76
81 void addFilePath(const agx::String& path);
82
87 void removeFilePath(const agx::String& path);
88
94 void pushbackPath(const agx::String& path);
95
100 void pushfrontPath(const agx::String& path);
101
106
110 const PathList& getFilePathList() const;
111
117 agx::String find(const agx::String& filename) const;
118
119 private:
120
122 PathList m_path_list;
123
124
126 void convertStringToList(const agx::String& str, PathList& lst, const agx::String& delimiter);
127
128 void removeDuplicates();
129
131 agx::String m_delimiter;
132
133 };
134
135}
136
137#ifdef _MSC_VER
138# pragma warning(pop)
139#endif
140#endif // AGXIO_FILEPATHCONTAINER_H
#define AGXCORE_EXPORT
class for locating files
bool setFromEnvironmentVariable(const agx::String &env, bool clearPrevious=true)
Set the file path found in given environment variable.
void pushfrontPath(const agx::String &path)
Adds a filepath to the beginning of the list.
PathList & getFilePathList()
~FilePathContainer()
Destructor.
void removeFilePath(const agx::String &path)
Removes a list of paths.
const PathList & getFilePathList() const
void clear()
Clear all added path.
agx::String find(const agx::String &filename) const
First it will try to locate 'filename' in one of the specified directories.
void setFilePathList(const agx::String &paths, bool clearPrevious=true, const agx::String &delimiter=agxIO::FileSystem::PATH_DELIMITER)
Set the file path using a single string delimited with given delimiter.
FilePathContainer()
Constructor.
agx::List< agx::String > PathList
void setFilePath(const agx::String &path)
Set the file path directly.
void pushbackPath(const agx::String &path)
Adds a filepath to the end of the list.
void addFilePath(const agx::String &path)
Adds a list of paths to the end previous one.
FilePathContainer(const agx::String &env)
Constructor - set the file path found in given environment variable.
The agxIO namespace contains classes for reading, writing and finding files.
Definition Material.h:42
static AGXCORE_EXPORT const char *const PATH_DELIMITER
Separator between paths in a list of paths, on unix: :, on windows ;.
Definition FileSystem.h:47