nomlib
Toggle main menu visibility
Loading...
Searching...
No Matches
include
nomlib
system
IFile.hpp
1
/******************************************************************************
2
3
nomlib - C++11 cross-platform game engine
4
5
Copyright (c) 2013, 2014 Jeffrey Carpenter <i8degrees@gmail.com>
6
All rights reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
1. Redistributions of source code must retain the above copyright notice, this
12
list of conditions and the following disclaimer.
13
2. Redistributions in binary form must reproduce the above copyright notice,
14
this list of conditions and the following disclaimer in the documentation
15
and/or other materials provided with the distribution.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
******************************************************************************/
29
#ifndef NOMLIB_IFILE_HEADERS
30
#define NOMLIB_IFILE_HEADERS
31
32
#include <iostream>
33
#include <string>
34
#include <cstring>
35
#include <vector>
36
37
#include "export.hpp"
38
#include "nomlib/config.hpp"
39
40
namespace
nom {
41
43
class
NOM_EXPORT IFile
44
{
45
public
:
46
IFile (
void
) {}
47
virtual
~IFile (
void
) {}
48
52
virtual
const
std::string
extension
(
const
std::string& filename ) = 0;
53
57
virtual
int32
size
(
const
std::string& file_path ) = 0;
58
59
virtual
bool
is_dir(
const
std::string& file_path ) = 0;
60
61
virtual
bool
is_file(
const
std::string& file_path ) = 0;
62
64
virtual
bool
exists
(
const
std::string& file_path ) = 0;
65
69
virtual
const
std::string
path
(
const
std::string& dir_path ) = 0;
70
74
virtual
std::string
currentPath
(
void
) = 0;
75
80
virtual
bool
set_path
(
const
std::string&
path
) = 0;
81
88
virtual
const
std::string
basename
(
const
std::string& filename ) = 0;
89
90
virtual
std::vector<std::string> read_dir(
const
std::string& dir_path ) = 0;
91
92
virtual
const
std::string resource_path(
const
std::string& identifier =
"\0"
) = 0;
93
94
virtual
const
std::string user_documents_path() = 0;
95
96
virtual
const
std::string user_app_support_path() = 0;
97
98
virtual
const
std::string user_home_path() = 0;
99
virtual
const
std::string system_path() = 0;
100
virtual
const
std::string system_temp_path() = 0;
101
102
virtual
bool
mkdir(
const
std::string&
path
) = 0;
103
virtual
bool
recursive_mkdir(
const
std::string&
path
) = 0;
104
virtual
bool
rmdir(
const
std::string&
path
) = 0;
105
106
virtual
bool
mkfile(
const
std::string&
path
) = 0;
107
108
virtual
std::string env(
const
std::string&
path
) = 0;
109
113
virtual
nom::size_type
num_files
(
const
std::string&
path
) = 0;
114
};
115
116
117
}
// namespace nom
118
119
#endif
// include guard
120
nom::IFile::size
virtual int32 size(const std::string &file_path)=0
nom::IFile::set_path
virtual bool set_path(const std::string &path)=0
nom::IFile::exists
virtual bool exists(const std::string &file_path)=0
Uses stat(2) to determine if the input file exists.
nom::IFile::extension
virtual const std::string extension(const std::string &filename)=0
nom::IFile::path
virtual const std::string path(const std::string &dir_path)=0
Extract the directory portion of a pathname.
nom::IFile::currentPath
virtual std::string currentPath(void)=0
nom::IFile::basename
virtual const std::string basename(const std::string &filename)=0
nom::IFile::num_files
virtual nom::size_type num_files(const std::string &path)=0
Get the total number of files in a directory.
Generated on
for nomlib by
1.18.0