8#ifndef INCLUDED_BALXML_DECODER
9#define INCLUDED_BALXML_DECODER
291#include <balscm_version.h>
326#include <bsl_algorithm.h>
327#include <bsl_istream.h>
329#include <bsl_ostream.h>
330#include <bsl_streambuf.h>
331#include <bsl_string.h>
332#include <bsl_vector.h>
333#include <bsl_cstddef.h>
334#include <bsl_cstring.h>
335#include <bsl_cstdlib.h>
336#include <bsl_cerrno.h>
338#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
382 bsl::size_t lenValue,
415 class MemOutStream :
public bsl::ostream {
419 MemOutStream(
const MemOutStream&);
420 MemOutStream& operator=(
const MemOutStream&);
442 const
char *
data() const;
455 bslma::Allocator *d_allocator;
458 bsls::ObjectBuffer<MemOutStream> d_logArea;
462 MemOutStream *d_logStream;
464 bsl::ostream *d_errorStream;
465 bsl::ostream *d_warningStream;
467 bsl::
string d_sourceUri;
471 int d_numUnknownElementsSkipped;
478 int d_remainingDepth;
489 bsl::ostream& logStream();
492 int checkForReaderErrors();
493 int checkForErrors(const
ErrorInfo& errInfo);
498 template <class TYPE>
499 int validateTopElement(const TYPE *
object);
501 void setDecoderError(
ErrorInfo::Severity severity,
bsl::string_view msg);
503 int readTopElement();
506 template <class TYPE>
509 template <class TYPE, class ANY_CATEGORY>
510 int decodeImp(TYPE *
object, ANY_CATEGORY);
517 bslma::Allocator *basicAllocator);
534 bslma::Allocator *basicAllocator = 0);
549 int open(
bsl::istream& stream, const
char *uri = 0);
555 int open(
bsl::streambuf *buffer, const
char *uri = 0);
567 int open(const
char *filename);
577 template <class TYPE>
580 const
char *uri = 0);
589 template <class TYPE>
590 int decode(
bsl::streambuf *buffer, TYPE *
object, const
char *uri = 0);
600 template <class TYPE>
601 int decode(const
char *buffer,
604 const
char *uri = 0);
611 template <class TYPE>
612 int decode(const
char *filename, TYPE *
object);
622 template <class TYPE>
689 Decoder::MemOutStream d_stream;
703 : d_stream(decoder->d_allocator)
704 , d_severity(severity)
713 d_decoder->setDecoderError(d_severity,
731#define BALXML_DECODER_LOG_ERROR(reporter) \
733 balxml::Decoder_ErrorLogger \
734 logger(balxml::ErrorInfo::e_ERROR, reporter); \
739#define BALXML_DECODER_LOG_WARNING(reporter) \
741 balxml::Decoder_ErrorLogger \
742 logger(balxml::ErrorInfo::e_WARNING, reporter); \
747#define BALXML_DECODER_LOG_END \
756class Decoder_ElementContext;
759class Decoder_ChoiceContext;
761class Decoder_CustomizedContext;
762template <
class TYPE,
class PARSER>
763class Decoder_PushParserContext;
765class Decoder_SequenceContext;
767class Decoder_SimpleContext;
769class Decoder_UTF8Context;
771class Decoder_UnknownElementContext;
773class Decoder_StdStringContext;
774class Decoder_StdVectorCharContext;
848 template <
class INPUT_ITERATOR>
866template <
class CATEGORY,
class TYPE>
969 bool d_isSelectionNameKnown;
971 bool d_selectionIsRepeatable;
990 int addCharacters(
const char *chars,
994 int parseAttribute(
const char *name,
996 bsl::size_t lenValue,
999 int parseSubElement(
const char *elementName,
1036 int addCharacters(const
char *chars,
1040 int parseAttribute(const
char *name,
1042 bsl::
size_t lenValue,
1045 int parseSubElement(const
char *elementName,
1075template <class TYPE, class PARSER>
1079 int d_formattingMode;
1099 int addCharacters(
const char *chars,
1103 int parseAttribute(
const char *name,
1105 bsl::size_t lenValue,
1108 int parseSubElement(
const char *elementName,
1121template <
class TYPE>
1144 int addCharacters(
const char *chars,
1148 int parseAttribute(
const char *name,
1150 bsl::size_t lenValue,
1153 int parseSubElement(
const char *elementName,
1166template <
class TYPE>
1171 int d_formattingMode;
1190 int addCharacters(
const char *chars,
1194 int parseAttribute(
const char *name,
1196 bsl::size_t lenValue,
1199 int parseSubElement(
const char *elementName,
1213template <
class TYPE>
1220 BaseType>::Type BaseContext;
1224 BaseContext d_baseContext;
1242 int addCharacters(
const char *chars,
1246 int parseAttribute(
const char *name,
1248 bsl::size_t lenValue,
1251 int parseSubElement(
const char *elementName,
1291 bsl::size_t lenValue,
1307template <
class TYPE>
1329 int addCharacters(
const char *chars,
1333 int parseAttribute(
const char *name,
1335 bsl::size_t lenValue,
1338 int parseSubElement(
const char *elementName,
1391 int addCharacters(const
char *chars,
1395 int parseAttribute(const
char *name,
1397 bsl::
size_t lenValue,
1400 int parseSubElement(const
char *elementName,
1452 int formattingMode);
1461 int addCharacters(const
char *chars,
1465 int parseAttribute(const
char *name,
1467 bsl::
size_t lenValue,
1470 int parseSubElement(const
char *elementName,
1504 template <
class TYPE,
class INFO_TYPE>
1505 int operator()(
const TYPE &
object,
const INFO_TYPE &info);
1521 const char *d_chars_p;
1541 template <
class TYPE,
class INFO_TYPE>
1542 int operator()(TYPE *
object,
const INFO_TYPE& info);
1544 template <
class INFO_TYPE>
1545 int operator()(
bsl::string *
object,
const INFO_TYPE& info);
1561 const char *d_elementName_p;
1562 bsl::size_t d_lenName;
1572 const char *elementName,
1573 bsl::size_t lenName);
1579 template <
class TYPE,
class INFO_TYPE>
1580 int operator()(TYPE *
object,
const INFO_TYPE &info);
1582 template <
class TYPE>
1583 int execute(TYPE *
object,
int id,
int formattingMode);
1601 const char *d_name_p;
1602 const char *d_value_p;
1603 bsl::size_t d_value_length;
1607 template <
class TYPE>
1608 int executeImp(TYPE *
object,
1611 template <
class TYPE>
1612 int executeImp(TYPE *
object,
1615 template <
class TYPE,
class ANY_CATEGORY>
1616 int executeImp(TYPE *
object,
int formattingMode, ANY_CATEGORY);
1629 bsl::size_t lengthValue);
1635 template <
class TYPE,
class INFO_TYPE>
1636 int operator()(TYPE *
object,
const INFO_TYPE& info);
1638 template <
class TYPE>
1639 int execute(TYPE *
object,
int formattingMode);
1642 bool failed()
const;
1657 struct CanBeListOrRepetition { };
1658 struct CanBeRepetitionOnly { };
1662 const char *d_elementName_p;
1663 bsl::size_t d_lenName;
1675 template <
class TYPE>
1680 template <
class TYPE>
1681 int executeImp(TYPE *
object,
1685 template <
class TYPE>
1686 int executeImp(TYPE *
object,
1690 template <
class TYPE>
1691 int executeImp(TYPE *
object,
1695 template <
class TYPE>
1696 int executeImp(TYPE *
object,
1700 template <
class TYPE>
1701 int executeImp(TYPE *
object,
1705 template <
class TYPE>
1706 int executeImp(TYPE *
object,
1710 template <
class TYPE,
class ANY_CATEGORY>
1711 int executeImp(TYPE *
object,
int formattingMode, ANY_CATEGORY);
1713 template <
class TYPE>
1714 int executeArrayImp(TYPE *
object,
1716 CanBeListOrRepetition);
1718 template <
class TYPE>
1719 int executeArrayImp(TYPE *
object,
int formattingMode, CanBeRepetitionOnly);
1721 template <
class TYPE>
1722 int executeArrayRepetitionImp(TYPE *
object,
int formattingMode);
1727 const char *elementName,
1728 bsl::size_t lenName);
1734 template <
class TYPE,
class INFO_TYPE>
1735 int operator()(TYPE *
object,
const INFO_TYPE &info);
1737 template <
class TYPE>
1738 int execute(TYPE *
object,
int formattingMode);
1751 int d_formattingMode;
1757 template <
class TYPE>
1760 template <
class TYPE,
class ANY_CATEGORY>
1761 int executeImp(TYPE *
object, ANY_CATEGORY);
1778 template <
class TYPE>
1779 int operator()(TYPE *
object);
1807 template <
class TYPE>
1815 template <
class TYPE,
class ANY_CATEGORY>
1819 return d_decoder->decodeImp(
object, category);
1840 template <
class TYPE>
1844 return d_instance_p->
execute(
object, d_formattingMode);
1865 template <
class TYPE>
1873 template <
class TYPE,
class ANY_CATEGORY>
1877 return d_instance_p->
executeImp(
object, d_formattingMode, category);
1898 template <
class TYPE>
1902 return d_instance_p->
execute(
object, d_formattingMode);
1923 template <
class TYPE>
1931 template <
class TYPE,
class ANY_CATEGORY>
1935 return d_instance_p->
executeImp(
object, d_formattingMode, category);
1955 template <
class TYPE>
1963 template <
class TYPE,
class ANY_CATEGORY>
1967 return d_instance_p->
executeImp(
object, category);
1983, d_sb(
bslma::Default::allocator(basicAllocator))
2005 return (
int)d_sb.length();
2010void Decoder::setNumUnknownElementsSkipped(
int value)
2014 d_numUnknownElementsSkipped = value;
2040bsl::ostream *Decoder::errorStream()
const
2042 return d_errorStream;
2046int Decoder::numUnknownElementsSkipped()
const
2048 return d_numUnknownElementsSkipped;
2052bsl::ostream *Decoder::warningStream()
const
2054 return d_warningStream;
2058int Decoder::errorCount()
const
2060 return d_errorCount;
2064int Decoder::warningCount()
const
2066 return d_warningCount;
2074template <
class TYPE>
2076int Decoder::validateTopElement(
const TYPE *
object) {
2079 if (!d_options->validateRootTag()) {
2092 if (0 == typeName) {
2097 const char *nodeName = d_reader->nodeName();
2098 if (0 == strcmp(nodeName, typeName)) {
2103 <<
"The root object is of type '" << nodeName <<
"',"
2104 <<
" but we're attempting to decode an object of type "
2111int Decoder::open(bsl::istream& stream,
const char *uri)
2113 return open(stream.rdbuf(), uri);
2116template <
class TYPE>
2117bsl::istream& Decoder::decode(bsl::istream& stream,
2121 if (!stream.good()) {
2124 <<
"The input stream is invalid. "
2125 <<
"Unable to decode XML object. "
2131 if (0 != this->decode(stream.rdbuf(),
object, uri)) {
2132 stream.setstate(bsl::ios_base::failbit);
2138template <
class TYPE>
2140Decoder::decode(bsl::streambuf *buffer, TYPE *
object,
const char *uri)
2142 if (this->open(buffer, uri) != 0) {
2144 return this->errorCount();
2148 int ret = validateTopElement(
object);
2150 ret = this->decode(
object);
2153 switch(errorSeverity()) {
2154 case ErrorInfo::e_NO_ERROR:
2156 case ErrorInfo::e_WARNING:
2157 if (d_warningStream) {
2158 *d_warningStream << loggedMessages();
2162 if (d_errorStream) {
2163 *d_errorStream << loggedMessages();
2172template <
class TYPE>
2173int Decoder::decode(
const char *buffer,
2178 if (this->open(buffer, buflen, uri) != 0) {
2180 return this->errorCount();
2183 int ret = validateTopElement(
object);
2185 ret = this->decode(
object);
2192template <
class TYPE>
2193int Decoder::decode(
const char *filename, TYPE *
object)
2195 if (this->open(filename) != 0) {
2197 return this->errorCount();
2200 int ret = validateTopElement(
object);
2202 ret = this->decode(
object);
2209template <
class TYPE>
2211int Decoder::decode(TYPE *
object)
2218 this->decodeImp(
object, TypeCategory());
2220 return this->errorCount();
2223template <
class TYPE>
2231 <<
"The object being decoded is a 'DynamicType', and "
2232 "attempting to manipulate the object by its dynamic "
2233 "category returned a non-zero status."
2241template <
class TYPE,
class ANY_CATEGORY>
2243int Decoder::decodeImp(TYPE *
object, ANY_CATEGORY)
2246 Decoder_InstantiateContext<ANY_CATEGORY, TYPE>::Type ContextType;
2248 ContextType elementContext(
object, d_options->formattingMode());
2250 return elementContext.beginParse(
this);
2257template <
class TYPE>
2261: d_isSelectionNameKnown(false)
2263, d_selectionIsRepeatable(false)
2266 (void) formattingMode;
2273template <
class TYPE>
2276 enum { k_SUCCESS = 0 };
2278 d_isSelectionNameKnown =
false;
2283template <
class TYPE>
2286 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2288 if (!d_isSelectionNameKnown) {
2290 <<
"No elements selected in choice."
2299template <
class TYPE>
2304 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2308 const char *begin = chars;
2309 const char *end = begin + length;
2315 <<
"Invalid characters \""
2317 <<
"\" when parsing choice."
2326template <
class TYPE>
2333 enum { k_ATTRIBUTE_IGNORED = 0 };
2335 return k_ATTRIBUTE_IGNORED;
2338template <
class TYPE>
2342 enum { k_FAILURE = -1 };
2344 const int lenName =
static_cast<int>(bsl::strlen(elementName));
2346 if (d_isSelectionNameKnown
2347 && (!d_selectionIsRepeatable || d_selectionName != elementName))
2350 <<
"Only one selection is permitted inside choice."
2356 bool wasSelectionNameKnown = d_isSelectionNameKnown;
2357 d_isSelectionNameKnown =
true;
2365 d_selectionIsRepeatable =
true;
2366 d_selectionName.assign(elementName, lenName);
2372 if (!wasSelectionNameKnown) {
2377 <<
"Unable to make selection: \""
2385 d_selectionIsRepeatable =
true;
2386 d_selectionName.assign(elementName, lenName);
2398template <
class TYPE,
class PARSER>
2403: d_formattingMode(formattingMode), d_object_p(object)
2409template <
class TYPE,
class PARSER>
2412 int result = d_parser.beginParse(d_object_p);
2416 <<
"Unable to begin parsing list or binary type"
2425template <
class TYPE,
class PARSER>
2428 int result = d_parser.endParse();
2432 <<
"Unable to end parsing list or binary type"
2440template <
class TYPE,
class PARSER>
2446 const char *begin = chars;
2447 const char *end = begin + length;
2449 int result = d_parser.pushCharacters(begin, end);
2453 <<
"Unable to push \"" << chars
2454 <<
"\" when parsing list or binary type"
2463template <
class TYPE,
class PARSER>
2470 enum { k_ATTRIBUTE_IGNORED = 0 };
2472 return k_ATTRIBUTE_IGNORED;
2475template <
class TYPE,
class PARSER>
2477 const char *elementName,
2480 enum { k_FAILURE = -1 };
2483 <<
"Unexpected sub-element \"" << elementName
2484 <<
"\" when parsing list or binary type"
2496template <
class TYPE>
2502 (void) formattingMode;
2512 d_simpleContentId.reset();
2517template <
class TYPE>
2526 prepareSequenceContext);
2530 <<
"Unable to prepare sequence context!"
2537template <
class TYPE>
2540 enum { k_SUCCESS = 0 };
2545template <
class TYPE>
2550 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2554 if (d_simpleContentId.isNull()) {
2556 const char *begin = chars;
2557 const char *end = begin + length;
2563 <<
"Unexpected characters: \""
2580 d_simpleContentId.value());
2583template <
class TYPE>
2586 bsl::size_t lenValue,
2589 enum { k_SUCCESS = 0, k_ATTRIBUTE_IGNORED = 0, k_FAILURE = -1 };
2591 const int lenName =
static_cast<int>(bsl::strlen(name));
2602 return k_ATTRIBUTE_IGNORED;
2608template <
class TYPE>
2612 enum { k_FAILURE = -1 };
2614 const int lenName =
static_cast<int>(bsl::strlen(elementName));
2639template <
class TYPE>
2643: d_formattingMode(formattingMode)
2650template <
class TYPE>
2653 enum { k_SUCCESS = 0 };
2660template <
class TYPE>
2663 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2668template <
class TYPE>
2673 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2675 const char *begin = chars;
2676 const char *end = begin + length;
2682 static_cast<int>(end - begin),
2683 d_formattingMode)) {
2685 <<
"Unable to parse \""
2687 <<
"\" when parsing list or binary type"
2697template <
class TYPE>
2704 enum { k_ATTRIBUTE_IGNORED = 0 };
2706 return k_ATTRIBUTE_IGNORED;
2709template <
class TYPE>
2713 enum { k_FAILURE = -1 };
2716 <<
"Attempted to create sub context for \""
2717 << elementName <<
"\" inside simple type"
2730template <
class TYPE>
2737, d_baseContext(&d_baseObj, formattingMode)
2743template <
class TYPE>
2746 return d_baseContext.startElement (decoder);
2749template <
class TYPE>
2752 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2753 int rc = d_baseContext.endElement(decoder);
2763template <
class TYPE>
2768 return d_baseContext.addCharacters(chars, length, decoder);
2771template <
class TYPE>
2774 bsl::size_t lenValue,
2777 return d_baseContext.parseAttribute(name, value, lenValue, decoder);
2780template <
class TYPE>
2784 return d_baseContext.parseSubElement(elementName, decoder);
2792template <
class TYPE>
2801template <
class TYPE>
2805 enum { k_SUCCESS = 0 };
2807 d_object_p->clear();
2812template <
class TYPE>
2816 enum { k_SUCCESS = 0 };
2821template <
class TYPE>
2827 enum { k_SUCCESS = 0 };
2829 d_object_p->insert(d_object_p->end(), chars, chars + length);
2834template <
class TYPE>
2841 enum { k_ATTRIBUTE_IGNORED = 0 };
2843 return k_ATTRIBUTE_IGNORED;
2846template <
class TYPE>
2850 enum { k_FAILURE = -1 };
2853 <<
"Attempted to create sub context for \""
2854 << elementName <<
"\" inside UTF8 type."
2866Decoder_PrepareSequenceContext::Decoder_PrepareSequenceContext(
2868: d_simpleContentId_p(simpleContentId)
2870 d_simpleContentId_p->reset();
2874template <
class TYPE,
class INFO_TYPE>
2876 const INFO_TYPE& info)
2878 enum { k_SUCCESS = 0 };
2882 d_simpleContentId_p->
makeValue(info.id());
2894Decoder_ParseSequenceSimpleContent::Decoder_ParseSequenceSimpleContent(
2898: d_chars_p(chars), d_len(len), d_decoder(decoder)
2905template <
class TYPE,
class INFO_TYPE>
2907 const INFO_TYPE& info)
2912 enum { k_SUCCESS = 0, k_FAILURE = -1 };
2914 const char *begin = d_chars_p;
2915 const char *end = begin + d_len;
2921 static_cast<int>(end - begin),
2922 info.formattingMode())) {
2924 <<
"Unable to parse \""
2926 <<
"\" within simple content"
2937template <
class INFO_TYPE>
2940 const INFO_TYPE& info)
2942 enum { k_SUCCESS = 0 };
2949 object->assign(d_chars_p, d_len);
2960Decoder_ParseSequenceSubElement::Decoder_ParseSequenceSubElement(
2962 const char *elementName,
2963 bsl::size_t lenName)
2964: d_decoder(decoder), d_elementName_p(elementName), d_lenName(lenName)
2969template <
class TYPE,
class INFO_TYPE>
2972 const INFO_TYPE& info)
2974 return execute(
object, info.id(), info.formattingMode());
2977template <
class TYPE>
2982 enum { k_FAILURE = -1 };
2985 return parseObject.
execute(
object, formattingMode);
2993template <
class TYPE>
3004 this, formattingMode
3010template <
class TYPE>
3022template <
class TYPE,
class ANY_CATEGORY>
3027 enum { k_SUCCESS = 0, k_FAILURE = - 1 };
3029 bool isAttribute = formattingMode
3034 <<
"Object '" << d_name_p <<
"' is "
3035 <<
"being parsed as an attribute, "
3036 <<
"but it does not have the "
3037 <<
"'IS_ATTRIBUTE' flag set."
3043 static_cast<int>(d_value_length),
3046 <<
"Unable to parse \""
3048 <<
"\" (for '" << d_name_p <<
"' attribute)"
3063Decoder_ParseAttribute::Decoder_ParseAttribute(
Decoder *decoder,
3066 bsl::size_t lengthValue)
3071, d_value_length(lengthValue)
3079template <
class TYPE,
class INFO_TYPE>
3083 return execute(
object, info.formattingMode());
3086template <
class TYPE>
3093 return executeImp(
object, formattingMode, TypeCategory());
3108template <
class TYPE>
3117 CAN_BE_REPETITION_ONLY
3118 = ( (int)Selector::e_SELECTION
3120 || (int)Selector::e_SELECTION
3125 CanBeRepetitionOnly,
3126 CanBeListOrRepetition>::type Toggle;
3131template <
class TYPE>
3137 return executeArrayImp(
object, formattingMode, CanBeListOrRepetition());
3140template <
class TYPE>
3146 enum { k_FAILURE = -1 };
3153 static_cast<int>(d_lenName))) {
3164 static_cast<int>(d_lenName));
3172 Context context(
object, formattingMode);
3174 return context.beginParse(d_decoder);
3177template <
class TYPE>
3182 enum { k_FAILURE = -1 };
3191 static_cast<int>(d_lenName))) {
3201 static_cast<int>(d_lenName))) {
3203 <<
"Unable to make selection: \""
3219 Context context(
object, formattingMode);
3221 return context.beginParse(d_decoder);
3224template <
class TYPE>
3230 enum { k_SUCCESS = 0, k_FAILURE = -1 };
3247 if (parseAsNillable.
isNil()) {
3260template <
class TYPE>
3271 Context context(
object, formattingMode);
3273 return context.beginParse(d_decoder);
3276template <
class TYPE>
3284 this, formattingMode
3290template <
class TYPE,
class ANY_CATEGORY>
3299 Context context(
object, formattingMode);
3301 return context.beginParse(d_decoder);
3304template <
class TYPE>
3307 CanBeListOrRepetition)
3313 ListContext listContext(
object, formattingMode);
3315 return listContext.beginParse(d_decoder);
3321template <
class TYPE>
3325 CanBeRepetitionOnly)
3330template <
class TYPE>
3348Decoder_ParseObject::Decoder_ParseObject(
Decoder *decoder,
3349 const char *elementName,
3350 bsl::size_t lenName)
3352, d_elementName_p(elementName)
3360template <
class TYPE,
class INFO_TYPE>
3364 return execute(
object, info.formattingMode());
3367template <
class TYPE>
3374 return executeImp(
object, formattingMode, TypeCategory());
3382template <
class TYPE>
3393template <
class TYPE,
class ANY_CATEGORY>
3400 Context elementContext(
object, d_formattingMode);
3404 return d_nillableContext.
beginParse(d_decoder);
3408Decoder_ParseNillableObject::Decoder_ParseNillableObject(
3411: d_formattingMode(formattingMode)
3412, d_nillableContext()
3418template <
class TYPE>
3432 return d_nillableContext.
isNil();
Definition balxml_base64parser.h:161
Definition balxml_decoderoptions.h:72
bool skipUnknownElements() const
Definition balxml_decoderoptions.h:525
Definition balxml_decoder.h:966
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2274
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2339
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2328
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2284
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2300
Definition balxml_decoder.h:1214
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2772
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2744
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2750
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2764
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2781
Definition balxml_decoder.h:365
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:686
Decoder_ErrorLogger(ErrorInfo::Severity severity, Decoder *decoder)
Construct a logger for the specified decoder.
Definition balxml_decoder.h:702
~Decoder_ErrorLogger()
Definition balxml_decoder.h:711
bsl::ostream & stream()
Definition balxml_decoder.h:718
Definition balxml_decoder.h:790
int beginParse(TYPE *object)
Definition balxml_decoder.h:838
Decoder_ListParser()
Definition balxml_decoder.h:829
int pushCharacters(INPUT_ITERATOR begin, INPUT_ITERATOR end)
Definition balxml_decoder.h:849
int endParse()
Definition balxml_decoder.h:843
Definition balxml_decoder.h:1015
~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:1595
int executeImp(TYPE *object, int formattingMode, bdlat_TypeCategory::NullableValue)
Definition balxml_decoder.h:2994
int execute(TYPE *object, int formattingMode)
Definition balxml_decoder.h:3088
int operator()(TYPE *object, const INFO_TYPE &info)
Definition balxml_decoder.h:3081
bool failed() const
Definition balxml_decoder.h:3098
Definition balxml_decoder.h:1748
bool isNil() const
Return true if the value was nil, and false otherwise.
Definition balxml_decoder.h:3430
int executeImp(TYPE *object, bdlat_TypeCategory::DynamicType)
Definition balxml_decoder.h:3384
int operator()(TYPE *object)
Visit the specified object.
Definition balxml_decoder.h:3420
Definition balxml_decoder.h:1654
int executeArrayRepetitionImp(TYPE *object, int formattingMode)
Definition balxml_decoder.h:3331
int operator()(TYPE *object, const INFO_TYPE &info)
Definition balxml_decoder.h:3362
int executeImp(bsl::vector< char > *object, int formattingMode, bdlat_TypeCategory::Array)
int execute(TYPE *object, int formattingMode)
Definition balxml_decoder.h:3369
int executeArrayImp(TYPE *object, int formattingMode, CanBeListOrRepetition)
Definition balxml_decoder.h:3305
Definition balxml_decoder.h:1517
int operator()(TYPE *object, const INFO_TYPE &info)
Definition balxml_decoder.h:2906
Definition balxml_decoder.h:1557
int operator()(TYPE *object, const INFO_TYPE &info)
Definition balxml_decoder.h:2971
int execute(TYPE *object, int id, int formattingMode)
Definition balxml_decoder.h:2978
Definition balxml_decoder.h:1486
int operator()(const TYPE &object, const INFO_TYPE &info)
Definition balxml_decoder.h:2875
Definition balxml_decoder.h:1076
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2476
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2441
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2426
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2410
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2465
Definition balxml_decoder.h:1122
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2538
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2609
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2546
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2584
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2518
Definition balxml_decoder.h:1167
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2699
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2710
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2661
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2669
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2651
Definition balxml_decoder.h:1353
Decoder_PushParserContext< bsl::string, Base64Parser< bsl::string > > Base64Context
Definition balxml_decoder.h:1361
bsls::ObjectBuffer< UTF8Context > d_utf8Context
Definition balxml_decoder.h:1371
Decoder_StdStringContext(bsl::string *object, int formattingMode)
bsls::ObjectBuffer< HexContext > d_hexContext
Definition balxml_decoder.h:1370
bsls::ObjectBuffer< Base64Context > d_base64Context
Definition balxml_decoder.h:1369
Decoder_UTF8Context< bsl::string > UTF8Context
Definition balxml_decoder.h:1364
~Decoder_StdStringContext() BSLS_KEYWORD_OVERRIDE
Decoder_PushParserContext< bsl::string, HexParser< bsl::string > > HexContext
Definition balxml_decoder.h:1363
Definition balxml_decoder.h:1415
bsls::ObjectBuffer< UTF8Context > d_utf8Context
Definition balxml_decoder.h:1439
bsls::ObjectBuffer< ListContext > d_listContext
Definition balxml_decoder.h:1438
~Decoder_StdVectorCharContext() BSLS_KEYWORD_OVERRIDE
Decoder_PushParserContext< bsl::vector< char >, Decoder_ListParser< bsl::vector< char > > > ListContext
Definition balxml_decoder.h:1430
bsls::ObjectBuffer< HexContext > d_hexContext
Definition balxml_decoder.h:1437
Decoder_StdVectorCharContext(bsl::vector< char > *object, int formattingMode)
Decoder_UTF8Context< bsl::vector< char > > UTF8Context
Definition balxml_decoder.h:1431
Decoder_PushParserContext< bsl::vector< char >, HexParser< bsl::vector< char > > > HexContext
Definition balxml_decoder.h:1427
bsls::ObjectBuffer< Base64Context > d_base64Context
Definition balxml_decoder.h:1436
Decoder_PushParserContext< bsl::vector< char >, Base64Parser< bsl::vector< char > > > Base64Context
Definition balxml_decoder.h:1424
Definition balxml_decoder.h:1308
int parseSubElement(const char *elementName, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2847
int endElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2814
int startElement(Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2803
int parseAttribute(const char *name, const char *value, bsl::size_t lenValue, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2836
int addCharacters(const char *chars, bsl::size_t length, Decoder *decoder) BSLS_KEYWORD_OVERRIDE
Definition balxml_decoder.h:2823
Definition balxml_decoder.h:1265
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:402
int open(bsl::istream &stream, const char *uri=0)
Definition balxml_decoder.h:2111
friend class Decoder_ErrorLogger
Definition balxml_decoder.h:406
const DecoderOptions * options() const
Definition balxml_decoder.h:2022
void setNumUnknownElementsSkipped(int value)
Definition balxml_decoder.h:2010
ErrorInfo::Severity errorSeverity() const
int warningCount() const
Definition balxml_decoder.h:2064
Reader * reader() const
Definition balxml_decoder.h:2028
bsl::istream & decode(bsl::istream &stream, TYPE *object, const char *uri=0)
Definition balxml_decoder.h:2117
bsl::ostream * errorStream() const
Return pointer to the error stream.
Definition balxml_decoder.h:2040
bsl::ostream * warningStream() const
Return pointer to the warning stream.
Definition balxml_decoder.h:2052
bslstl::StringRef loggedMessages() const
ErrorInfo * errorInfo() const
Definition balxml_decoder.h:2034
int numUnknownElementsSkipped() const
Definition balxml_decoder.h:2046
int errorCount() const
Definition balxml_decoder.h:2058
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:349
int endParse()
Definition balxml_listparser.h:329
int beginParse(TYPE *object)
Definition balxml_listparser.h:314
Definition balxml_reader.h:835
Definition balxml_utf8readerwrapper.h:333
Definition bdlb_nullablevalue.h:257
bool isNull() const BSLS_KEYWORD_NOEXCEPT
Return true if this object is null, and false otherwise.
Definition bdlb_nullablevalue.h:1779
TYPE & makeValue(BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) value)
Definition bdlb_nullablevalue.h:1717
Definition bdlsb_memoutstreambuf.h:212
Definition bslstl_stringview.h:441
Definition bslstl_string.h:1281
Definition bslstl_vector.h:1025
Definition bslma_allocator.h:457
#define BALXML_DECODER_LOG_WARNING(reporter)
Definition balxml_decoder.h:739
int length() const
Definition balxml_decoder.h:2003
const char * data() const
Definition balxml_decoder.h:1997
void reset()
Reset the internal streambuf to empty.
Definition balxml_decoder.h:1990
#define BALXML_DECODER_LOG_END
Definition balxml_decoder.h:747
#define BALXML_DECODER_LOG_ERROR(reporter)
Definition balxml_decoder.h:731
static int manipulateByCategory(TYPE *object, MANIPULATOR &manipulator)
Definition bdlat_typecategory.h:1404
static const char * className(const TYPE &object)
Definition bdlat_typename.h:1017
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_OVERRIDE
Definition bsls_keyword.h:653
#define BSLS_REVIEW(X)
Definition bsls_review.h:949
Definition balxml_base64parser.h:150
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 convertFromBaseType(TYPE *object, const BASE_TYPE &value)
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 bdlb_printmethods.h:283
basic_string< char > string
Definition bslstl_string.h:782
Definition balxml_encoderoptions.h:68
Definition bdlt_iso8601util.h:691
Definition bslstl_algorithm.h:82
Decoder_PushParserContext< TYPE, Decoder_ListParser< TYPE > > Type
Definition balxml_decoder.h:873
Decoder_StdVectorCharContext Type
Definition balxml_decoder.h:881
Decoder_ChoiceContext< TYPE > Type
Definition balxml_decoder.h:888
Decoder_CustomizedContext< TYPE > Type
Definition balxml_decoder.h:921
Decoder_SimpleContext< TYPE > Type
Definition balxml_decoder.h:932
Decoder_SequenceContext< TYPE > Type
Definition balxml_decoder.h:895
Decoder_SimpleContext< TYPE > Type
Definition balxml_decoder.h:902
Decoder_StdStringContext Type
Definition balxml_decoder.h:910
Definition balxml_decoder.h:867
COMPONENT-PRIVATE CLASS. DO NOT USE OUTSIDE OF THIS COMPONENT.
Definition balxml_decoder.h:1853
int operator()(TYPE *object, ANY_CATEGORY category)
Definition balxml_decoder.h:1875
Decoder_ParseAttribute * d_instance_p
Definition balxml_decoder.h:1856
int operator()(TYPE *, bslmf::Nil)
Definition balxml_decoder.h:1867
int d_formattingMode
Definition balxml_decoder.h:1857
COMPONENT-PRIVATE CLASS. DO NOT USE OUTSIDE OF THIS COMPONENT.
Definition balxml_decoder.h:1828
int operator()(TYPE *object)
Definition balxml_decoder.h:1842
Decoder_ParseAttribute * d_instance_p
Definition balxml_decoder.h:1831
int d_formattingMode
Definition balxml_decoder.h:1832
COMPONENT-PRIVATE CLASS. DO NOT USE OUTSIDE OF THIS COMPONENT.
Definition balxml_decoder.h:1944
Decoder_ParseNillableObject * d_instance_p
Definition balxml_decoder.h:1947
int operator()(TYPE *object, ANY_CATEGORY category)
Definition balxml_decoder.h:1965
int operator()(TYPE *, bslmf::Nil)
Definition balxml_decoder.h:1957
COMPONENT-PRIVATE CLASS. DO NOT USE OUTSIDE OF THIS COMPONENT.
Definition balxml_decoder.h:1911
int operator()(TYPE *object, ANY_CATEGORY category)
Definition balxml_decoder.h:1933
int operator()(TYPE *, bslmf::Nil)
Definition balxml_decoder.h:1925
int d_formattingMode
Definition balxml_decoder.h:1915
Decoder_ParseObject * d_instance_p
Definition balxml_decoder.h:1914
COMPONENT-PRIVATE CLASS. DO NOT USE OUTSIDE OF THIS COMPONENT.
Definition balxml_decoder.h:1886
Decoder_ParseObject * d_instance_p
Definition balxml_decoder.h:1889
int operator()(TYPE *object)
Definition balxml_decoder.h:1900
int d_formattingMode
Definition balxml_decoder.h:1890
Definition balxml_decoder.h:944
Decoder_InstantiateContext< TypeCategory, TYPE >::Type Type
Definition balxml_decoder.h:952
COMPONENT-PRIVATE CLASS. DO NOT USE OUTSIDE OF THIS COMPONENT.
Definition balxml_decoder.h:1796
int operator()(TYPE *object, ANY_CATEGORY category)
Definition balxml_decoder.h:1817
Decoder * d_decoder
Definition balxml_decoder.h:1799
int operator()(TYPE *, bslmf::Nil)
Definition balxml_decoder.h:1809
Definition balxml_typesparserutil.h:199
static int parse(TYPE *result, const char *input, int inputLength, int formattingMode)
Definition balxml_typesparserutil.h:943
TYPE::BaseType Type
Definition bdlat_customizedtypefunctions.h:536
Definition bdlat_typecategory.h:1035
Definition bdlat_typecategory.h:1036
Definition bdlat_typecategory.h:1037
Definition bdlat_typecategory.h:1034
Definition bdlat_typecategory.h:1039
Definition bdlat_typecategory.h:1083
Definition bdlat_typecategory.h:1040
Definition bdlat_typecategory.h:1041
Definition bdlat_typecategory.h:1031
@ e_CHOICE_CATEGORY
Definition bdlat_typecategory.h:1047
@ e_SEQUENCE_CATEGORY
Definition bdlat_typecategory.h:1051
static void skipLeadingTrailing(const char **begin, const char **end)
Definition bslmf_conditional.h:120
Definition bslmf_issame.h:146
This struct is empty and represents a nil type.
Definition bslmf_nil.h:131
Definition bsls_objectbuffer.h:276