1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine" and the "irrXML" project.
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __IRR_PATH_H_INCLUDED__
\r
6 #define __IRR_PATH_H_INCLUDED__
\r
8 #include "irrString.h"
\r
15 //! Type used for all file system related strings.
\r
16 /** This type will transparently handle different file system encodings.
\r
17 NOTE: For historical reasons the tool-functions using io::path are all in coreutil.h
\r
19 typedef core::string<fschar_t> path;
\r
21 //! Used in places where we identify objects by a filename, but don't actually work with the real filename
\r
22 /** Irrlicht is internally not case-sensitive when it comes to names.
\r
23 Also this class is a first step towards support for correctly serializing renamed objects.
\r
31 SNamedPath(const path& p) : Path(p), InternalName( PathToName(p) )
\r
35 //! Is smaller comparator
\r
36 bool operator <(const SNamedPath& other) const
\r
38 return InternalName < other.InternalName;
\r
42 void setPath(const path& p)
\r
45 InternalName = PathToName(p);
\r
49 const path& getPath() const
\r
54 //! Get the name which is used to identify the file.
\r
55 //! This string is similar to the names and filenames used before Irrlicht 1.7
\r
56 const path& getInternalName() const
\r
58 return InternalName;
\r
61 //! Implicit cast to io::path
\r
62 operator core::stringc() const
\r
64 return core::stringc(getPath());
\r
66 //! Implicit cast to io::path
\r
67 operator core::stringw() const
\r
69 return core::stringw(getPath());
\r
73 // convert the given path string to a name string.
\r
74 path PathToName(const path& p) const
\r
77 name.replace( '\\', '/' );
\r
90 #endif // __IRR_PATH_H_INCLUDED__
\r