diff --git a/line-count b/line-count index 7dab676..8649f46 100644 --- a/line-count +++ b/line-count @@ -1,8 +1,8 @@ =============================================================================== Language Files Lines Code Comments Blanks =============================================================================== - C++ 3 299 225 26 48 - C++ Header 3 51 43 1 7 + C++ 4 383 308 26 49 + C++ Header 4 67 56 1 10 =============================================================================== - Total 6 350 268 27 55 + Total 8 450 364 27 59 =============================================================================== diff --git a/src/Regex.cpp b/src/Regex.cpp index a74858c..e0a447a 100644 --- a/src/Regex.cpp +++ b/src/Regex.cpp @@ -1,77 +1,73 @@ -#include -#include -#include -#include #include -#include #include -#include #include +#include #include "regex" #include "includes/Regex.hpp" // regex and stuff (collectionid) void Regex(cmd *inputCmd) { - if (!inputCmd->collectionid.empty()) { - // Input and output file paths - std::string inputFilePath = inputCmd->cachesc; - std::string outputFilePath = inputCmd->cacheid; + if (!inputCmd->collectionid.empty()) { + // Input and output file paths + std::string inputFilePath = inputCmd->cachesc; // Path to the input file - // Open the input file (source.html) - std::ifstream inputFile(inputFilePath); - std::ofstream outputFile(outputFilePath, std::ios::app); + // Open the input file + std::ifstream inputFile(inputFilePath); - if (!inputFile.is_open() && !outputFile.is_open()) { - throw("Unable to open file\n"); + // Check if the input file is open + if (!inputFile.is_open()) { + throw std::runtime_error("Unable to open file: " + inputFilePath); + } + + // Regex to search for the desired pattern + std::regex grepRegex(R"(