Lunchbox  1.16.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 {
36 LUNCHBOX_API Strings searchDirectory(const std::string& directory,
37  const std::string& pattern);
38 
42 LUNCHBOX_API std::string getFilename(const std::string& filename);
43 
47 LUNCHBOX_API std::string getDirname(const std::string& filename);
48 
58 LUNCHBOX_API std::string getExecutableDir();
60 inline std::string getExecutablePath()
61 {
62  return getExecutableDir();
63 }
64 
69 LUNCHBOX_API std::string getWorkDir();
70 
86 LUNCHBOX_API std::string getRootDir();
87 inline std::string getRootPath()
88 {
89  return getRootDir();
90 }
91 
96 LUNCHBOX_API std::string getLibraryPath();
97 
102 LUNCHBOX_API Strings getLibraryPaths();
103 
105 LUNCHBOX_API bool saveBinary(const servus::Serializable& object,
106  const std::string& filename);
107 
109 LUNCHBOX_API bool loadBinary(servus::Serializable& object,
110  const std::string& filename);
111 
113 LUNCHBOX_API bool saveAscii(const servus::Serializable& object,
114  const std::string& filename);
115 
117 LUNCHBOX_API bool loadAscii(servus::Serializable& object,
118  const std::string& filename);
119 }
120 
121 #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.
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:60
std::string getRootPath()
Definition: file.h:87
bool saveBinary(const servus::Serializable &object, const std::string &filename)
Save binary to file.
std::string getWorkDir()
std::string getLibraryPath()
std::vector< std::string > Strings
A vector of std::strings.
Definition: types.h:220
std::string getDirname(const std::string &filename)
Abstraction layer and common utilities for multi-threaded programming.
Definition: algorithm.h:29
Strings getLibraryPaths()
bool saveAscii(const servus::Serializable &object, const std::string &filename)
Save ascii (JSON) to file.
std::string getFilename(const std::string &filename)