src/core/FileUtils.h

FileUtils [Module]

Description

The FileUtils module provides essential file I/O and XML tokenization utilities used throughout the application.

Functions

std::string readFileToString(const std::string& filename)
Reads the entire contents of a file into a string.
Parameters
  • filename: Path to the file to read.
Returns
String containing the file contents.
void writeToFile(const std::string& filename, const std::string& content)
Writes a string to a file, creating or overwriting it.
Parameters
  • filename: Path to the output file.
  • content: Content to write.
std::vector<Token> tokenizeLine(const std::string& line)
Tokenizes a single line of XML into tokens.
Returns
Vector of Token structures.
std::vector<Token> tokenizeXML(const std::string& xmlContent)
Tokenizes an entire XML document into a sequence of tokens.
Returns
Vector of all tokens in the document.
Tree<std::string>* buildTree(const std::vector<Token>& tokens)
Constructs a tree structure from a vector of XML tokens.
Parameters
  • tokens: Tokenized XML data.
Returns
Pointer to the root of the constructed tree.