mstring  1.3.1
Generates C++ message functions and classes from localized message definitions
MMessage.hh File Reference

Writers for everything generated from one $MESSAGE: the declarations in the header and the definitions in the source. More...

#include <iosfwd>
#include <string>
#include "MWriter.hh"
#include "Message.hh"
+ Include dependency graph for MMessage.hh:
+ This graph shows which files directly or indirectly include this file:

Classes

class  MessagePrototypeWriter
 
struct  MessagePrototypeWriter::Placement
 Where a generated function lives and what it takes. More...
 
class  MessageHeaderWriter
 
class  MessageCodeWriter
 

Enumerations

enum class  FunctionKind { String , Error , Throw , Log }
 The functions a FunctionConcept generates. More...
 

Functions

bool NeedsStreamer (const Message &message)
 Whether a message needs the stream / the string text function. More...
 
bool NeedsBuilder (const Message &message)
 
void WriteLocaleMatcher (std::ostream &stream)
 Define the locale-name matcher: exact name, or the language followed by '_', '.' or '@' — [tr] and [tr_TR] both select tr_TR.UTF-8. More...
 

Variables

const char *const LocaleMatcherName
 Name of the helper the source defines when a message has several languages; see WriteLocaleMatcher(). More...
 

Detailed Description

Writers for everything generated from one $MESSAGE: the declarations in the header and the definitions in the source.

Per message the source gets up to two static text functions: InternalStreamerFunctionOf_<name> writes the text to a std::ostream (for the streamable class and the error function), and InternalBuilderOf_<name> appends it to a std::string without a stream (for the string and syslog functions and the exception's What()) — several times faster than building through a std::ostringstream.

Enumeration Type Documentation

◆ FunctionKind

enum FunctionKind
strong

The functions a FunctionConcept generates.

Enumerator
String 
Error 
Throw 
Log 

Function Documentation

◆ NeedsStreamer()

bool NeedsStreamer ( const Message &  message)

Whether a message needs the stream / the string text function.

References Concept::_Active, MessageSettings::_Error, MessageSettings::_Streamable, and Message::Settings.

Referenced by MessageCodeWriter::operator()().

+ Here is the caller graph for this function:

◆ NeedsBuilder()

bool NeedsBuilder ( const Message &  message)

References Concept::_Active, MessageSettings::_Exception, MessageSettings::_Log, MessageSettings::_String, MessageSettings::_Throw, and Message::Settings.

Referenced by MessageCodeWriter::operator()(), and WriteDefinitions().

+ Here is the caller graph for this function:

◆ WriteLocaleMatcher()

void WriteLocaleMatcher ( std::ostream &  stream)

Define the locale-name matcher: exact name, or the language followed by '_', '.' or '@' — [tr] and [tr_TR] both select tr_TR.UTF-8.

References GenerationMode::CloseHelpers(), GenerationMode::Linkage(), LocaleMatcherName, Mode, and GenerationMode::OpenHelpers().

Referenced by WriteDefinitions().

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

Variable Documentation

◆ LocaleMatcherName

const char* const LocaleMatcherName
extern

Name of the helper the source defines when a message has several languages; see WriteLocaleMatcher().

Referenced by MessageCodeWriter::TextFunction(), and WriteLocaleMatcher().