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