Simulant
21.12-1292
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
simulant
path.h
1
#pragma once
2
3
#include <string>
4
5
namespace
smlt
{
6
7
class
Path
{
8
public
:
9
Path
() =
default
;
10
11
Path
(
const
char
* path):
12
path_(path) {}
13
14
Path
(
const
std::string& path):
15
path_(path) {}
16
17
static
Path
system_temp_dir();
18
24
Path
parent
()
const
;
25
27
Path
normalize
()
const
;
28
30
std::pair<Path, std::string>
split
()
const
;
31
34
std::string
name
()
const
;
35
36
Path
absoluted()
const
;
37
38
Path
append(
const
std::string& name)
const
;
39
41
std::string
str
()
const
{
42
return
path_;
43
}
44
45
std::string ext()
const
;
46
47
/* Returns a new Path object, with the extension replaced. If there is no
48
* extension this will effectively append the extension to the path. */
49
Path
replace_ext(
const
std::string& new_ext)
const
;
50
51
bool
operator==(
const
Path
& p)
const
;
52
bool
operator<(
const
Path
& p)
const
;
53
bool
operator!=(
const
Path
& p)
const
{
54
return
!(*
this
== p);
55
}
56
62
bool
is_absolute
()
const
;
63
private
:
64
std::string path_;
65
};
66
67
std::ostream& operator<<(std::ostream& os,
const
Path& p);
68
69
}
70
71
namespace
std
{
72
73
template
<>
74
struct
hash<
smlt
::Path> {
75
std::size_t operator()(
const
smlt::Path
& k)
const
{
76
return
hash<std::string>()(k.
str
());
77
}
78
};
79
80
}
smlt::Path::split
std::pair< Path, std::string > split() const
Definition:
path.cpp:41
smlt::Path::is_absolute
bool is_absolute() const
Definition:
path.cpp:51
smlt
Definition:
animation.cpp:25
smlt::Path::str
std::string str() const
Definition:
path.h:41
smlt::Path::normalize
Path normalize() const
Definition:
path.cpp:37
smlt::Path
Definition:
path.h:7
smlt::Path::name
std::string name() const
Definition:
path.cpp:67
smlt::Path::parent
Path parent() const
Definition:
path.cpp:33
std
Extensions to the C++ standard library.
Definition:
variant.hpp:2752
Generated by
1.8.20