CC Localization
Enumerations | Functions | Variables
utils.cc File Reference

Miscellaneous utilities. More...

#include "utils.hh"
#include <iostream>
Include dependency graph for utils.cc:

Go to the source code of this file.

Enumerations

enum  MsgLevel {
  MSGL_ERROR = 0, MSGL_WARN = 1, MSGL_INFO = 2, MSGL_DEBUG = 9,
  MSGL_ALL = 10
}
 Message levels.
 

Functions

std::string esc_str (std::string const &s)
 Produce an escaped string that, when double quoted, produces the original. More...
 
std::ostream & msg (int l)
 message output stream More...
 
void error (std::string const &m)
 throw an Error with given message string More...
 

Variables

int msg_level = MSGL_INFO
 level below which messages are shown More...
 
std::ostream & debug = msg(MSGL_DEBUG)
 stream for debug messages More...
 
std::ostream & info = msg(MSGL_INFO)
 stream for informative messages More...
 
std::ostream & warn = msg(MSGL_WARN)
 stream for warning messages More...
 

Detailed Description

Miscellaneous utilities.

Author
Chun-Chung Chen <cjj@u.nosp@m..was.nosp@m.hingt.nosp@m.on.e.nosp@m.du>

Definition in file utils.cc.

Function Documentation

◆ error()

void error ( std::string const &  m)

throw an Error with given message string

throw error after error message

Definition at line 58 of file utils.cc.

◆ esc_str()

std::string esc_str ( std::string const &  s)

Produce an escaped string that, when double quoted, produces the original.

escape a string in a way that when double quoted, recovers original

Parameters
sstring to be escaped

Definition at line 9 of file utils.cc.

◆ msg()

std::ostream& msg ( int  l)

message output stream

message stream with given level

Definition at line 48 of file utils.cc.

Variable Documentation

◆ debug

std::ostream& debug = msg(MSGL_DEBUG)

stream for debug messages

ostream for debugging message

Definition at line 53 of file utils.cc.

◆ info

std::ostream& info = msg(MSGL_INFO)

stream for informative messages

ostream informative message

Definition at line 54 of file utils.cc.

◆ msg_level

int msg_level = MSGL_INFO

level below which messages are shown

message level to display

Definition at line 46 of file utils.cc.

◆ warn

std::ostream& warn = msg(MSGL_WARN)

stream for warning messages

ostream warning message

Definition at line 55 of file utils.cc.