mstring  1.3.1
Generates C++ message functions and classes from localized message definitions
MString.cpp File Reference
#include "MString.hh"
#include <algorithm>
#include <cctype>
#include <fstream>
#include <iterator>
#include <ostream>
#include "MException.hh"
#include "MIncludes.hh"
#include "MMessage.hh"
#include "MNamespace.hh"
#include "MText.hh"
#include "MUsing.hh"
+ Include dependency graph for MString.cpp:

Macros

#define MSTRING_VERSION   "unknown"
 

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...
 
string HeaderFileName (const Module &module)
 The header file name (name.hh), or "" for NOHEADER. More...
 
string SourceFileName (const Module &module)
 The source file name (name.cpp), or "" for NOSOURCE. More...
 
void WriteCppInterface (ostream &stream, const Module &module, const string &input)
 Write the header. input names the message file in the banner. More...
 
void WriteCppImplementation (ostream &stream, const Module &module, const string &input)
 Write the source. With NOHEADER the declarations are written into it, so it compiles on its own. More...
 
void WriteDefinitions (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 string &path, const string &content)
 Write content to path unless the file already holds exactly that — an unchanged message file does not trigger a rebuild. More...
 

Macro Definition Documentation

◆ MSTRING_VERSION

#define MSTRING_VERSION   "unknown"

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()

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()

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 ( ostream &  stream,
const Module &  module,
const 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 ( ostream &  stream,
const Module &  module,
const 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 ( 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: