aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/utils/IOUtils.h
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-12 06:02:37 +0000
committersaturneric <[email protected]>2024-01-12 06:02:37 +0000
commitbf538056b24a68b8fd235b1c50991ee8eb46a776 (patch)
treee1bab54095b80df62b321fb5bd69453f9f951b05 /src/core/utils/IOUtils.h
parentfeat: improve api and ui of keys import and export (diff)
downloadGpgFrontend-bf538056b24a68b8fd235b1c50991ee8eb46a776.tar.gz
GpgFrontend-bf538056b24a68b8fd235b1c50991ee8eb46a776.zip
refactor: use QString instead of std::string and improve threading system
Diffstat (limited to 'src/core/utils/IOUtils.h')
-rw-r--r--src/core/utils/IOUtils.h84
1 files changed, 17 insertions, 67 deletions
diff --git a/src/core/utils/IOUtils.h b/src/core/utils/IOUtils.h
index 40e6923d..42c663c3 100644
--- a/src/core/utils/IOUtils.h
+++ b/src/core/utils/IOUtils.h
@@ -33,34 +33,13 @@
namespace GpgFrontend {
/**
- * @brief read file content using std struct
- *
- *
- * @param file_name file name
- * @param data data read from file
- * @return
- */
-auto GPGFRONTEND_CORE_EXPORT ReadFileStd(const std::filesystem::path &file_name,
- std::string &data) -> bool;
-
-/**
* @brief
*
* @param file_name
* @return GFBuffer
*/
-auto GPGFRONTEND_CORE_EXPORT ReadFileGFBuffer(
- const std::filesystem::path &file_name) -> std::tuple<bool, GFBuffer>;
-
-/**
- * @brief write file content using std struct
- *
- * @param file_name file name
- * @param data data to write to file
- * @return
- */
-auto GPGFRONTEND_CORE_EXPORT WriteFileStd(
- const std::filesystem::path &file_name, const std::string &data) -> bool;
+auto GPGFRONTEND_CORE_EXPORT ReadFileGFBuffer(const QString &file_name)
+ -> std::tuple<bool, GFBuffer>;
/**
* @brief
@@ -70,8 +49,8 @@ auto GPGFRONTEND_CORE_EXPORT WriteFileStd(
* @return true
* @return false
*/
-auto GPGFRONTEND_CORE_EXPORT WriteFileGFBuffer(
- const std::filesystem::path &file_name, GFBuffer data) -> bool;
+auto GPGFRONTEND_CORE_EXPORT WriteFileGFBuffer(const QString &file_name,
+ GFBuffer data) -> bool;
/**
* @brief read file content
@@ -100,17 +79,7 @@ auto GPGFRONTEND_CORE_EXPORT WriteFile(const QString &file_name,
* @param file_path
* @return
*/
-auto GPGFRONTEND_CORE_EXPORT
-CalculateHash(const std::filesystem::path &file_path) -> std::string;
-
-/**
- * @brief
- *
- * @param path
- * @return std::string
- */
-auto GPGFRONTEND_CORE_EXPORT ReadAllDataInFile(const std::string &path)
- -> std::string;
+auto GPGFRONTEND_CORE_EXPORT CalculateHash(const QString &file_path) -> QString;
/**
* @brief
@@ -120,61 +89,42 @@ auto GPGFRONTEND_CORE_EXPORT ReadAllDataInFile(const std::string &path)
* @return true
* @return false
*/
-auto GPGFRONTEND_CORE_EXPORT WriteBufferToFile(const std::string &path,
- const std::string &out_buffer)
+auto GPGFRONTEND_CORE_EXPORT WriteBufferToFile(const QString &path,
+ const QString &out_buffer)
-> bool;
/**
* @brief
*
- * @param path
- * @return std::filesystem::path
- */
-auto GPGFRONTEND_CORE_EXPORT ConvertPathByOS(const std::string &path)
- -> std::filesystem::path;
-
-/**
- * @brief
- *
- * @return std::filesystem::path
- */
-auto GPGFRONTEND_CORE_EXPORT ConvertPathByOS(const QString &)
- -> std::filesystem::path;
-
-/**
- * @brief
- *
- * @return std::filesystem::path
+ * @return QString
*/
-auto GPGFRONTEND_CORE_EXPORT GetTempFilePath() -> std::filesystem::path;
+auto GPGFRONTEND_CORE_EXPORT GetTempFilePath() -> QString;
/**
* @brief
*
* @param data
- * @return std::filesystem::path
+ * @return QString
*/
-auto GPGFRONTEND_CORE_EXPORT CreateTempFileAndWriteData(const std::string &data)
- -> std::filesystem::path;
+auto GPGFRONTEND_CORE_EXPORT CreateTempFileAndWriteData(const QString &data)
+ -> QString;
/**
* @brief
*
* @param path
* @param read
- * @return std::tuple<bool, std::string>
+ * @return std::tuple<bool, QString>
*/
-auto GPGFRONTEND_CORE_EXPORT
-TargetFilePreCheck(const std::filesystem::path &path, bool read)
- -> std::tuple<bool, std::string>;
+auto GPGFRONTEND_CORE_EXPORT TargetFilePreCheck(const QString &path, bool read)
+ -> std::tuple<bool, QString>;
/**
* @brief
*
* @param path
- * @return std::string
+ * @return QString
*/
-auto GPGFRONTEND_CORE_EXPORT GetFullExtension(std::filesystem::path path)
- -> std::string;
+auto GPGFRONTEND_CORE_EXPORT GetFullExtension(QString path) -> QString;
} // namespace GpgFrontend