BDE 4.39.x Production Release
Loading...
Searching...
No Matches
baljsn::EncodeImplUtil_SelectionDispatcher< FORMATTER > Class Template Reference

#include <baljsn_encodeimplutil.h>

Detailed Description

template<class FORMATTER>
class baljsn::EncodeImplUtil_SelectionDispatcher< FORMATTER >

This component-private class provides a function object that closes over the formatter, logStream, and options parameters that are shared between all encoding operations provided in this component. The function-call operator of this class provides an overload set that accepts a "selection" object that satisfies one of the bdlat type-category concepts, and an optional bdlat_TypeCategory tag type that corresponds to the selections's bdlat type category. Each function-call-operator overload encodes a JSON representation of the specified selection to the formatter supplied on construction.

See baljsn_encodeimplutil

Public Types

typedef int FormattingMode
 

Public Member Functions

 EncodeImplUtil_SelectionDispatcher (FORMATTER *formatter, bsl::ostream *logStream, const bsl::string_view &selectionName, FormattingMode formattingMode, bool isNextObjectFirst, const EncoderOptions &options)
 
template<class TYPE >
int operator() (const TYPE &selection, bdlat_TypeCategory::CustomizedType category)
 
template<class TYPE >
int operator() (const TYPE &selection, bdlat_TypeCategory::DynamicType category)
 
template<class TYPE , class CATEGORY >
int operator() (const TYPE &selection, CATEGORY category)
 
template<class TYPE >
int operator() (const TYPE &, bslmf::Nil)
 
bool isNextObjectFirst () const
 

Member Typedef Documentation

◆ FormattingMode

template<class FORMATTER >
typedef int baljsn::EncodeImplUtil_SelectionDispatcher< FORMATTER >::FormattingMode

FormattingMode is an alias to the type of an int-valued bdlat_FormattingMode bit-field. A FormattingMode value is not valid unless it is equal to an enumerator of bdlat_FormattingMode or a valid bitwise-or of two or more such enumerators. See the component-level documentation of bdlat_formattingmode for a description of the set of valid formatting-mode values.

Constructor & Destructor Documentation

◆ EncodeImplUtil_SelectionDispatcher()

template<class FORMATTER >
baljsn::EncodeImplUtil_SelectionDispatcher< FORMATTER >::EncodeImplUtil_SelectionDispatcher ( FORMATTER *  formatter,
bsl::ostream *  logStream,
const bsl::string_view selectionName,
FormattingMode  formattingMode,
bool  isNextObjectFirst,
const EncoderOptions options 
)
inline

Construct an EncodeImplUtil_SelectionDispatcher object having the specified formatter, logStream, and options attributes.

Member Function Documentation

◆ isNextObjectFirst()

template<class FORMATTER >
bool baljsn::EncodeImplUtil_SelectionDispatcher< FORMATTER >::isNextObjectFirst ( ) const
inline

Return the value of the isNextElementFirst attribute of this object.

◆ operator()() [1/4]

template<class FORMATTER >
template<class TYPE >
int baljsn::EncodeImplUtil_SelectionDispatcher< FORMATTER >::operator() ( const TYPE &  ,
bslmf::Nil   
)
inline

The behavior of this function is undefined.

◆ operator()() [2/4]

template<class FORMATTER >
template<class TYPE >
int baljsn::EncodeImplUtil_SelectionDispatcher< FORMATTER >::operator() ( const TYPE &  selection,
bdlat_TypeCategory::CustomizedType  category 
)
inline

Encode the JSON representation of the specified selection, having the name equal to the name attribute of the specified selectionInfo to the JSON formatter attribute of this object, according to the specified formattingMode. If the representation contains no text and isFirstSubObject is true, load the value true into the specified isNextObjectFirst, and the value false otherwise. If isFirstSubObject is true, then the representation of the selection contains no leading sequence delimiter, and does contain such a delimiter otherwise. The options attribute of this object configures aspects of the JSON representation of the selection. If this operation is not successful, load an unspecified, human-readable description of the error condition to the logStream attribute of this object. Return 0 on success, and a non-zero value otherwise.

Precondition
The behavior is undefined unless the selection satisfies both the static and dynamic requirements of the bdlat type-category concept corresponding to the specified category. See the component-level documentation of baljsn_encoderoptions for a description of the effects, if any, of each option in the options on the JSON representation of the selection. See the package-level documentation of {bdlat} for an introduction to the requirements of bdlat type-category concepts.

◆ operator()() [3/4]

template<class FORMATTER >
template<class TYPE >
int baljsn::EncodeImplUtil_SelectionDispatcher< FORMATTER >::operator() ( const TYPE &  selection,
bdlat_TypeCategory::DynamicType  category 
)
inline

◆ operator()() [4/4]

template<class FORMATTER >
template<class TYPE , class CATEGORY >
int baljsn::EncodeImplUtil_SelectionDispatcher< FORMATTER >::operator() ( const TYPE &  selection,
CATEGORY  category 
)
inline

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