BDE 4.14.0 Production release
Loading...
Searching...
No Matches
ball_severityutil

Detailed Description

Outline

Purpose

Provide a suite of utility functions on ball::Severity levels.

Classes

See also
ball_severity

Description

This component provides a suite of pure procedures that apply to the ball::Severity::Level enumeration. In particular, the ball::SeverityUtil struct provides a fromAsciiCaseless function that returns the ball::Severity::Level enumerator value corresponding to a given ASCII string (without regard to the case of the characters in the string) and an isValidNameCaseless function that confirms that a given string corresponds to one of the enumerators in the ball::Severity::Level enumeration (similarly, without regard to the case of the characters in the string).

Synopsis

The following is a list of functions available in this component:

const char *name);
static bool ball::SeverityUtil::isValidNameCaseless(const char *name);
static int fromAsciiCaseless(Severity::Level *level, const char *name)
static bool isValidNameCaseless(const char *name)
Level
Definition ball_severity.h:167

Usage

This section illustrates intended use of this component.

Example 1: Basic Usage

In this example, we show how to validate that a set of C-style strings correspond to ball::Severity::Level enumerators, and then use those strings to generate enumerator values that, in turn, may be used to administer a logger manager. Here, for convenience, we define our strings in an array, much as how we might receive them from a command line:

const char *argv[] = {
"INFO", // record
"WARN", // pass
"ERROR", // trigger
"FATAL" // trigger-all
};
assert(0 == ball::SeverityUtil::fromAsciiCaseless(&record, argv[0]));
assert(0 == ball::SeverityUtil::fromAsciiCaseless(&pass, argv[1]));
assert(0 == ball::SeverityUtil::fromAsciiCaseless(&trigger, argv[2]));
assert(0 == ball::SeverityUtil::fromAsciiCaseless(&triggerAll, argv[3]));
assert(ball::Severity::e_INFO == record);
assert(ball::Severity::e_WARN == pass);
assert(ball::Severity::e_ERROR == trigger);
assert(ball::Severity::e_FATAL == triggerAll);
@ e_ERROR
Definition ball_severity.h:170
@ e_FATAL
Definition ball_severity.h:169
@ e_INFO
Definition ball_severity.h:172
@ e_WARN
Definition ball_severity.h:171