FIX::BoolConvertor Struct Reference

Converts boolean to/from a string. More...

`#include <FieldConvertors.h>`

## Static Public Member Functions

static std::string | convert (bool value)
static bool | convert (const std::string &value, bool &result)
static bool | convert (const std::string &value) throw ( FieldConvertError )

## Detailed Description

Converts boolean to/from a string.

Definition at line 399 of file FieldConvertors.h.

## Member Function Documentation

## convert() [1/3]

static std::string FIX::BoolConvertor::convert | ( | bool | value | ) |

inline static

Definition at line 401 of file FieldConvertors.h.

{
const char ch = value ? 'Y' : 'N';
return std::string( 1, ch );
}

Referenced by FIX::DataDictionary::checkValidFormat(), convert(), FIX::Dictionary::getBool(), FIX::BoolField::getValue(), FIX::Dictionary::setBool(), and FIX::BoolField::setValue().

## convert() [2/3]

static bool FIX::BoolConvertor::convert | ( | const std::string & | value | ) |
throw | ( | FieldConvertError
| ) |  |

inline static

Definition at line 420 of file FieldConvertors.h.

{
bool result = false;
if( !convert( value, result ) )
throw FieldConvertError(value);
else
return result;
}
FIX::BoolConvertor::convert
static std::string convert(bool value)
Definition FieldConvertors.h:401

References convert().

## convert() [3/3]

static bool FIX::BoolConvertor::convert | ( | const std::string & | value,
|  | bool & | result
| ) |  |

inline static

Definition at line 407 of file FieldConvertors.h.

{
if( value.size() != 1 ) return false;
switch( value[0] )
{
case 'Y': result = true; break;
case 'N': result = false; break;
default: return false;
}
return true;
}

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

- FieldConvertors.h