MySQL++ Reference Manual

MySQL++ SSQLS v2 Translator: ParseV2::Option Class Reference

MySQL++ SSQLS v2 Translator 3.2.4

Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
ParseV2::Option Class Reference

Base class for known SSQLS v2 'option' directives. More...

`#include <parsev2.h>`

Inheritance diagram for ParseV2::Option:
[legend]
Collaboration diagram for ParseV2::Option:
[legend]

## Public Member Functions
virtual | ~Option ()
| Virtual dtor, since this is a base class.
Public Member Functions inherited from ParseV2::Line
virtual | ~Line ()
| Virtual dtor, since this is a base class.
virtual void | print (std::ostream &os) const =0
| Print line's contents out to a stream in SSQLS v2 form.

## Static Public Member Functions
static Option * | parse (const StringList &tl, bool subdirective, const File &file)
| Attempt to create an Option object from information in the passed StringList. More...
Static Public Member Functions inherited from ParseV2::Line
static Line * | parse (const StringList &tl, bool subdirective, const File &file)
| Virtual ctor, creating one of our subclass objects based on what we're passed. More...

## Protected Member Functions
| Option (const std::string &value)
| Protected ctor, so we cannot be directly instantiated. More...
const char * | value () const
| Return the option's value in string form, unmodified from the original parse. More...
Protected Member Functions inherited from ParseV2::Line
| Line ()
| Protected ctor, to prevent instantiation.

## Static Protected Member Functions
static bool | parse_bool (const std::string &value)
| Convert a string expressing a boolean value to a `bool`. More...

## Detailed Description

Base class for known SSQLS v2 'option' directives.

There are subclasses for all known SSQLS v2 options, having the same name, but with different capitalization and an "Option" suffix.

## Constructor & Destructor Documentation

## ◆ Option()

ParseV2::Option::Option | ( | const std::string & | value | ) |
| inlineprotected

Protected ctor, so we cannot be directly instantiated.

Parameters

  value | the option's value

## Member Function Documentation

## ◆ parse()

ParseV2::Option * ParseV2::Option::parse | ( | const StringList & | tl,
|  | bool | subdirective,
|  | const File & | file
| ) |  |
| static

Attempt to create an Option object from information in the passed StringList.

This is a kind of pre-processor for the Option subclass's ctors, creating an object of one of those subclasses only if the given StringList makes sense, passing those values as ctor parameters.

References ParseV2::File::parse_error().

Referenced by ParseV2::Line::parse().

## ◆ parse_bool()

bool ParseV2::Option::parse_bool | ( | const std::string & | value | ) |
| staticprotected

Convert a string expressing a boolean value to a `bool`.

If we cannot recognize the value, we return true because SSQLS v2 options all default to false. The assumption is is that if the option directive is present, the value is most likely truthy.

As a consequence, the only thing this function recognizes is "0", "false", "no", and "off", with any mix of upper and lower case. All else is considered `true`.

## ◆ value()

const char* ParseV2::Option::value | ( |  | ) | const
| inlineprotected

Return the option's value in string form, unmodified from the original parse.

Subclasses typically either expose this function in their public interface with a different, more appropriate name, or they define a wholly different method returning a reduced or more type-safe version of this value.

Referenced by ParseV2::HeaderExtensionOption::extension(), and ParseV2::ImplementationExtensionOption::extension().

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

- parsev2.h
- parsev2.cpp