You.i Engine
YiFile.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_FILE_H_
3 #define _YI_FILE_H_
4 
5 #include "utility/YiString.h"
6 
7 class CYIDateTime;
8 
17 class CYIFile
18 {
19 public:
27  static CYIString ExtractFilenameFromPath(const CYIString &rPath);
28 
35  static CYIString ExtractParentFromPath(const CYIString &rPath);
36 
56  static CYIString GetNormalizedPath(const CYIString &path);
57 
61  static CYIString Join(const CYIString &pathPrefix, const CYIString &pathSuffix);
62 
70  static bool IsFile(const CYIString &rPath);
71 
79  static uint64_t GetSize(const CYIString &rPath, bool *pError = nullptr);
80 
86  static CYIDateTime GetLastModificationDate(const CYIString &rPath, bool *pError = nullptr);
87 
95  static uint64_t GetModeAndType(const CYIString &rPath, bool *pError = nullptr);
96 
100  static CYIString GetBytesAsString(uint64_t bytes);
101 
111  static CYIString ReadAsString(const CYIString &path, bool *pError = nullptr, bool logErrors = true);
112 
120  static std::vector<uint8_t> ReadAsVector(const CYIString &path, bool *pError = nullptr, bool logErrors = true);
121 
122 private:
123  CYIFile() = delete;
124 };
125 
128 #endif // _YI_FILE_H_
static CYIString ExtractFilenameFromPath(const CYIString &rPath)
static uint64_t GetSize(const CYIString &rPath, bool *pError=nullptr)
This class provides functionality for working with files.
Definition: YiFile.h:17
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
static std::vector< uint8_t > ReadAsVector(const CYIString &path, bool *pError=nullptr, bool logErrors=true)
static uint64_t GetModeAndType(const CYIString &rPath, bool *pError=nullptr)
static CYIString GetNormalizedPath(const CYIString &path)
static CYIString ExtractParentFromPath(const CYIString &rPath)
static CYIString Join(const CYIString &pathPrefix, const CYIString &pathSuffix)
static bool IsFile(const CYIString &rPath)
static CYIString GetBytesAsString(uint64_t bytes)
static CYIDateTime GetLastModificationDate(const CYIString &rPath, bool *pError=nullptr)
Utility class that requires a string as per the following format: http://en.wikipedia.org/wiki/ISO_8601 to construct an instance and provides some commmonly used parts like year, month, hour etc. in different data types and formats. All dates are in the local timezone unless otherwise specified.
Definition: YiDateTime.h:17
static CYIString ReadAsString(const CYIString &path, bool *pError=nullptr, bool logErrors=true)