|
@@ -3,7 +3,7 @@
|
|
|
* Company: Lynar Studios
|
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
|
* Created: 2020-08-15
|
|
|
- * Changed: 2023-02-04
|
|
|
+ * Changed: 2023-02-06
|
|
|
*
|
|
|
* */
|
|
|
|
|
@@ -40,25 +40,25 @@ namespace ls::std::io
|
|
|
|
|
|
// additional functionality
|
|
|
|
|
|
- bool canExecute();
|
|
|
- bool canRead();
|
|
|
- bool canWrite();
|
|
|
+ [[nodiscard]] bool canExecute();
|
|
|
+ [[nodiscard]] bool canRead();
|
|
|
+ [[nodiscard]] bool canWrite();
|
|
|
void createNewFile();
|
|
|
- bool exists();
|
|
|
- ::std::string getAbsoluteFilePath();
|
|
|
- ::std::string getName();
|
|
|
- ::std::string getParent();
|
|
|
- static ::std::string getWorkingDirectory();
|
|
|
- long getSize();
|
|
|
- bool isDirectory();
|
|
|
- bool isFile();
|
|
|
- time_t lastModified();
|
|
|
- ::std::list<::std::string> list();
|
|
|
- ::std::list<::std::string> listFiles();
|
|
|
+ [[nodiscard]] bool exists();
|
|
|
+ [[nodiscard]] ::std::string getAbsoluteFilePath();
|
|
|
+ [[nodiscard]] ::std::string getName();
|
|
|
+ [[nodiscard]] ::std::string getParent();
|
|
|
+ [[nodiscard]] long getSize();
|
|
|
+ [[nodiscard]] static ::std::string getWorkingDirectory();
|
|
|
+ [[nodiscard]] bool isDirectory();
|
|
|
+ [[nodiscard]] bool isFile();
|
|
|
+ [[nodiscard]] time_t lastModified();
|
|
|
+ [[nodiscard]] ::std::list<::std::string> list();
|
|
|
+ [[nodiscard]] ::std::list<::std::string> listFiles();
|
|
|
void makeDirectory();
|
|
|
void makeDirectories();
|
|
|
void remove();
|
|
|
- bool renameTo(const ::std::string &_newName);
|
|
|
+ bool renameTo(const ::std::string &_newName); // nodiscard is optional here
|
|
|
void reset(const ::std::string &_newPath);
|
|
|
|
|
|
private:
|
|
@@ -71,37 +71,37 @@ namespace ls::std::io
|
|
|
#ifdef _WIN32
|
|
|
static void _addToFileListWindows(const ::std::string &_path, bool _withDirectories, WIN32_FIND_DATA _data, ::std::list<::std::string> &_list);
|
|
|
#endif
|
|
|
- static bool _equals(ls::std::io::File &_file, ls::std::io::File &_foreignFile);
|
|
|
- static bool _exists(const ::std::string &_path);
|
|
|
- static ::std::string _getParent(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static bool _equals(ls::std::io::File &_file, ls::std::io::File &_foreignFile);
|
|
|
+ [[nodiscard]] static bool _exists(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static ::std::string _getParent(const ::std::string &_path);
|
|
|
#if defined(unix) || defined(__APPLE__)
|
|
|
- static ::std::string _getWorkingDirectoryUnix();
|
|
|
+ [[nodiscard]] static ::std::string _getWorkingDirectoryUnix();
|
|
|
#endif
|
|
|
#ifdef _WIN32
|
|
|
- static ::std::string _getWorkingDirectoryWindows();
|
|
|
+ [[nodiscard]] static ::std::string _getWorkingDirectoryWindows();
|
|
|
#endif
|
|
|
- static bool _isDirectory(const ::std::string &_path);
|
|
|
- static bool _isExecutable(const ::std::string &_path);
|
|
|
- static bool _isFile(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static bool _isDirectory(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static bool _isExecutable(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static bool _isFile(const ::std::string &_path);
|
|
|
#if defined(unix) || defined(__APPLE__)
|
|
|
- static bool _isReadableUnix(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static bool _isReadableUnix(const ::std::string &_path);
|
|
|
#endif
|
|
|
#ifdef _WIN32
|
|
|
- static bool _isReadableWindows(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static bool _isReadableWindows(const ::std::string &_path);
|
|
|
#endif
|
|
|
- static bool _isWritable(const ::std::string &_path);
|
|
|
- static time_t _lastModified(const ::std::string &_path);
|
|
|
- static ::std::list<::std::string> _list(const ::std::string &_path);
|
|
|
- static ::std::list<::std::string> _listFiles(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static bool _isWritable(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static time_t _lastModified(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static ::std::list<::std::string> _list(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static ::std::list<::std::string> _listFiles(const ::std::string &_path);
|
|
|
#if defined(unix) || defined(__APPLE__)
|
|
|
- static ::std::list<::std::string> _listUnix(const ::std::string &_path, bool withDirectories);
|
|
|
+ [[nodiscard]] static ::std::list<::std::string> _listUnix(const ::std::string &_path, bool withDirectories);
|
|
|
#endif
|
|
|
#ifdef _WIN32
|
|
|
- static ::std::list<::std::string> _listWindows(const ::std::string &_path, bool withDirectories);
|
|
|
+ [[nodiscard]] static ::std::list<::std::string> _listWindows(const ::std::string &_path, bool withDirectories);
|
|
|
#endif
|
|
|
- static int _mkdir(const ::std::string &_path);
|
|
|
- static ::std::string _normalizePath(::std::string _path);
|
|
|
- static ::std::string _reduceSeparators(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static bool _makeDirectory(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static ::std::string _normalizePath(::std::string _path);
|
|
|
+ [[nodiscard]] static ::std::string _reduceSeparators(const ::std::string &_path);
|
|
|
static void _remove(const ::std::string &_path);
|
|
|
#if defined(unix) || defined(__APPLE__)
|
|
|
static void _removeUnix(const ::std::string &_path);
|
|
@@ -109,9 +109,9 @@ namespace ls::std::io
|
|
|
#ifdef _WIN32
|
|
|
static void _removeWindows(const ::std::string &_path);
|
|
|
#endif
|
|
|
- static bool _renameTo(const ::std::string &_oldName, const ::std::string &_newName);
|
|
|
- static ::std::string _replaceWrongSeparator(::std::string _path);
|
|
|
- static ::std::vector<::std::string> _splitIntoSubDirectoryNames(const ::std::string &_path);
|
|
|
+ [[nodiscard]] static bool _renameTo(const ::std::string &_oldName, const ::std::string &_newName);
|
|
|
+ [[nodiscard]] static ::std::string _replaceWrongSeparator(::std::string _path);
|
|
|
+ [[nodiscard]] static ::std::vector<::std::string> _splitIntoSubDirectoryNames(const ::std::string &_path);
|
|
|
};
|
|
|
}
|
|
|
|