From 206451a9976571e59bd2d1bff099d605fff2f7c3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Dec 2025 18:34:41 +0000 Subject: [PATCH] Fix clang-format violations in file_utils files Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- frontends/cli/include/file_utils.h | 54 +++++++++++++------------ frontends/cli/src/file_utils.cpp | 64 +++++++++++++++--------------- 2 files changed, 61 insertions(+), 57 deletions(-) diff --git a/frontends/cli/include/file_utils.h b/frontends/cli/include/file_utils.h index a1bad21..76752d6 100644 --- a/frontends/cli/include/file_utils.h +++ b/frontends/cli/include/file_utils.h @@ -9,35 +9,37 @@ */ class FileUtils { public: - /** - * @brief Read a file and split into lines - * @param filePath Path to the file - * @param lines Output vector of lines - * @return true if successful, false on error - */ - static bool readLines(const std::string& filePath, std::vector& lines); + /** + * @brief Read a file and split into lines + * @param filePath Path to the file + * @param lines Output vector of lines + * @return true if successful, false on error + */ + static bool readLines(const std::string &filePath, + std::vector &lines); - /** - * @brief Write lines to a file - * @param filePath Path to the file - * @param lines Vector of lines to write - * @return true if successful, false on error - */ - static bool writeLines(const std::string& filePath, const std::vector& lines); + /** + * @brief Write lines to a file + * @param filePath Path to the file + * @param lines Vector of lines to write + * @return true if successful, false on error + */ + static bool writeLines(const std::string &filePath, + const std::vector &lines); - /** - * @brief Check if a file exists - * @param filePath Path to the file - * @return true if file exists, false otherwise - */ - static bool fileExists(const std::string& filePath); + /** + * @brief Check if a file exists + * @param filePath Path to the file + * @return true if file exists, false otherwise + */ + static bool fileExists(const std::string &filePath); - /** - * @brief Get file size in bytes - * @param filePath Path to the file - * @return File size, or -1 on error - */ - static long getFileSize(const std::string& filePath); + /** + * @brief Get file size in bytes + * @param filePath Path to the file + * @return File size, or -1 on error + */ + static long getFileSize(const std::string &filePath); }; #endif // FILE_UTILS_H diff --git a/frontends/cli/src/file_utils.cpp b/frontends/cli/src/file_utils.cpp index 1256f5b..31168f1 100644 --- a/frontends/cli/src/file_utils.cpp +++ b/frontends/cli/src/file_utils.cpp @@ -3,45 +3,47 @@ #include #include -bool FileUtils::readLines(const std::string& filePath, std::vector& lines) { - std::ifstream file(filePath); - if (!file.is_open()) { - return false; - } +bool FileUtils::readLines(const std::string &filePath, + std::vector &lines) { + std::ifstream file(filePath); + if (!file.is_open()) { + return false; + } - lines.clear(); - std::string line; - while (std::getline(file, line)) { - lines.push_back(line); - } + lines.clear(); + std::string line; + while (std::getline(file, line)) { + lines.push_back(line); + } - file.close(); - return true; + file.close(); + return true; } -bool FileUtils::writeLines(const std::string& filePath, const std::vector& lines) { - std::ofstream file(filePath); - if (!file.is_open()) { - return false; - } +bool FileUtils::writeLines(const std::string &filePath, + const std::vector &lines) { + std::ofstream file(filePath); + if (!file.is_open()) { + return false; + } - for (const auto& line : lines) { - file << line << "\n"; - } + for (const auto &line : lines) { + file << line << "\n"; + } - file.close(); - return true; + file.close(); + return true; } -bool FileUtils::fileExists(const std::string& filePath) { - struct stat buffer; - return (stat(filePath.c_str(), &buffer) == 0); +bool FileUtils::fileExists(const std::string &filePath) { + struct stat buffer; + return (stat(filePath.c_str(), &buffer) == 0); } -long FileUtils::getFileSize(const std::string& filePath) { - struct stat buffer; - if (stat(filePath.c_str(), &buffer) != 0) { - return -1; - } - return buffer.st_size; +long FileUtils::getFileSize(const std::string &filePath) { + struct stat buffer; + if (stat(filePath.c_str(), &buffer) != 0) { + return -1; + } + return buffer.st_size; }