YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Path.cpp
Go to the documentation of this file.
1
#include "
YAPOG/System/Path.hpp
"
2
3
namespace
yap
4
{
5
const
char
Path::DEFAULT_SEPARATOR
=
'/'
;
6
7
Path::Path
(
const
String
& value)
8
: value_ (value)
9
{
10
}
11
12
Path::Path
(
const
Path
& copy)
13
: value_ (copy.value_)
14
{
15
}
16
17
Path
&
Path::operator=
(
const
Path
& copy)
18
{
19
if
(
this
== ©)
20
return
*
this
;
21
22
value_
= copy.
value_
;
23
24
return
*
this
;
25
}
26
27
bool
Path::operator<
(
const
Path
& right)
const
28
{
29
return
value_
< right.
value_
;
30
}
31
32
Path
&
Path::Concat
(
const
Path
& right)
33
{
34
String
extension = right.
value_
;
35
36
if
(extension.size () <= 0)
37
return
*
this
;
38
39
if
(
value_
[
value_
.size () - 1] !=
DEFAULT_SEPARATOR
)
40
value_
+=
DEFAULT_SEPARATOR
;
41
42
value_
+= extension;
43
44
return
*
this
;
45
}
46
47
Path
&
Path::Concat
(
const
String
& value)
48
{
49
value_
+= value;
50
51
return
*
this
;
52
}
53
54
Path
Path::Concat
(
const
Path
& left,
const
Path
& right)
55
{
56
if
(left.
value_
.size () <= 0)
57
return
right;
58
59
Path
result = left;
60
String
extension = right.
value_
;
61
62
if
(extension.size () <= 0)
63
return
result;
64
65
if
(result.
value_
[result.
value_
.size () - 1] !=
DEFAULT_SEPARATOR
)
66
result.
value_
+=
DEFAULT_SEPARATOR
;
67
68
result.
value_
+= extension;
69
70
return
result;
71
}
72
73
Path
Path::Concat
(
const
Path
& left,
const
String
& right)
74
{
75
Path
result = left;
76
77
result.
value_
+= right;
78
79
return
result;
80
}
81
82
const
String
&
Path::GetValue
()
const
83
{
84
return
value_
;
85
}
86
87
Path
operator+
(
const
Path
& left,
const
Path
& right)
88
{
89
return
Path::Concat
(left, right);
90
}
91
92
Path
operator+
(
const
Path
& left,
const
String
& right)
93
{
94
return
Path::Concat
(left, right);
95
}
96
}
// namespace yap
YAPOG
src
YAPOG
System
Path.cpp
Generated on Mon Sep 17 2012 22:24:26 for YAPOG by
1.8.1.1