8#ifndef INCLUDED_BALXML_DECODER
9#define INCLUDED_BALXML_DECODER
291#include <balscm_version.h>
328#include <bsl_algorithm.h>
329#include <bsl_istream.h>
331#include <bsl_ostream.h>
332#include <bsl_streambuf.h>
333#include <bsl_string.h>
334#include <bsl_vector.h>
335#include <bsl_cstddef.h>
336#include <bsl_cstring.h>
337#include <bsl_cstdlib.h>
338#include <bsl_cerrno.h>
340#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
384 bsl::size_t lenValue,
418 class MemOutStream :
public bsl::ostream {
423 MemOutStream(
const MemOutStream&);
424 MemOutStream& operator=(
const MemOutStream&);
446 const
char *
data() const;
461 bslma::Allocator *d_allocator;
464 bsls::ObjectBuffer<MemOutStream> d_logArea;
468 MemOutStream *d_logStream;
470 bsl::ostream *d_errorStream;
471 bsl::ostream *d_warningStream;
473 bsl::
string d_sourceUri;
477 int d_numUnknownElementsSkipped;
484 int d_remainingDepth;
496 bsl::ostream& logStream();
499 int checkForReaderErrors();
500 int checkForErrors(const
ErrorInfo& errInfo);
505 template <class TYPE>
506 int validateTopElement(const TYPE *
object);
508 void setDecoderError(
ErrorInfo::Severity severity,
bsl::string_view msg);
510 int readTopElement();
513 template <class TYPE>
514 int decodeCustomized(TYPE *
object,
int formattingMode);
516 template <class TYPE>
519 template <class TYPE>
522 template <class TYPE>
525 template <class TYPE, class ANY_CATEGORY>
526 int decodeImp(TYPE *
object, ANY_CATEGORY);
533 bslma::Allocator *basicAllocator);
551 bslma::Allocator *basicAllocator = 0);
566 int open(
bsl::istream& stream, const
char *uri = 0);
572 int open(
bsl::streambuf *buffer, const
char *uri = 0);
584 int open(const
char *filename);
594 template <class TYPE>
597 const
char *uri = 0);
606 template <class TYPE>
607 int decode(
bsl::streambuf *buffer, TYPE *
object, const
char *uri = 0);
617 template <class TYPE>
618 int decode(const
char *buffer,
621 const
char *uri = 0);
628 template <class TYPE>
629 int decode(const
char *filename, TYPE *
object);
640 template <class TYPE>
655 template <class TYPE>
658 const
char *uri = 0);
660 bdlar::AnyRef *
object,
661 const
char *uri = 0);
674 template <class TYPE>
675 int decodeAny(
bsl::streambuf *buffer, TYPE *
object, const
char *uri = 0);
677 bdlar::AnyRef *
object,
678 const
char *uri = 0);
693 template <class TYPE>
763 Decoder::MemOutStream d_stream;
777 : d_stream(decoder->d_allocator)
778 , d_severity(severity)
787 d_decoder->setDecoderError(d_severity,
805#define BALXML_DECODER_LOG_ERROR(reporter) \
807 balxml::Decoder_ErrorLogger \
808 logger(balxml::ErrorInfo::e_ERROR, reporter); \
813#define BALXML_DECODER_LOG_WARNING(reporter) \
815 balxml::Decoder_ErrorLogger \
816 logger(balxml::ErrorInfo::e_WARNING, reporter); \
821#define BALXML_DECODER_LOG_END \
830class Decoder_ElementContext;
833class Decoder_ChoiceContext;
834template <
class TYPE,
class PARSER>
835class Decoder_PushParserContext;
837class Decoder_SequenceContext;
839class Decoder_SimpleContext;
841class Decoder_UTF8Context;
843class Decoder_UnknownElementContext;
845class Decoder_StdStringContext;
846class Decoder_StdVectorCharContext;
920 template <
class INPUT_ITERATOR>
938template <
class CATEGORY,
class TYPE>
1006template <
class TYPE>
1028template <
class TYPE>
1032 bool d_isSelectionNameKnown;
1034 bool d_selectionIsRepeatable;
1054 int addCharacters(
const char *chars,
1058 int parseAttribute(
const char *name,
1060 bsl::size_t lenValue,
1063 int parseSubElement(
const char *elementName,
1101 int addCharacters(const
char *chars,
1105 int parseAttribute(const
char *name,
1107 bsl::
size_t lenValue,
1110 int parseSubElement(const
char *elementName,
1140template <class TYPE, class PARSER>
1144 int d_formattingMode;
1165 int addCharacters(
const char *chars,
1169 int parseAttribute(
const char *name,
1171 bsl::size_t lenValue,
1174 int parseSubElement(
const char *elementName,
1187template <
class TYPE>
1211 int addCharacters(
const char *chars,
1215 int parseAttribute(
const char *name,
1217 bsl::size_t lenValue,
1220 int parseSubElement(
const char *elementName,
1233template <
class TYPE>
1238 int d_formattingMode;
1258 int addCharacters(
const char *chars,
1262 int parseAttribute(
const char *name,
1264 bsl::size_t lenValue,
1267 int parseSubElement(
const char *elementName,
1307 bsl::size_t lenValue,
1323template <
class TYPE>
1346 int addCharacters(
const char *chars,
1350 int parseAttribute(
const char *name,
1352 bsl::size_t lenValue,
1355 int parseSubElement(
const char *elementName,
1409 int addCharacters(const
char *chars,
1413 int parseAttribute(const
char *name,
1415 bsl::
size_t lenValue,
1418 int parseSubElement(const
char *elementName,
1471 int formattingMode);
1480 int addCharacters(const
char *chars,
1484 int parseAttribute(const
char *name,
1486 bsl::
size_t lenValue,
1489 int parseSubElement(const
char *elementName,
1524 template <
class TYPE,
class INFO_TYPE>
1525 int operator()(
const TYPE &
object,
const INFO_TYPE &info);
1541 const char *d_chars_p;
1562 template <
class TYPE,
class INFO_TYPE>
1563 int operator()(TYPE *
object,
const INFO_TYPE& info);
1565 template <
class INFO_TYPE>
1566 int operator()(
bsl::string *
object,
const INFO_TYPE& info);
1582 const char *d_elementName_p;
1583 bsl::size_t d_lenName;
1594 const char *elementName,
1595 bsl::size_t lenName);
1601 template <
class TYPE,
class INFO_TYPE>
1602 int operator()(TYPE *
object,
const INFO_TYPE &info);
1604 template <
class TYPE>
1605 int execute(TYPE *
object,
int id,
int formattingMode);
1623 const char *d_name_p;
1624 const char *d_value_p;
1625 bsl::size_t d_value_length;
1629 template <
class TYPE>
1630 int executeImp(TYPE *
object,
1633 template <
class TYPE>
1634 int executeImp(TYPE *
object,
1637 template <
class TYPE,
class ANY_CATEGORY>
1638 int executeImp(TYPE *
object,
int formattingMode, ANY_CATEGORY);
1651 bsl::size_t lengthValue);
1657 template <
class TYPE,
class INFO_TYPE>
1658 int operator()(TYPE *
object,
const INFO_TYPE& info);
1660 template <
class TYPE>
1661 int execute(TYPE *
object,
int formattingMode);
1664 bool failed()
const;
1679 struct CanBeListOrRepetition { };
1680 struct CanBeRepetitionOnly { };
1684 const char *d_elementName_p;
1685 bsl::size_t d_lenName;
1698 template <
class TYPE>
1703 template <
class TYPE>
1704 int executeImp(TYPE *
object,
1708 template <
class TYPE>
1709 int executeImp(TYPE *
object,
1713 template <
class TYPE>
1714 int executeImp(TYPE *
object,
1718 template <
class TYPE>
1719 int executeImp(TYPE *
object,
1723 template <
class TYPE>
1724 int executeImp(TYPE *
object,
1728 template <
class TYPE>
1729 int executeImp(TYPE *
object,
1733 template <
class TYPE,
class ANY_CATEGORY>
1734 int executeImp(TYPE *
object,
int formattingMode, ANY_CATEGORY);
1736 template <
class TYPE>
1737 int executeArrayImp(TYPE *
object,
1739 CanBeListOrRepetition);
1741 template <
class TYPE>
1742 int executeArrayImp(TYPE *
object,
int formattingMode, CanBeRepetitionOnly);
1744 template <
class TYPE>
1745 int executeArrayRepetitionImp(TYPE *
object,
int formattingMode);
1750 const char *elementName,
1751 bsl::size_t lenName);
1757 template <
class TYPE,
class INFO_TYPE>
1758 int operator()(TYPE *
object,
const INFO_TYPE &info);
1760 template <
class TYPE>
1761 int execute(TYPE *
object,
int formattingMode);
1774 int d_formattingMode;
1783 template <
class TYPE>
1786 template <
class TYPE>
1789 template <
class TYPE>
1792 template <
class TYPE,
class ANY_CATEGORY>
1793 int executeImp(TYPE *
object, ANY_CATEGORY);
1810 template <
class TYPE>
1811 int operator()(TYPE *
object);
1841 template <
class TYPE>
1849 template <
class TYPE,
class ANY_CATEGORY>
1853 return d_decoder->decodeImp(
object, category);
1876 template <
class TYPE>
1880 return d_instance_p->
execute(
object, d_formattingMode);
1903 template <
class TYPE>
1911 template <
class TYPE,
class ANY_CATEGORY>
1915 return d_instance_p->
executeImp(
object, d_formattingMode, category);
1938 template <
class TYPE>
1942 return d_instance_p->
execute(
object, d_formattingMode);
1965 template <
class TYPE>
1973 template <
class TYPE,
class ANY_CATEGORY>
1977 return d_instance_p->
executeImp(
object, d_formattingMode, category);
1999 template <
class TYPE>
2007 template <
class TYPE,
class ANY_CATEGORY>
2011 return d_instance_p->
executeImp(
object, category);
2027, d_sb(
bslma::Default::allocator(basicAllocator))
2049 return (
int)d_sb.length();
2054void Decoder::setNumUnknownElementsSkipped(
int value)
2058 d_numUnknownElementsSkipped = value;
2084bsl::ostream *Decoder::errorStream()
const
2086 return d_errorStream;
2090int Decoder::numUnknownElementsSkipped()
const
2092 return d_numUnknownElementsSkipped;
2096bsl::ostream *Decoder::warningStream()
const
2098 return d_warningStream;
2102int Decoder::errorCount()
const
2104 return d_errorCount;
2108int Decoder::warningCount()
const
2110 return d_warningCount;
2118template <
class TYPE>
2120int Decoder::validateTopElement(
const TYPE *
object) {
2123 if (!d_options->validateRootTag()) {
2136 if (0 == typeName) {
2141 const char *nodeName = d_reader->nodeName();
2142 if (0 == strcmp(nodeName, typeName)) {
2147 <<
"The root object is of type '" << nodeName <<
"',"
2148 <<
" but we're attempting to decode an object of type "
2155int Decoder::open(bsl::istream& stream,
const char *uri)
2157 return open(stream.rdbuf(), uri);
2160template <
class TYPE>
2161bsl::istream& Decoder::decode(bsl::istream& stream,
2165 if (!stream.good()) {
2168 <<
"The input stream is invalid. "
2169 <<
"Unable to decode XML object. "
2175 if (0 != this->decode(stream.rdbuf(),
object, uri)) {
2176 stream.setstate(bsl::ios_base::failbit);
2182template <
class TYPE>
2184Decoder::decode(bsl::streambuf *buffer, TYPE *
object,
const char *uri)
2186 if (this->open(buffer, uri) != 0) {
2188 return this->errorCount();
2192 int ret = validateTopElement(
object);
2194 ret = this->decode(
object);
2197 switch(errorSeverity()) {
2198 case ErrorInfo::e_NO_ERROR:
2200 case ErrorInfo::e_WARNING:
2201 if (d_warningStream) {
2202 *d_warningStream << loggedMessages();
2206 if (d_errorStream) {
2207 *d_errorStream << loggedMessages();
2216template <
class TYPE>
2217int Decoder::decode(
const char *buffer,
2222 if (this->open(buffer, buflen, uri) != 0) {
2224 return this->errorCount();
2227 int ret = validateTopElement(
object);
2229 ret = this->decode(
object);
2236template <
class TYPE>
2237int Decoder::decode(
const char *filename, TYPE *
object)
2239 if (this->open(filename) != 0) {
2241 return this->errorCount();
2244 int ret = validateTopElement(
object);
2246 ret = this->decode(
object);
2253template <
class TYPE>
2255int Decoder::decode(TYPE *
object)
2262 this->decodeImp(
object, TypeCategory());
2264 return this->errorCount();
2267template <
class TYPE>
2269bsl::istream& Decoder::decodeAny(bsl::istream& stream,
2274 return decodeAny(stream, &ref, uri);
2277template <
class TYPE>
2279int Decoder::decodeAny(bsl::streambuf *buffer, TYPE *
object,
const char *uri)
2282 return decodeAny(buffer, &ref, uri);
2285template <
class TYPE>
2287int Decoder::decodeAny(TYPE *
object)
2290 return decodeAny(&ref);
2293template <
class TYPE>
2301 <<
"The object being decoded is a 'DynamicType', and "
2302 "attempting to manipulate the object by its dynamic "
2303 "category returned a non-zero status."
2317 template <
class t_BASE_TYPE>
2322 BaseContext ctx(base, d_formattingMode);
2323 return ctx.beginParse(d_that);
2327template <
class TYPE>
2329int Decoder::decodeCustomized(TYPE *
object,
int formattingMode)
2331 CustomizedManipulator baseManipulator = {
this, formattingMode};
2337template <
class TYPE>
2341 return decodeCustomized(
object, d_options->formattingMode());
2344template <
class TYPE>
2351template <
class TYPE,
class ANY_CATEGORY>
2353int Decoder::decodeImp(TYPE *
object, ANY_CATEGORY)
2356 Decoder_InstantiateContext<ANY_CATEGORY, TYPE>::Type ContextType;
2358 ContextType elementContext(
object, d_options->formattingMode());
2360 return elementContext.beginParse(
this);
2367template <
class TYPE>
2371: d_isSelectionNameKnown(false)
2373, d_selectionIsRepeatable(false)
2376 (void) formattingMode;
2383template <
class TYPE>
2386 enum { k_SUCCESS = 0 };
2388 d_isSelectionNameKnown =
false;
2393template <
class TYPE>
2396 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2398 if (!d_isSelectionNameKnown) {
2400 <<
"No elements selected in choice."
2409template <
class TYPE>
2414 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2418 const char *begin = chars;
2419 const char *end = begin + length;
2425 <<
"Invalid characters \""
2427 <<
"\" when parsing choice."
2436template <
class TYPE>
2443 enum { k_ATTRIBUTE_IGNORED = 0 };
2445 return k_ATTRIBUTE_IGNORED;
2448template <
class TYPE>
2452 enum { k_FAILURE = -1 };
2454 const int lenName =
static_cast<int>(bsl::strlen(elementName));
2456 if (d_isSelectionNameKnown
2457 && (!d_selectionIsRepeatable || d_selectionName != elementName))
2460 <<
"Only one selection is permitted inside choice."
2466 bool wasSelectionNameKnown = d_isSelectionNameKnown;
2467 d_isSelectionNameKnown =
true;
2475 d_selectionIsRepeatable =
true;
2476 d_selectionName.assign(elementName, lenName);
2482 if (!wasSelectionNameKnown) {
2487 <<
"Unable to make selection: \""
2495 d_selectionIsRepeatable =
true;
2496 d_selectionName.assign(elementName, lenName);
2508template <
class TYPE,
class PARSER>
2513: d_formattingMode(formattingMode), d_object_p(object)
2519template <
class TYPE,
class PARSER>
2522 int result = d_parser.beginParse(d_object_p);
2526 <<
"Unable to begin parsing list or binary type"
2535template <
class TYPE,
class PARSER>
2538 int result = d_parser.endParse();
2542 <<
"Unable to end parsing list or binary type"
2550template <
class TYPE,
class PARSER>
2556 const char *begin = chars;
2557 const char *end = begin + length;
2559 int result = d_parser.pushCharacters(begin, end);
2563 <<
"Unable to push \"" << chars
2564 <<
"\" when parsing list or binary type"
2573template <
class TYPE,
class PARSER>
2580 enum { k_ATTRIBUTE_IGNORED = 0 };
2582 return k_ATTRIBUTE_IGNORED;
2585template <
class TYPE,
class PARSER>
2587 const char *elementName,
2590 enum { k_FAILURE = -1 };
2593 <<
"Unexpected sub-element \"" << elementName
2594 <<
"\" when parsing list or binary type"
2606template <
class TYPE>
2612 (void) formattingMode;
2622 d_simpleContentId.reset();
2627template <
class TYPE>
2636 prepareSequenceContext);
2640 <<
"Unable to prepare sequence context!"
2647template <
class TYPE>
2650 enum { k_SUCCESS = 0 };
2655template <
class TYPE>
2660 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2664 if (d_simpleContentId.isNull()) {
2666 const char *begin = chars;
2667 const char *end = begin + length;
2673 <<
"Unexpected characters: \""
2690 d_simpleContentId.value());
2693template <
class TYPE>
2696 bsl::size_t lenValue,
2699 enum { k_SUCCESS = 0, k_ATTRIBUTE_IGNORED = 0, k_FAILURE = -1 };
2701 const int lenName =
static_cast<int>(bsl::strlen(name));
2712 return k_ATTRIBUTE_IGNORED;
2718template <
class TYPE>
2722 enum { k_FAILURE = -1 };
2724 const int lenName =
static_cast<int>(bsl::strlen(elementName));
2749template <
class TYPE>
2753: d_formattingMode(formattingMode)
2760template <
class TYPE>
2763 enum { k_SUCCESS = 0 };
2770template <
class TYPE>
2773 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2778template <
class TYPE>
2783 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2785 const char *begin = chars;
2786 const char *end = begin + length;
2792 static_cast<int>(end - begin),
2793 d_formattingMode)) {
2795 <<
"Unable to parse \""
2797 <<
"\" when parsing list or binary type"
2807template <
class TYPE>
2814 enum { k_ATTRIBUTE_IGNORED = 0 };
2816 return k_ATTRIBUTE_IGNORED;
2819template <
class TYPE>
2823 enum { k_FAILURE = -1 };
2826 <<
"Attempted to create sub context for \""
2827 << elementName <<
"\" inside simple type"
2840template <
class TYPE>
2849template <
class TYPE>
2853 enum { k_SUCCESS = 0 };
2855 d_object_p->clear();
2860template <
class TYPE>
2864 enum { k_SUCCESS = 0 };
2869template <
class TYPE>
2875 enum { k_SUCCESS = 0 };
2877 d_object_p->insert(d_object_p->end(), chars, chars + length);
2882template <
class TYPE>
2889 enum { k_ATTRIBUTE_IGNORED = 0 };
2891 return k_ATTRIBUTE_IGNORED;
2894template <
class TYPE>
2898 enum { k_FAILURE = -1 };
2901 <<
"Attempted to create sub context for \""
2902 << elementName <<
"\" inside UTF8 type."
2914Decoder_PrepareSequenceContext::Decoder_PrepareSequenceContext(
2916: d_simpleContentId_p(simpleContentId)
2918 d_simpleContentId_p->reset();
2922template <
class TYPE,
class INFO_TYPE>
2924 const INFO_TYPE& info)
2926 enum { k_SUCCESS = 0 };
2930 d_simpleContentId_p->
makeValue(info.id());
2942Decoder_ParseSequenceSimpleContent::Decoder_ParseSequenceSimpleContent(
2946: d_chars_p(chars), d_len(len), d_decoder(decoder)
2953template <
class TYPE,
class INFO_TYPE>
2955 const INFO_TYPE& info)
2960 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2962 const char *begin = d_chars_p;
2963 const char *end = begin + d_len;
2969 static_cast<int>(end - begin),
2970 info.formattingMode())) {
2972 <<
"Unable to parse \""
2974 <<
"\" within simple content"
2985template <
class INFO_TYPE>
2988 const INFO_TYPE& info)
2990 enum { k_SUCCESS = 0 };
2997 object->assign(d_chars_p, d_len);
3008Decoder_ParseSequenceSubElement::Decoder_ParseSequenceSubElement(
3010 const char *elementName,
3011 bsl::size_t lenName)
3012: d_decoder(decoder), d_elementName_p(elementName), d_lenName(lenName)
3017template <
class TYPE,
class INFO_TYPE>
3020 const INFO_TYPE& info)
3022 return execute(
object, info.id(), info.formattingMode());
3025template <
class TYPE>
3030 enum { k_FAILURE = -1 };
3033 return parseObject.
execute(
object, formattingMode);
3041template <
class TYPE>
3052 this, formattingMode
3058template <
class TYPE>
3070template <
class TYPE,
class ANY_CATEGORY>
3075 enum { k_SUCCESS = 0, k_FAILURE = - 1 };
3077 bool isAttribute = formattingMode
3082 <<
"Object '" << d_name_p <<
"' is "
3083 <<
"being parsed as an attribute, "
3084 <<
"but it does not have the "
3085 <<
"'IS_ATTRIBUTE' flag set."
3091 static_cast<int>(d_value_length),
3094 <<
"Unable to parse \""
3096 <<
"\" (for '" << d_name_p <<
"' attribute)"
3111Decoder_ParseAttribute::Decoder_ParseAttribute(
Decoder *decoder,
3114 bsl::size_t lengthValue)
3119, d_value_length(lengthValue)
3127template <
class TYPE,
class INFO_TYPE>
3131 return execute(
object, info.formattingMode());
3134template <
class TYPE>
3141 return executeImp(
object, formattingMode, TypeCategory());
3156template <
class TYPE>
3165 CAN_BE_REPETITION_ONLY
3166 = ( (int)Selector::e_SELECTION
3168 || (int)Selector::e_SELECTION
3173 CanBeRepetitionOnly,
3174 CanBeListOrRepetition>::type Toggle;
3179template <
class TYPE>
3185 return executeArrayImp(
object, formattingMode, CanBeListOrRepetition());
3188template <
class TYPE>
3194 enum { k_FAILURE = -1 };
3201 static_cast<int>(d_lenName))) {
3212 static_cast<int>(d_lenName));
3220 Context context(
object, formattingMode);
3222 return context.beginParse(d_decoder);
3225template <
class TYPE>
3230 enum { k_FAILURE = -1 };
3239 static_cast<int>(d_lenName))) {
3249 static_cast<int>(d_lenName))) {
3251 <<
"Unable to make selection: \""
3267 Context context(
object, formattingMode);
3269 return context.beginParse(d_decoder);
3272template <
class TYPE>
3278 enum { k_SUCCESS = 0, k_FAILURE = -1 };
3295 if (parseAsNillable.
isNil()) {
3308template <
class TYPE>
3314 return d_decoder->decodeCustomized(
object, formattingMode);
3317template <
class TYPE>
3325 this, formattingMode
3331template <
class TYPE,
class ANY_CATEGORY>
3340 Context context(
object, formattingMode);
3342 return context.beginParse(d_decoder);
3345template <
class TYPE>
3348 CanBeListOrRepetition)
3354 ListContext listContext(
object, formattingMode);
3356 return listContext.beginParse(d_decoder);
3362template <
class TYPE>
3366 CanBeRepetitionOnly)
3371template <
class TYPE>
3389Decoder_ParseObject::Decoder_ParseObject(
Decoder *decoder,
3390 const char *elementName,
3391 bsl::size_t lenName)
3393, d_elementName_p(elementName)
3401template <
class TYPE,
class INFO_TYPE>
3405 return execute(
object, info.formattingMode());
3408template <
class TYPE>
3415 return executeImp(
object, formattingMode, TypeCategory());
3423template <
class TYPE>
3440 template <
class t_BASE_TYPE>
3445 BaseContext ctx(base,
d_that->d_formattingMode);
3453template <
class TYPE>
3463 return baseManipulator.
d_isNil ? 0 : rc;
3466template <
class TYPE>
3474template <
class TYPE,
class ANY_CATEGORY>
3481 Context elementContext(
object, d_formattingMode);
3485 return d_nillableContext.
beginParse(d_decoder);
3489Decoder_ParseNillableObject::Decoder_ParseNillableObject(
3492: d_formattingMode(formattingMode)
3493, d_nillableContext()
3499template <
class TYPE>
3513 return d_nillableContext.
isNil();
Definition balxml_base64parser.h:161
Definition balxml_decoderoptions.h:72
bool skipUnknownElements() const
Definition balxml_decoderoptions.h:526
Definition balxml_decoder.h:1029
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2384
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2449
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2438
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2394
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2410
Definition balxml_decoder.h:367
int beginParse(Decoder *decoder)
virtual ~Decoder_ElementContext()
For syntactic purposes only.
virtual int parseSubElement(const char *elementName, Decoder *decoder)=0
virtual int endElement(Decoder *decoder)=0
virtual int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder)=0
virtual int startElement(Decoder *decoder)=0
virtual int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder)=0
Definition balxml_decoder.h:760
Decoder_ErrorLogger(ErrorInfo::Severity severity, Decoder *decoder)
Construct a logger for the specified decoder.
Definition balxml_decoder.h:776
~Decoder_ErrorLogger()
Definition balxml_decoder.h:785
bsl::ostream & stream()
Definition balxml_decoder.h:792
Definition balxml_decoder.h:862
int beginParse(TYPE *object)
Definition balxml_decoder.h:910
Decoder_ListParser()
Definition balxml_decoder.h:901
int pushCharacters(INPUT_ITERATOR begin, INPUT_ITERATOR end)
Definition balxml_decoder.h:921
int endParse()
Definition balxml_decoder.h:915
Definition balxml_decoder.h:1079
~Decoder_NillableContext() BSLS_KEYWORD_OVERRIDE
Decoder_NillableContext()
void setElementContext(Decoder_ElementContext *elementContext)
bool isNil() const
Return true if the element is nil.
Definition balxml_decoder.h:1617
int executeImp(TYPE *object, int formattingMode, bdlat_TypeCategory::NullableValue)
Definition balxml_decoder.h:3042
int execute(TYPE *object, int formattingMode)
Definition balxml_decoder.h:3136
int operator()(TYPE *object, const INFO_TYPE &info)
Definition balxml_decoder.h:3129
bool failed() const
Definition balxml_decoder.h:3146
Definition balxml_decoder.h:1771
bool isNil() const
Return true if the value was nil, and false otherwise.
Definition balxml_decoder.h:3511
int executeImp(TYPE *object, bdlat_TypeCategory::DynamicType)
Definition balxml_decoder.h:3425
int operator()(TYPE *object)
Visit the specified object.
Definition balxml_decoder.h:3501
Definition balxml_decoder.h:1676
int executeArrayRepetitionImp(TYPE *object, int formattingMode)
Definition balxml_decoder.h:3372
int operator()(TYPE *object, const INFO_TYPE &info)
Definition balxml_decoder.h:3403
int executeImp(bsl::vector< char > *object, int formattingMode, bdlat_TypeCategory::Array)
int execute(TYPE *object, int formattingMode)
Definition balxml_decoder.h:3410
int executeArrayImp(TYPE *object, int formattingMode, CanBeListOrRepetition)
Definition balxml_decoder.h:3346
Definition balxml_decoder.h:1537
int operator()(TYPE *object, const INFO_TYPE &info)
Definition balxml_decoder.h:2954
Definition balxml_decoder.h:1578
int operator()(TYPE *object, const INFO_TYPE &info)
Definition balxml_decoder.h:3019
int execute(TYPE *object, int id, int formattingMode)
Definition balxml_decoder.h:3026
Definition balxml_decoder.h:1505
int operator()(const TYPE &object, const INFO_TYPE &info)
Definition balxml_decoder.h:2923
Definition balxml_decoder.h:1141
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2586
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2551
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2536
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2520
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2575
Definition balxml_decoder.h:1188
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2648
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2719
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2656
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2694
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2628
Definition balxml_decoder.h:1234
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2809
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2820
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2771
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2779
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2761
Definition balxml_decoder.h:1370
Decoder_PushParserContext< bsl::string, Base64Parser< bsl::string > > Base64Context
Definition balxml_decoder.h:1378
bsls::ObjectBuffer< UTF8Context > d_utf8Context
Definition balxml_decoder.h:1388
Decoder_StdStringContext(bsl::string *object, int formattingMode)
bsls::ObjectBuffer< HexContext > d_hexContext
Definition balxml_decoder.h:1387
bsls::ObjectBuffer< Base64Context > d_base64Context
Definition balxml_decoder.h:1386
Decoder_UTF8Context< bsl::string > UTF8Context
Definition balxml_decoder.h:1381
~Decoder_StdStringContext() BSLS_KEYWORD_OVERRIDE
Decoder_PushParserContext< bsl::string, HexParser< bsl::string > > HexContext
Definition balxml_decoder.h:1380
Definition balxml_decoder.h:1433
bsls::ObjectBuffer< UTF8Context > d_utf8Context
Definition balxml_decoder.h:1457
bsls::ObjectBuffer< ListContext > d_listContext
Definition balxml_decoder.h:1456
~Decoder_StdVectorCharContext() BSLS_KEYWORD_OVERRIDE
Decoder_PushParserContext< bsl::vector< char >, Decoder_ListParser< bsl::vector< char > > > ListContext
Definition balxml_decoder.h:1448
bsls::ObjectBuffer< HexContext > d_hexContext
Definition balxml_decoder.h:1455
Decoder_StdVectorCharContext(bsl::vector< char > *object, int formattingMode)
Decoder_UTF8Context< bsl::vector< char > > UTF8Context
Definition balxml_decoder.h:1449
Decoder_PushParserContext< bsl::vector< char >, HexParser< bsl::vector< char > > > HexContext
Definition balxml_decoder.h:1445
bsls::ObjectBuffer< Base64Context > d_base64Context
Definition balxml_decoder.h:1454
Decoder_PushParserContext< bsl::vector< char >, Base64Parser< bsl::vector< char > > > Base64Context
Definition balxml_decoder.h:1442
Definition balxml_decoder.h:1324
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2895
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2862
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2851
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2884
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2871
Definition balxml_decoder.h:1281
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Decoder_UnknownElementContext()
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:404
int open(bsl::istream &stream, const char *uri=0)
Definition balxml_decoder.h:2155
friend class Decoder_ErrorLogger
Definition balxml_decoder.h:408
const DecoderOptions * options() const
Definition balxml_decoder.h:2066
void setNumUnknownElementsSkipped(int value)
Definition balxml_decoder.h:2054
ErrorInfo::Severity errorSeverity() const
int warningCount() const
Definition balxml_decoder.h:2108
bsl::istream & decodeAny(bsl::istream &stream, TYPE *object, const char *uri=0)
Definition balxml_decoder.h:2269
Reader * reader() const
Definition balxml_decoder.h:2072
bsl::istream & decode(bsl::istream &stream, TYPE *object, const char *uri=0)
Definition balxml_decoder.h:2161
bsl::ostream * errorStream() const
Return pointer to the error stream.
Definition balxml_decoder.h:2084
bsl::ostream * warningStream() const
Return pointer to the warning stream.
Definition balxml_decoder.h:2096
bslstl::StringRef loggedMessages() const
ErrorInfo * errorInfo() const
Definition balxml_decoder.h:2078
int numUnknownElementsSkipped() const
Definition balxml_decoder.h:2090
int errorCount() const
Definition balxml_decoder.h:2102
Definition balxml_errorinfo.h:353
Severity
Definition balxml_errorinfo.h:358
Definition balxml_hexparser.h:169
Definition balxml_listparser.h:187
int pushCharacters(INPUT_ITERATOR begin, INPUT_ITERATOR end)
Definition balxml_listparser.h:368
int endParse()
Definition balxml_listparser.h:348
int beginParse(TYPE *object)
Definition balxml_listparser.h:333
Definition balxml_reader.h:835
Definition balxml_utf8readerwrapper.h:333
Definition bdlar_anyref.h:85
static bsl::enable_if<!IsDynamic< t_TYPE >::value, AnyRef >::type makeAnyRef(t_TYPE &object)
Make AnyRef to the specified object.
Definition bdlar_refutil.h:209
Definition bdlb_nullablevalue.h:262
bool isNull() const BSLS_KEYWORD_NOEXCEPT
Return true if this object is null, and false otherwise.
Definition bdlb_nullablevalue.h:1829
TYPE & makeValue(BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) value)
Definition bdlb_nullablevalue.h:1767
Definition bdlsb_memoutstreambuf.h:212
Definition bslstl_stringview.h:471
Definition bslstl_string.h:1252
Definition bslstl_vector.h:1120
Definition bslma_allocator.h:545
#define BALXML_DECODER_LOG_WARNING(reporter)
Definition balxml_decoder.h:813
int length() const
Definition balxml_decoder.h:2047
const char * data() const
Definition balxml_decoder.h:2041
void reset()
Reset the internal streambuf to empty.
Definition balxml_decoder.h:2034
#define BALXML_DECODER_LOG_END
Definition balxml_decoder.h:821
#define BALXML_DECODER_LOG_ERROR(reporter)
Definition balxml_decoder.h:805
static int manipulateByCategory(TYPE *object, MANIPULATOR &manipulator)
Definition bdlat_typecategory.h:1414
static const char * className(const TYPE &object)
Definition bdlat_typename.h:1025
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_ASSERT_INVOKE_NORETURN(X)
Definition bsls_assert.h:2101
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_OVERRIDE
Definition bsls_keyword.h:695
#define BSLS_REVIEW(X)
Definition bsls_review.h:1019
Definition balxml_base64parser.h:150
Definition bdlar_accessorref.h:59
int manipulateElement(TYPE *array, MANIPULATOR &manipulator, int index)
void resize(TYPE *array, int newSize)
bsl::size_t size(const TYPE &array)
Return the number of elements in the specified array.
bool hasSelection(const TYPE &object, const char *selectionName, int selectionNameLength)
int manipulateSelection(TYPE *object, MANIPULATOR &manipulator)
int makeSelection(TYPE *object, int selectionId)
int createBaseAndConvert(t_TYPE *object, t_MANIPULATOR &baseManipulator)
bool isNull(const TYPE &object)
int manipulateValue(TYPE *object, MANIPULATOR &manipulator)
void makeValue(TYPE *object)
int manipulateAttribute(TYPE *object, MANIPULATOR &manipulator, const char *attributeName, int attributeNameLength)
int manipulateAttributes(TYPE *object, MANIPULATOR &manipulator)
bool hasAttribute(const TYPE &object, const char *attributeName, int attributeNameLength)
void reset(TYPE *object)
Reset the value of the specified object to its default value.
Definition bdlat_valuetypefunctions.h:939
basic_string< char > string
Definition bslstl_string.h:844
Definition baljsn_encoder_testtypes.h:76
Definition bdlt_iso8601util.h:707
Definition bslstl_algorithm.h:84
Definition balxml_decoder.h:2311
int d_formattingMode
Definition balxml_decoder.h:2314
Decoder * d_that
Definition balxml_decoder.h:2313
int operator()(t_BASE_TYPE *base)
Definition balxml_decoder.h:2318
Decoder_PushParserContext< TYPE, Decoder_ListParser< TYPE > > Type
Definition balxml_decoder.h:945
Decoder_StdVectorCharContext Type
Definition balxml_decoder.h:953
Decoder_ChoiceContext< TYPE > Type
Definition balxml_decoder.h:960
Decoder_SimpleContext< TYPE > Type
Definition balxml_decoder.h:993
Decoder_SequenceContext< TYPE > Type
Definition balxml_decoder.h:967
Decoder_SimpleContext< TYPE > Type
Definition balxml_decoder.h:974
Decoder_StdStringContext Type
Definition balxml_decoder.h:982
Definition balxml_decoder.h:939
Definition balxml_decoder.h:1891
int operator()(TYPE *object, ANY_CATEGORY category)
Definition balxml_decoder.h:1913
Decoder_ParseAttribute * d_instance_p
Definition balxml_decoder.h:1894
int operator()(TYPE *, bslmf::Nil)
Definition balxml_decoder.h:1905
int d_formattingMode
Definition balxml_decoder.h:1895
Definition balxml_decoder.h:1864
int operator()(TYPE *object)
Definition balxml_decoder.h:1878
Decoder_ParseAttribute * d_instance_p
Definition balxml_decoder.h:1867
int d_formattingMode
Definition balxml_decoder.h:1868
Definition balxml_decoder.h:3434
int operator()(t_BASE_TYPE *base)
Definition balxml_decoder.h:3441
Decoder_ParseNillableObject * d_that
Definition balxml_decoder.h:3436
bool d_isNil
Definition balxml_decoder.h:3437
Definition balxml_decoder.h:1988
Decoder_ParseNillableObject * d_instance_p
Definition balxml_decoder.h:1991
int operator()(TYPE *object, ANY_CATEGORY category)
Definition balxml_decoder.h:2009
int operator()(TYPE *, bslmf::Nil)
Definition balxml_decoder.h:2001
Definition balxml_decoder.h:1953
int operator()(TYPE *object, ANY_CATEGORY category)
Definition balxml_decoder.h:1975
int operator()(TYPE *, bslmf::Nil)
Definition balxml_decoder.h:1967
int d_formattingMode
Definition balxml_decoder.h:1957
Decoder_ParseObject * d_instance_p
Definition balxml_decoder.h:1956
Definition balxml_decoder.h:1926
Decoder_ParseObject * d_instance_p
Definition balxml_decoder.h:1929
int operator()(TYPE *object)
Definition balxml_decoder.h:1940
int d_formattingMode
Definition balxml_decoder.h:1930
Definition balxml_decoder.h:1007
Decoder_InstantiateContext< TypeCategory, TYPE >::Type Type
Definition balxml_decoder.h:1015
Definition balxml_decoder.h:1830
int operator()(TYPE *object, ANY_CATEGORY category)
Definition balxml_decoder.h:1851
Decoder * d_decoder
Definition balxml_decoder.h:1833
int operator()(TYPE *, bslmf::Nil)
Definition balxml_decoder.h:1843
Definition balxml_typesparserutil.h:201
static int parse(TYPE *result, const char *input, int inputLength, int formattingMode)
Definition balxml_typesparserutil.h:954
Definition bdlat_typecategory.h:1037
Definition bdlat_typecategory.h:1038
Definition bdlat_typecategory.h:1039
Definition bdlat_typecategory.h:1036
Definition bdlat_typecategory.h:1041
Definition bdlat_typecategory.h:1088
Definition bdlat_typecategory.h:1042
Definition bdlat_typecategory.h:1043
Definition bdlat_typecategory.h:1033
@ e_CHOICE_CATEGORY
Definition bdlat_typecategory.h:1049
@ e_SEQUENCE_CATEGORY
Definition bdlat_typecategory.h:1053
static void skipLeadingTrailing(const char **begin, const char **end)
Definition bslmf_conditional.h:123
Definition bslmf_issame.h:146
Definition bslmf_nil.h:133
Definition bsls_objectbuffer.h:277