aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/include/path.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/include/path.h')
-rw-r--r--src/others/irrlicht-1.8.1/include/path.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/include/path.h b/src/others/irrlicht-1.8.1/include/path.h
new file mode 100644
index 0000000..b537987
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/path.h
@@ -0,0 +1,88 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine" and the "irrXML" project.
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __IRR_PATH_H_INCLUDED__
6#define __IRR_PATH_H_INCLUDED__
7
8#include "irrString.h"
9
10namespace irr
11{
12namespace io
13{
14
15//! Type used for all file system related strings.
16/** This type will transparently handle different file system encodings. */
17typedef core::string<fschar_t> path;
18
19//! Used in places where we identify objects by a filename, but don't actually work with the real filename
20/** Irrlicht is internally not case-sensitive when it comes to names.
21 Also this class is a first step towards support for correctly serializing renamed objects.
22*/
23struct SNamedPath
24{
25 //! Constructor
26 SNamedPath() {}
27
28 //! Constructor
29 SNamedPath(const path& p) : Path(p), InternalName( PathToName(p) )
30 {
31 }
32
33 //! Is smaller comparator
34 bool operator <(const SNamedPath& other) const
35 {
36 return InternalName < other.InternalName;
37 }
38
39 //! Set the path.
40 void setPath(const path& p)
41 {
42 Path = p;
43 InternalName = PathToName(p);
44 }
45
46 //! Get the path.
47 const path& getPath() const
48 {
49 return Path;
50 };
51
52 //! Get the name which is used to identify the file.
53 //! This string is similar to the names and filenames used before Irrlicht 1.7
54 const path& getInternalName() const
55 {
56 return InternalName;
57 }
58
59 //! Implicit cast to io::path
60 operator core::stringc() const
61 {
62 return core::stringc(getPath());
63 }
64 //! Implicit cast to io::path
65 operator core::stringw() const
66 {
67 return core::stringw(getPath());
68 }
69
70protected:
71 // convert the given path string to a name string.
72 path PathToName(const path& p) const
73 {
74 path name(p);
75 name.replace( '\\', '/' );
76 name.make_lower();
77 return name;
78 }
79
80private:
81 path Path;
82 path InternalName;
83};
84
85} // io
86} // irr
87
88#endif // __IRR_PATH_H_INCLUDED__