OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    Interface_MSG Class Reference

    This class gives a set of functions to manage and use a list of translated messages (messagery). More...

    #include <Interface_MSG.hxx>

    Public Member Functions

     Interface_MSG (const char *const keykey)
     A MSG is created to write a "functional code" in conjunction with operator () attached to Value Then, to have a translated message, write in C++ :
     Interface_MSG (const char *const keykey, const int i1)
     Translates a message which contains one integer variable It is just a help which avoid the following : char mess[100]; Sprintf(mess,Interface_MSG("code"),ival); then AddFail(mess); replaced by AddFail (Interface_MSG("code",ival));.
     Interface_MSG (const char *const keykey, const int i1, const int i2)
     Translates a message which contains two integer variables As for one integer, it is just a writing help.
     Interface_MSG (const char *const keykey, const double r1, const int intervals=-1)
     Translates a message which contains one real variable <intervals> if set, commands the variable to be rounded to an interval (see below, method Intervals) As for one integer, it is just a writing help.
     Interface_MSG (const char *const keykey, const char *const str)
     Translates a message which contains one string variable As for one integer, it is just a writing help.
     Interface_MSG (const char *const keykey, const int ival, const char *const str)
     Translates a message which contains one integer and one string variables As for one integer, it is just a writing help Used for instance to say "Param n0.<ival> i.e. <str> is not..".
    void Destroy ()
     Optimised destructor (applies for additional forms of Create).
     ~Interface_MSG ()
    const char * Value () const
     Returns the translated message, in a functional form with operator () was C++ : return const.
     operator const char * () const

    Static Public Member Functions

    static int Read (Standard_IStream &S)
     Reads a list of messages from a stream, returns read count 0 means empty file, -1 means error.
    static int Read (const char *const file)
     Reads a list of messages from a file defined by its name.
    static int Write (Standard_OStream &S, const char *const rootkey="")
     Writes the list of messages recorded to be translated, to a stream. Writes all the list (Default) or only keys which begin by <rootkey>. Returns the count of written messages.
    static bool IsKey (const char *const mess)
     Returns True if a given message is surely a key (according to the form adopted for keys) (before activating messages, answer is false).
    static const char * Translated (const char *const keykey)
     Returns the item recorded for a key. Returns the key itself if :
    static void Record (const char *const keykey, const char *const item)
     Fills the dictionary with a couple (key-item) If a key is already recorded, it is possible to :
    static void SetTrace (const bool toprint, const bool torecord)
     Sets the trace system to work when activated, as follow :
    static void SetMode (const bool running, const bool raising)
     Sets the main modes for MSG :
    static void PrintTrace (Standard_OStream &S)
     Prints the recorded errors (without title; can be empty, this is the normally expected case).
    static double Intervalled (const double valval, const int orderorder=3, const bool upper=false)
     Returns an "intervalled" value from a starting real <val> : i.e. a value which is rounded on an interval limit Interval limits are defined to be in a coarsely "geometric" progression (two successive intervals are inside a limit ratio).
    static void TDate (const char *const text, const int yy, const int mm, const int dd, const int hh, const int mn, const int ss, const char *const formatformat="")
     Codes a date as a text, from its numeric value (-> seconds) : YYYY-MM-DD:HH-MN-SS fixed format, completed by leading zeros Another format can be provided, as follows : C:d ... C like format, preceded by C: S:... format to call system (not yet implemented).
    static bool NDate (const char *const text, int &yy, int &mm, int &dd, int &hh, int &mn, int &ss)
     Decodes a date to numeric integer values Returns True if OK, False if text does not fit with required format. Incomplete forms are allowed (for instance, for only YYYY-MM-DD, hour is zero).
    static int CDate (const char *const text1, const char *const text2)
     Returns a value about comparison of two dates 0 : equal. <0 text1 anterior. >0 text1 posterior.
    static const char * Blanks (const int valval, const int max)
     Returns a blank string, of length between 0 and <max>, to fill the printing of a numeric value <val>, i.e. If val < 10 , max-1 blanks If val between 10 and 99, max-2 blanks ... etc...
    static const char * Blanks (const char *const valval, const int max)
     Returns a blank string, to complete a given string <val> up to <max> characters: If strlen(val) is 0, max blanks If strlen(val) is 5, max-5 blanks etc...
    static const char * Blanks (const int countcount)
     Returns a blank string of <count> blanks (mini 0, maxi 76).
    static void Print (Standard_OStream &S, const char *const valval, const int max, const int just=-1)
     Prints a String on an Output Stream, as follows: Accompanied with blanks, to give up to <max> chars at all, justified accordingly: -1 (D) : left 0 : center 1 : right Maximum 76 characters.

    Detailed Description

    This class gives a set of functions to manage and use a list of translated messages (messagery).

    Keys are strings, their corresponding (i.e. translated) items are strings, managed by a dictionary (a global one).

    If the dictionary is not set, or if a key is not recorded, the key is returned as item, and it is possible to :

    • trace or not this fail, record or not it for further trace

    It is also possible to suspend the translation (keys are then always returned as items)

    This class also provides a file format for loading : It is made of couples of lines, the first one begins by '@' the following is the key, the second one is the message Lines which are empty or which begin by '@' are skipped

    Constructor & Destructor Documentation

    ◆ Interface_MSG() [1/6]

    Interface_MSG::Interface_MSG ( const char *const key)

    A MSG is created to write a "functional code" in conjunction with operator () attached to Value Then, to have a translated message, write in C++ :

    Interface_MSG("...mykey...") which returns a CString See also some help which follow

    ◆ Interface_MSG() [2/6]

    Interface_MSG::Interface_MSG ( const char *const key,
    const int i1 )

    Translates a message which contains one integer variable It is just a help which avoid the following : char mess[100]; Sprintf(mess,Interface_MSG("code"),ival); then AddFail(mess); replaced by AddFail (Interface_MSG("code",ival));.

    The basic message is intended to be in C-Sprintf format, with one d form in it

    ◆ Interface_MSG() [3/6]

    Interface_MSG::Interface_MSG ( const char *const key,
    const int i1,
    const int i2 )

    Translates a message which contains two integer variables As for one integer, it is just a writing help.

    The basic message is intended to be in C-Sprintf format with two d forms in it

    ◆ Interface_MSG() [4/6]

    Interface_MSG::Interface_MSG ( const char *const key,
    const double r1,
    const int intervals = -1 )

    Translates a message which contains one real variable <intervals> if set, commands the variable to be rounded to an interval (see below, method Intervals) As for one integer, it is just a writing help.

    The basic message is intended to be in C-Sprintf format with one f form (or equivalent : e etc) in it

    ◆ Interface_MSG() [5/6]

    Interface_MSG::Interface_MSG ( const char *const key,
    const char *const str )

    Translates a message which contains one string variable As for one integer, it is just a writing help.

    The basic message is intended to be in C-Sprintf format with one s form in it

    ◆ Interface_MSG() [6/6]

    Interface_MSG::Interface_MSG ( const char *const key,
    const int ival,
    const char *const str )

    Translates a message which contains one integer and one string variables As for one integer, it is just a writing help Used for instance to say "Param n0.<ival> i.e. <str> is not..".

    The basic message is intended to be in C-Sprintf format with one d then one s forms in it

    ◆ ~Interface_MSG()

    Interface_MSG::~Interface_MSG ( )
    inline

    Member Function Documentation

    ◆ Blanks() [1/3]

    const char * Interface_MSG::Blanks ( const char *const val,
    const int max )
    static

    Returns a blank string, to complete a given string <val> up to <max> characters: If strlen(val) is 0, max blanks If strlen(val) is 5, max-5 blanks etc...

    ◆ Blanks() [2/3]

    const char * Interface_MSG::Blanks ( const int count)
    static

    Returns a blank string of <count> blanks (mini 0, maxi 76).

    ◆ Blanks() [3/3]

    const char * Interface_MSG::Blanks ( const int val,
    const int max )
    static

    Returns a blank string, of length between 0 and <max>, to fill the printing of a numeric value <val>, i.e. If val < 10 , max-1 blanks If val between 10 and 99, max-2 blanks ... etc...

    ◆ CDate()

    int Interface_MSG::CDate ( const char *const text1,
    const char *const text2 )
    static

    Returns a value about comparison of two dates 0 : equal. <0 text1 anterior. >0 text1 posterior.

    ◆ Destroy()

    void Interface_MSG::Destroy ( )

    Optimised destructor (applies for additional forms of Create).

    ◆ Intervalled()

    double Interface_MSG::Intervalled ( const double val,
    const int order = 3,
    const bool upper = false )
    static

    Returns an "intervalled" value from a starting real <val> : i.e. a value which is rounded on an interval limit Interval limits are defined to be in a coarsely "geometric" progression (two successive intervals are inside a limit ratio).

    <order> gives the count of desired intervals in a range <1-10> <upper> False, returns the first lower interval (D) <upper> True, returns the first upper interval Values of Intervals according <order> : 0,1 : 1 10 100 ... 2 : 1 3 10 30 100 ... 3(D): 1 2 5 10 20 50 100 ... 4 : 1 2 3 6 10 20 30 60 100 ... 6 : 1 1.5 2 3 5 7 10 15 20 ... 10 : 1 1.2 1.5 2 2.5 3 4 5 6 8 10 12 15 20 25 ...

    ◆ IsKey()

    bool Interface_MSG::IsKey ( const char *const mess)
    static

    Returns True if a given message is surely a key (according to the form adopted for keys) (before activating messages, answer is false).

    ◆ NDate()

    bool Interface_MSG::NDate ( const char *const text,
    int & yy,
    int & mm,
    int & dd,
    int & hh,
    int & mn,
    int & ss )
    static

    Decodes a date to numeric integer values Returns True if OK, False if text does not fit with required format. Incomplete forms are allowed (for instance, for only YYYY-MM-DD, hour is zero).

    ◆ operator const char *()

    Interface_MSG::operator const char * ( ) const

    ◆ Print()

    void Interface_MSG::Print ( Standard_OStream & S,
    const char *const val,
    const int max,
    const int just = -1 )
    static

    Prints a String on an Output Stream, as follows: Accompanied with blanks, to give up to <max> chars at all, justified accordingly: -1 (D) : left 0 : center 1 : right Maximum 76 characters.

    ◆ PrintTrace()

    void Interface_MSG::PrintTrace ( Standard_OStream & S)
    static

    Prints the recorded errors (without title; can be empty, this is the normally expected case).

    ◆ Read() [1/2]

    int Interface_MSG::Read ( const char *const file)
    static

    Reads a list of messages from a file defined by its name.

    ◆ Read() [2/2]

    int Interface_MSG::Read ( Standard_IStream & S)
    static

    Reads a list of messages from a stream, returns read count 0 means empty file, -1 means error.

    ◆ Record()

    void Interface_MSG::Record ( const char *const key,
    const char *const item )
    static

    Fills the dictionary with a couple (key-item) If a key is already recorded, it is possible to :

    • keep the last definition, and activate the trace system

    ◆ SetMode()

    void Interface_MSG::SetMode ( const bool running,
    const bool raising )
    static

    Sets the main modes for MSG :

    • if <running> is True, translation works normally
    • if <running> is False, translated item equate keys
    • if <raising> is True, errors (from Record or Translate) cause MSG to raise an exception
    • if <raising> is False, MSG runs without exception, then see also Trace Modes above

    ◆ SetTrace()

    void Interface_MSG::SetTrace ( const bool toprint,
    const bool torecord )
    static

    Sets the trace system to work when activated, as follow :

    • if <toprint> is True, print immediately on standard output
    • if <torecord> is True, record it for further print

    ◆ TDate()

    void Interface_MSG::TDate ( const char *const text,
    const int yy,
    const int mm,
    const int dd,
    const int hh,
    const int mn,
    const int ss,
    const char *const format = "" )
    static

    Codes a date as a text, from its numeric value (-> seconds) : YYYY-MM-DD:HH-MN-SS fixed format, completed by leading zeros Another format can be provided, as follows : C:d ... C like format, preceded by C: S:... format to call system (not yet implemented).

    ◆ Translated()

    const char * Interface_MSG::Translated ( const char *const key)
    static

    Returns the item recorded for a key. Returns the key itself if :

    • it is not recorded (then, the trace system is activated)
    • MSG has been required to be hung on

    ◆ Value()

    const char * Interface_MSG::Value ( ) const

    Returns the translated message, in a functional form with operator () was C++ : return const.

    ◆ Write()

    int Interface_MSG::Write ( Standard_OStream & S,
    const char *const rootkey = "" )
    static

    Writes the list of messages recorded to be translated, to a stream. Writes all the list (Default) or only keys which begin by <rootkey>. Returns the count of written messages.


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