BDE 4.14.0 Production release
Loading...
Searching...
No Matches
baljsn::ParserUtil Struct Reference

#include <baljsn_parserutil.h>

Public Types

typedef bdlb::Variant2< bdlt::Date, bdlt::DateTzDateOrDateTz
 
typedef bdlb::Variant2< bdlt::Time, bdlt::TimeTzTimeOrTimeTz
 
typedef bdlb::Variant2< bdlt::Datetime, bdlt::DatetimeTzDatetimeOrDatetimeTz
 

Static Public Member Functions

static int getQuotedString (bsl::string *value, const bsl::string_view &data)
 
static int getUnquotedString (bsl::string *value, const bsl::string_view &data)
 
static int getValue (bool *value, const bsl::string_view &data)
 
static int getValue (char *value, const bsl::string_view &data)
 
static int getValue (unsigned char *value, const bsl::string_view &data)
 
static int getValue (signed char *value, const bsl::string_view &data)
 
static int getValue (short *value, const bsl::string_view &data)
 
static int getValue (unsigned short *value, const bsl::string_view &data)
 
static int getValue (int *value, const bsl::string_view &data)
 
static int getValue (unsigned int *value, const bsl::string_view &data)
 
static int getValue (bsls::Types::Int64 *value, const bsl::string_view &data)
 
static int getValue (bsls::Types::Uint64 *value, const bsl::string_view &data)
 
static int getValue (float *value, const bsl::string_view &data)
 
static int getValue (double *value, const bsl::string_view &data)
 
static int getValue (bdldfp::Decimal64 *value, const bsl::string_view &data)
 
static int getValue (bdlt::Date *value, const bsl::string_view &data)
 
static int getValue (bdlt::Datetime *value, const bsl::string_view &data)
 
static int getValue (bdlt::DatetimeTz *value, const bsl::string_view &data)
 
static int getValue (bdlt::DateTz *value, const bsl::string_view &data)
 
static int getValue (bdlt::Time *value, const bsl::string_view &data)
 
static int getValue (bdlt::TimeTz *value, const bsl::string_view &data)
 
static int getValue (DateOrDateTz *value, const bsl::string_view &data)
 
static int getValue (TimeOrTimeTz *value, const bsl::string_view &data)
 
static int getValue (DatetimeOrDatetimeTz *value, const bsl::string_view &data)
 
static int getValue (bsl::vector< char > *value, const bsl::string_view &data)
 
static int getValue (bsl::string *value, const bsl::string_view &data)
 
static bool stripQuotes (bsl::string_view *str)
 

Detailed Description

This class provides utility functions for decoding data in the JSON format into a bdeat Simple type. The primary method is getValue, which decodes into a specified object and is overloaded for all bdeat Simple types.

Member Typedef Documentation

◆ DateOrDateTz

DateOrDateTz is a convenient alias for bdlb::Variant2<Date, DateTz>.

◆ DatetimeOrDatetimeTz

DatetimeOrDatetimeTz is a convenient alias for bdlb::Variant2<Datetime, DatetimeTz>.

◆ TimeOrTimeTz

TimeOrTimeTz is a convenient alias for bdlb::Variant2<Time, TimeTz>.

Member Function Documentation

◆ getQuotedString()

int baljsn::ParserUtil::getQuotedString ( bsl::string value,
const bsl::string_view data 
)
inlinestatic

Load into the specified value the string value in the specified data. The string must be begin and end in " characters which are not part of the resulting value. Return 0 on success and a non-zero value otherwise.

◆ getUnquotedString()

static int baljsn::ParserUtil::getUnquotedString ( bsl::string value,
const bsl::string_view data 
)
static

Load into the specified value the string value in the specified data. Return 0 on success and a non-zero value otherwise.

◆ getValue() [1/24]

static int baljsn::ParserUtil::getValue ( bdldfp::Decimal64 value,
const bsl::string_view data 
)
static

◆ getValue() [2/24]

int baljsn::ParserUtil::getValue ( bdlt::Date value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [3/24]

int baljsn::ParserUtil::getValue ( bdlt::Datetime value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [4/24]

int baljsn::ParserUtil::getValue ( bdlt::DatetimeTz value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [5/24]

int baljsn::ParserUtil::getValue ( bdlt::DateTz value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [6/24]

int baljsn::ParserUtil::getValue ( bdlt::Time value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [7/24]

int baljsn::ParserUtil::getValue ( bdlt::TimeTz value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [8/24]

static int baljsn::ParserUtil::getValue ( bool *  value,
const bsl::string_view data 
)
static

◆ getValue() [9/24]

int baljsn::ParserUtil::getValue ( bsl::string value,
const bsl::string_view data 
)
inlinestatic

Load into the specified value the string value in the specified data. The string must be begin and end in " characters which are not part of the resulting value. Return 0 on success and a non-zero value otherwise.

◆ getValue() [10/24]

static int baljsn::ParserUtil::getValue ( bsl::vector< char > *  value,
const bsl::string_view data 
)
static

Load into the specified value the characters read from the specified data. Return 0 on success or a non-zero value on failure.

◆ getValue() [11/24]

int baljsn::ParserUtil::getValue ( bsls::Types::Int64 value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [12/24]

int baljsn::ParserUtil::getValue ( bsls::Types::Uint64 value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [13/24]

int baljsn::ParserUtil::getValue ( char *  value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [14/24]

int baljsn::ParserUtil::getValue ( DateOrDateTz value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [15/24]

static int baljsn::ParserUtil::getValue ( DatetimeOrDatetimeTz value,
const bsl::string_view data 
)
static

◆ getValue() [16/24]

static int baljsn::ParserUtil::getValue ( double *  value,
const bsl::string_view data 
)
static

◆ getValue() [17/24]

int baljsn::ParserUtil::getValue ( float *  value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [18/24]

int baljsn::ParserUtil::getValue ( int *  value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [19/24]

int baljsn::ParserUtil::getValue ( short *  value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [20/24]

int baljsn::ParserUtil::getValue ( signed char *  value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [21/24]

static int baljsn::ParserUtil::getValue ( TimeOrTimeTz value,
const bsl::string_view data 
)
static

◆ getValue() [22/24]

int baljsn::ParserUtil::getValue ( unsigned char *  value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [23/24]

int baljsn::ParserUtil::getValue ( unsigned int *  value,
const bsl::string_view data 
)
inlinestatic

◆ getValue() [24/24]

int baljsn::ParserUtil::getValue ( unsigned short *  value,
const bsl::string_view data 
)
inlinestatic

◆ stripQuotes()

static bool baljsn::ParserUtil::stripQuotes ( bsl::string_view str)
static

If the specified *str is at least two characters long and begins and ends with quotation marks ("), then remove the first and last characters; otherwise, do not modify *str. Return true if *str was modified.


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