CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
path.h
1
2#ifndef _aspose_system_io_path_h_
3#define _aspose_system_io_path_h_
4
5#include <system/exceptions.h>
6#include <system/array.h>
7#include <system/string.h>
8
9#ifdef GetCurrentDirectory
10#pragma message("!!! GetCurrentDirectory defined, please do not include windows.h manually")
11#undef GetCurrentDirectory
12#undef SetCurrentDirectory
13#endif
14
15namespace boost { namespace filesystem {
16 class path;
17} }
18
19namespace System { namespace IO {
20
21class File;
22class Directory;
52 class Path
53 {
54 friend class Directory;
55 public:
60 static ASPOSECPP_SHARED_API String ChangeExtension(const String& path, const String& extension);
61
66 static ASPOSECPP_SHARED_API String Combine(const ArrayPtr<String>& paths);
72 static ASPOSECPP_SHARED_API String Combine(const String& path1, const String& path2);
79 static ASPOSECPP_SHARED_API String Combine(const String& path1, const String& path2, const String& path3);
87 static ASPOSECPP_SHARED_API String Combine(const String& path1, const String& path2, const String& path3, const String& path4);
88
92 static ASPOSECPP_SHARED_API String GetDirectoryName(const String& path);
96 static ASPOSECPP_SHARED_API String GetExtension(const String& path);
100 static ASPOSECPP_SHARED_API String GetFileName(const String& path);
104 static ASPOSECPP_SHARED_API String GetFileNameWithoutExtension(const String& path);
108 static ASPOSECPP_SHARED_API String GetFullPath(const String& path);
109
111 static ASPOSECPP_SHARED_API ArrayPtr<char_t> GetInvalidFileNameChars();
113 static ASPOSECPP_SHARED_API ArrayPtr<char_t> GetInvalidPathChars();
114
118 static ASPOSECPP_SHARED_API String GetPathRoot(const String& path);
120 static ASPOSECPP_SHARED_API String GetRandomFileName();
123 static ASPOSECPP_SHARED_API String GetTempFileName_();
127 static ASPOSECPP_SHARED_API String GetTempFileNameSafe();
129 static ASPOSECPP_SHARED_API String GetTempPath();
133 static ASPOSECPP_SHARED_API bool HasExtension(const String& path);
137 static ASPOSECPP_SHARED_API bool IsPathRooted(const String& path);
138
140 static const char_t ASPOSECPP_SHARED_API AltDirectorySeparatorChar;
142 static const char_t ASPOSECPP_SHARED_API DirectorySeparatorChar;
144 static const char_t ASPOSECPP_SHARED_API PathSeparator;
146 static const char_t ASPOSECPP_SHARED_API VolumeSeparatorChar;
147
155 static ASPOSECPP_SHARED_API void CheckPath(const String& path, const String& msg = s_msg_path, bool allow_empty = true);
156
160 static ASPOSECPP_SHARED_API String ToString(const boost::filesystem::path& path);
164 static ASPOSECPP_SHARED_API boost::filesystem::path ToBoost(const String& path);
165
169 static ASPOSECPP_SHARED_API String NormalizePath(const String& path);
170
172 static ASPOSECPP_SHARED_API const String s_msg_path;
173
174 private:
178 static bool HasInvalidChars(const String& path);
179
185 static String CombineNoCheck(const String& path1, const String& path2);
186
192 static bool IsDSC(char_t ch);
193
199 static bool IsSeparatorChar(char_t ch);
200
204 static String NormalizePath_(boost::filesystem::path path);
205
209 static ASPOSECPP_SHARED_API String GetFileNameNoCheck(const String& path);
210
214 static ASPOSECPP_SHARED_API String GetFullPathNoCheck(const String& path);
215 };
216}}
217
218#endif // _aspose_system_io_path_h_
Contains methods for manipulating directories. This is a static type with no instance services....
Definition: directory.h:58
Provides methods for manipulating paths. This is a static type with no instance services....
Definition: path.h:53
static bool HasExtension(const String &path)
Determines if the specified path references a file with extension.
static String Combine(const String &path1, const String &path2, const String &path3, const String &path4)
Combines four specified path segments into a single path inserting directory separator characters bet...
static String Combine(const ArrayPtr< String > &paths)
Combines the specified path segments into a single path inserting directory separator characters betw...
static void CheckPath(const String &path, const String &msg=s_msg_path, bool allow_empty=true)
Determines if the specified path is valid by checking if it contains invalid characters....
static ArrayPtr< char_t > GetInvalidPathChars()
Returns an array containing characters that are not allowed in path names.
static String GetRandomFileName()
Returns a randomly generated file name.
static const char_t DirectorySeparatorChar
A character used to separate directory levels in a path.
Definition: path.h:142
static String Combine(const String &path1, const String &path2, const String &path3)
Combines three specified path segments into a single path inserting directory separator characters be...
static String GetTempPath()
Returns the path of the current user's temporary directory.
static ArrayPtr< char_t > GetInvalidFileNameChars()
Returns an array containing characters that are not allowed in the names of files.
static String GetFullPath(const String &path)
Converts the specified path into absolute path.
static String GetDirectoryName(const String &path)
Returns the name of the directory referenced by the specified path.
static const char_t VolumeSeparatorChar
A volume separator character.
Definition: path.h:146
static String GetFileName(const String &path)
Returns the name of the file referenced by the specified path.
static const char_t AltDirectorySeparatorChar
An alternate character used to separate directory levels in a path.
Definition: path.h:140
static const char_t PathSeparator
A separator character used to separate path strings in environment variables.
Definition: path.h:144
static String ChangeExtension(const String &path, const String &extension)
Changes the extension in the specified file path.
static String GetTempFileName_()
Creates a new file with a unique name and returns a full path to it.
static String NormalizePath(const String &path)
Normalizes the specified path.
static bool IsPathRooted(const String &path)
Determines if the specified path contains a root.
static String GetTempFileNameSafe()
Creates a new file with a unique name and returns a full path to it. Is a synonym of GetTempFileName_...
static String ToString(const boost::filesystem::path &path)
Returns a string representation of the specified Boost's path object.
static const String s_msg_path
Default parameter name for CheckPath function.
Definition: path.h:172
static String GetPathRoot(const String &path)
Returns the root directory of the specified path.
static String GetExtension(const String &path)
Returns the extension of the file referenced by the specified path.
static boost::filesystem::path ToBoost(const String &path)
Returns an instance of boost::filesystem::path class that represents the specified path.
static String Combine(const String &path1, const String &path2)
Combines two specified path segments into a single path inserting directory separator character betwe...
static String GetFileNameWithoutExtension(const String &path)
Returns the name without extension of the file referenced by the specified path.
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
@ Directory
The filesystem entity is a directory.
Definition: db_command.h:9