Lunchbox  1.14.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
file.h
1 
2 /* Copyright (c) 2009-2015, Cedric Stalder <cedric.stalder@gmail.com>
3  * Stefan Eilemann <eile@equalizergraphics.com>
4  * Daniel Nachbaur <danielnachbaur@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef LUNCHBOX_FILE_H
21 #define LUNCHBOX_FILE_H
22 
23 #include <lunchbox/api.h>
24 #include <lunchbox/compiler.h>
25 #include <lunchbox/types.h>
26 
27 namespace lunchbox
28 {
29 
37 LUNCHBOX_API Strings searchDirectory( const std::string& directory,
38  const std::string& pattern );
39 
43 LUNCHBOX_API std::string getFilename( const std::string& filename );
44 
48 LUNCHBOX_API std::string getDirname( const std::string& filename );
49 
59 LUNCHBOX_API std::string getExecutableDir();
61 inline std::string getExecutablePath() { return getExecutableDir(); }
62 
67 LUNCHBOX_API std::string getWorkDir();
68 
84 LUNCHBOX_API std::string getRootDir();
85 inline std::string getRootPath() { return getRootDir(); }
86 
91 LUNCHBOX_API std::string getLibraryPath();
92 
97 LUNCHBOX_API Strings getLibraryPaths();
98 
100 LUNCHBOX_API bool saveBinary( const servus::Serializable& object,
101  const std::string& filename );
102 
104 LUNCHBOX_API bool loadBinary( servus::Serializable& object,
105  const std::string& filename );
106 
108 LUNCHBOX_API bool saveAscii( const servus::Serializable& object,
109  const std::string& filename );
110 
112 LUNCHBOX_API bool loadAscii( servus::Serializable& object,
113  const std::string& filename );
114 }
115 
116 #endif //LUNCHBOX_FILE_H
std::string getRootDir()
Get the absolute path to the root directory of the current executable.
bool loadAscii(servus::Serializable &object, const std::string &filename)
Load from ascii (JSON) file.
Defines export visibility macros for library Lunchbox.
Basic type definitions not provided by the operating system.
std::string getExecutableDir()
Get the absolute directory of the current executable.
bool loadBinary(servus::Serializable &object, const std::string &filename)
Load from binary file.
std::vector< std::string > Strings
A vector of std::strings.
Definition: types.h:215
Strings searchDirectory(const std::string &directory, const std::string &pattern)
Retrieve a list of files in a directory matching a boost::regex pattern.
std::string getExecutablePath()
Definition: file.h:61
std::string getRootPath()
Definition: file.h:85
bool saveBinary(const servus::Serializable &object, const std::string &filename)
Save binary to file.
std::string getWorkDir()
std::string getLibraryPath()
std::string getDirname(const std::string &filename)
Abstraction layer and common utilities for multi-threaded programming.
Definition: algorithm.h:32
Strings getLibraryPaths()
bool saveAscii(const servus::Serializable &object, const std::string &filename)
Save ascii (JSON) to file.
std::string getFilename(const std::string &filename)