OKlib::Messages::MessagesBase Class Reference

The polymorphic base class for message classes. More...

#include <MessagesBase.hpp>

Inheritance diagram for OKlib::Messages::MessagesBase:
Implementation::M1 OKlib::Messages::demo::Message_1 OKlib::Messages::demo::Message_2 OKlib::Messages::demo::Message_3 OKlib::Messages::demo::Message_3_variation OKlib::Messages::messages::LanguageNames OKlib::Messages::MessagesLines OKlib::Messages::Utilities::TimeDateStandardImplementation OKlib::Messages::Utilities::TrivialMessage< X > OKlib::Messages::Utilities::TrivialMessageC< X > OKlib::TestSystem::messages::RunTestClosing OKlib::TestSystem::messages::RunTestOpening OKlib::TestSystem::messages::SingleTestClosing OKlib::TestSystem::messages::SingleTestOpening

List of all members.

Public Member Functions

virtual std::ostream & print (std::ostream &) const =0
virtual ~MessagesBase ()

Static Public Member Functions

::OKlib::Messages::Languages language (std::ostream &out)
::OKlib::Messages::Strata level (std::ostream &out)
static std::ostream & set (std::ostream &out, const ::OKlib::Messages::Languages lang, const char *const coding=".utf-8")
static std::ostream & set (std::ostream &out, const ::OKlib::Messages::Strata level)

Detailed Description

The polymorphic base class for message classes.

Every message class is derived from MessagesBase.

In each std::ostream object the current language (of type Messages::Languages) and the current level (of type Messages::Strata) are stored, with default values Messages::en_GB and Messages::Basic ; when setting the language of a stream, then also the locale of this stream is set according to the the current language-value.

Message objects (objects of some type publically derived from Messages::MessagesBase) can be inserted into any ostream-object, and their messages will be print according to the language (locale) and level of the stream.

Public member functions are:

  • default constructor, default copy constructor, default copy assignment
  • virtual destructor
  • static Messages::Languages language(ostream& out) : current language of the stream (default is Messages::en_GB )
  • static Messages::Strata level(ostream& out) : current level of the stream (default is Messages::Basic )
  • static ostream& set(ostream& out, Messages::Languages lang, const char* coding = ".utf-8") : set the current language (more precisely, locale) of out together with the prescribed encoding
  • static ostream& set(ostream& out, Messages::Strata level) : set the current level of out.

Pure virtual member functions:

  • ostream& print(ostream& out) : to be implemented by each message class; prints the message in the current language (more precisely, locale) and level.

Non-member functions:

  • ostream& operator <<(ostream& out, const MessagesBase& m) : prints the message by calling m.print(out) .

Definition at line 74 of file MessagesBase.hpp.

Constructor & Destructor Documentation

virtual OKlib::Messages::MessagesBase::~MessagesBase ( ) [inline, virtual]

Definition at line 99 of file MessagesBase.hpp.

Member Function Documentation

::OKlib::Messages::Languages OKlib::Messages::MessagesBase::language ( std::ostream &  out) [inline, static]

Definition at line 101 of file MessagesBase.hpp.

Referenced by main().

::OKlib::Messages::Strata OKlib::Messages::MessagesBase::level ( std::ostream &  out) [inline, static]

Definition at line 104 of file MessagesBase.hpp.

Referenced by main(), OKlib::TestSystem::messages::LogDescription::print(), and set().

static std::ostream& OKlib::Messages::MessagesBase::set ( std::ostream &  out,
const ::OKlib::Messages::Languages  lang,
const char *const  coding = ".utf-8" 
) [inline, static]
static std::ostream& OKlib::Messages::MessagesBase::set ( std::ostream &  out,
const ::OKlib::Messages::Strata  level 
) [inline, static]

Definition at line 115 of file MessagesBase.hpp.

References level().

The documentation for this class was generated from the following file: