Code View

mstring / mstring-1.3.1.2 / src / MUtil.hh
// SPDX-License-Identifier: MIT
#pragma once

#include <iosfwd>
#include <string>

/// \file MUtil.hh
/// \brief Small string helpers shared by the parser and the writers.

/// \brief \p str without leading and trailing blanks (space, tab, CR).
std::string Trim( const std::string &str );

/// \brief Write \p text as a C++ string literal. After every embedded newline
///        the literal is closed and continued on the next output line, indented
///        by \p indent plus \p hang spaces, so multi-line texts stay readable.
void WriteStringLiteral( std::ostream &stream, const std::string &text,
                         const std::string &indent, std::string::size_type hang );