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

Turns a parsed Module into the C++ header / source pair. More...

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

Functions

void ValidateModule (const Module &module)
 Reject message definitions the generated code could not compile with (e.g. MEMBER AS without a streamable class). Throws MException. More...
 
std::string HeaderFileName (const Module &module)
 The header file name (name.hh), or "" for NOHEADER. More...
 
std::string SourceFileName (const Module &module)
 The source file name (name.cpp), or "" for NOSOURCE. More...
 
void WriteCppInterface (std::ostream &stream, const Module &module, const std::string &input)
 Write the header. input names the message file in the banner. More...
 
void WriteCppImplementation (std::ostream &stream, const Module &module, const std::string &input)
 Write the source. With NOHEADER the declarations are written into it, so it compiles on its own. More...
 
void WriteDefinitions (std::ostream &stream, const Module &module)
 Includes, helpers and the definitions of every message — the body of the source, or the tail of the header for INLINE. More...
 
bool WriteIfChanged (const std::string &path, const std::string &content)
 Write content to path unless the file already holds exactly that — an unchanged message file does not trigger a rebuild. More...
 

Detailed Description

Turns a parsed Module into the C++ header / source pair.

Function Documentation

◆ ValidateModule()

void ValidateModule ( const Module &  module)

Reject message definitions the generated code could not compile with (e.g. MEMBER AS without a streamable class). Throws MException.

References Concept::_Active, MessageSettings::_Error, MessageSettings::_Exception, MessageSettings::_Log, ClassConcept::_Override, ClassConcept::_Parent, MessageSettings::_Streamable, MessageSettings::_String, MessageSettings::_Throw, Module::HeaderExtension, Module::Inline, MEMBER_AS, Module::Messages, Message::Name, Module::Name, and Message::Settings.

Referenced by main().

+ Here is the caller graph for this function:

◆ HeaderFileName()

std::string HeaderFileName ( const Module &  module)

The header file name (name.hh), or "" for NOHEADER.

References Module::HeaderExtension, and Module::Name.

Referenced by main(), WriteCppImplementation(), and WriteCppInterface().

+ Here is the caller graph for this function:

◆ SourceFileName()

std::string SourceFileName ( const Module &  module)

The source file name (name.cpp), or "" for NOSOURCE.

References Module::Name, and Module::SourceExtension.

Referenced by main(), and WriteCppImplementation().

+ Here is the caller graph for this function:

◆ WriteCppInterface()

void WriteCppInterface ( std::ostream &  stream,
const Module &  module,
const std::string &  input 
)

Write the header. input names the message file in the banner.

References Module::Export, GenerationMode::exportMacro, HeaderFileName(), Module::Inline, Mode, and WriteDefinitions().

Referenced by main().

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

◆ WriteCppImplementation()

void WriteCppImplementation ( std::ostream &  stream,
const Module &  module,
const std::string &  input 
)

Write the source. With NOHEADER the declarations are written into it, so it compiles on its own.

References Module::Export, GenerationMode::exportMacro, HeaderFileName(), Mode, SourceFileName(), and WriteDefinitions().

Referenced by main().

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

◆ WriteDefinitions()

void WriteDefinitions ( std::ostream &  stream,
const Module &  module 
)

Includes, helpers and the definitions of every message — the body of the source, or the tail of the header for INLINE.

References Module::Inline, GenerationMode::inlineDefinitions, Module::Messages, Mode, Module::Namespaces, NeedsBuilder(), WriteAppendHelper(), and WriteLocaleMatcher().

Referenced by WriteCppImplementation(), and WriteCppInterface().

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

◆ WriteIfChanged()

bool WriteIfChanged ( const std::string &  path,
const std::string &  content 
)

Write content to path unless the file already holds exactly that — an unchanged message file does not trigger a rebuild.

Returns
true if the file was written.

Referenced by main().

+ Here is the caller graph for this function: