guts
Loading...
Searching...
No Matches
guts

Overview

The gutilities module provides a suite of small, dependency-light helpers grouped under the gutilities namespace. These utilities are reused across the codebase to keep common operations (string normalization, filesystem probing, numeric parsing) consistent and easy to audit.

The guiding design goals are:

  • Small surface area: each function does one thing, with explicit behavior.
  • Predictable parsing: numeric parsing is designed to be locale-independent.
  • Reuse: common patterns live in one place rather than being re-implemented in multiple modules.

Main namespace contents

The gutilities namespace includes (non-exhaustive):

Conventions and shared macros

The module follows conventions defined in gutsConventions.h :

  • Message prefixes:
    • FATALERRORL and GWARNING provide standardized fatal/warning prefixes.
  • Text formatting:
    • ANSI helpers such as FRED("...") or BOLD("...") for colored/bold console output.
  • List glyphs:
    • POINTITEM, CIRCLEITEM, SQUAREITEM, etc., to keep console logs consistent.

Examples

Tokenizing a string into words

The example program examples/string_vector_from_string.cc demonstrates how to use getStringVectorFromString() to split a single command-line argument into tokens and print them.

#include <iostream>
#include <vector>
#include "gutilities.h"
int main(int argc, char* argv[]) {
std::string input = "strings separated by spaces";
std::vector<std::string> result = gutilities::getStringVectorFromString(input);
for (const auto& word : result) {
std::cout << word << std::endl;
}
return 0;
}
int main(int argc, char *argv[])
Public API for the gutilities namespace.
vector< std::string > getStringVectorFromString(const std::string &input)
Splits a string into a vector of strings using whitespace as delimiters.

Example output:

strings
separated
by
spaces

Additional features

Additional utility functions include:

Ownership and maintenance

This module is maintained as part of the broader codebase by the primary project maintainer. When updating these utilities, prefer:

  • adding documentation for behavior changes,
  • keeping parsing rules explicit and testable,
  • avoiding implicit dependencies on platform locale and environment.



Author

© Maurizio Ungaro
e-mail: ungar.nosp@m.o@jl.nosp@m.ab.or.nosp@m.g