Static Public Member Functions | List of all members
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)
inlinestatic

Definition at line 401 of file FieldConvertors.h.

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

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
)
inlinestatic

Definition at line 420 of file FieldConvertors.h.

422 {
423 bool result = false;
424 if( !convert( value, result ) )
425 throw FieldConvertError(value);
426 else
427 return result;
428 }
static std::string convert(bool value)

References convert().

◆ convert() [3/3]

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

Definition at line 407 of file FieldConvertors.h.

408 {
409 if( value.size() != 1 ) return false;
410 switch( value[0] )
411 {
412 case 'Y': result = true; break;
413 case 'N': result = false; break;
414 default: return false;
415 }
416
417 return true;
418 }

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

Generated on Thu Feb 29 2024 22:38:19 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001