mstring  1.3.1
Generates C++ message functions and classes from localized message definitions
MText.cpp File Reference
#include "MText.hh"
#include <algorithm>
#include <ostream>
#include "MFormat.hh"
#include "MUtil.hh"
+ Include dependency graph for MText.cpp:

Functions

void WriteLocaleAppend (std::ostream &stream, std::string &indent, const LocaleMessage &locale)
 The same text appended to std::string internal_out instead of streamed: literals with +=, a plain macro through InternalAppend( internal_out, loc, value ), a macro with formats through a local std::ostringstream imbued with loc. More...
 
void WriteAppendHelper (std::ostream &stream)
 Define InternalAppend(): a string-like value is appended as it is, an integer with std::to_chars when the locale is "C", anything else through a std::ostringstream imbued with the locale — so the result is always what streaming the value would have produced. More...
 
void WriteLocaleText (std::ostream &stream, std::string &indent, const LocaleMessage &locale)
 All the text elements of locale, preceded by an ENCODE comment. More...
 

Variables

const char *const AppendHelperName = "InternalAppend"
 Name of the helper WriteAppendHelper() defines. More...
 

Function Documentation

◆ WriteLocaleAppend()

void WriteLocaleAppend ( std::ostream &  stream,
std::string &  indent,
const LocaleMessage &  locale 
)

The same text appended to std::string internal_out instead of streamed: literals with +=, a plain macro through InternalAppend( internal_out, loc, value ), a macro with formats through a local std::ostringstream imbued with loc.

References LocaleMessage::Encode, and LocaleMessage::TextElements.

Referenced by MessageCodeWriter::TextFunction().

+ Here is the caller graph for this function:

◆ WriteAppendHelper()

void WriteAppendHelper ( std::ostream &  stream)

Define InternalAppend(): a string-like value is appended as it is, an integer with std::to_chars when the locale is "C", anything else through a std::ostringstream imbued with the locale — so the result is always what streaming the value would have produced.

References AppendHelperName, GenerationMode::CloseHelpers(), Mode, and GenerationMode::OpenHelpers().

Referenced by WriteDefinitions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WriteLocaleText()

void WriteLocaleText ( std::ostream &  stream,
std::string &  indent,
const LocaleMessage &  locale 
)

All the text elements of locale, preceded by an ENCODE comment.

References LocaleMessage::Encode, and LocaleMessage::TextElements.

Referenced by MessageCodeWriter::TextFunction().

+ Here is the caller graph for this function:

Variable Documentation

◆ AppendHelperName

const char* const AppendHelperName = "InternalAppend"

Name of the helper WriteAppendHelper() defines.

Referenced by WriteAppendHelper().