8#ifndef INCLUDED_S_BALTST_BASICSCHEMAUTIL
9#define INCLUDED_S_BALTST_BASICSCHEMAUTIL
67#include <bdlat_choicefunctions.h>
88template <
class ELEMENT_TYPE>
89struct BasicSchemaUtil_IsElement;
92template <
class ELEMENT_TYPE>
93struct BasicSchemaUtil_IsElementOrSchema;
106 template <
class ELEMENT_TYPE>
114 template <
class ELEMENT_TYPE>
115 struct IsElementOrSchema
127 template <
class PARENT_TYPE,
class CHILD_TYPE>
131 append(PARENT_TYPE *parent,
const CHILD_TYPE& element);
154template <
class ELEMENT_TYPE>
206template <
class ELEMENT_TYPE>
242 template <
class ELEMENT_TYPE>
243 static void doRemoveAnnotations(ELEMENT_TYPE *element);
251 template <
class ELEMENT_CHOICE_FORWARD_ITERATOR>
252 static ELEMENT_CHOICE_FORWARD_ITERATOR doRemoveAnnotations(
253 ELEMENT_CHOICE_FORWARD_ITERATOR beginElementChoices,
254 ELEMENT_CHOICE_FORWARD_ITERATOR endElementChoices);
264 template <
class PARENT_TYPE>
266 template <
class PARENT_TYPE>
268 template <
class PARENT_TYPE>
270 template <
class PARENT_TYPE>
271 static void append(PARENT_TYPE *parent,
const Element& element);
272 template <
class PARENT_TYPE>
274 template <
class PARENT_TYPE>
276 template <
class PARENT_TYPE>
278 template <
class PARENT_TYPE>
286 template <
class ELEMENT_CHOICE_TYPE>
287 static bool isAnnotation(
const ELEMENT_CHOICE_TYPE& choice);
290 template <
class ELEMENT_TYPE>
316 template <
class ELEMENT_CHOICE_TYPE>
317 void operator()(ELEMENT_CHOICE_TYPE& element)
const;
344 template <
class SELECTION_TYPE>
371 template <
class ELEMENT_CHOICE_TYPE>
372 bool operator()(
const ELEMENT_CHOICE_TYPE& element)
const;
387 template <
class SEQUENCE_CONTAINER>
388 static void eraseToEnd(SEQUENCE_CONTAINER *container,
389 typename SEQUENCE_CONTAINER::iterator position);
394 template <
class INPUT_ITERATOR,
class TRANSFORM>
395 static INPUT_ITERATOR
forEach(INPUT_ITERATOR first,
397 TRANSFORM transform);
409template <
class PARENT_TYPE,
class CHILD_TYPE>
423 enumeration.
value() = value;
436 return aCopy == bCopy;
444void BasicSchemaUtil_ImplUtil::doRemoveAnnotations(AnnotationElement *)
447 "This overload of 'BasicSchemaUtil_ImplUtil::removeAnnotations' must "
451template <
class ELEMENT_TYPE>
452void BasicSchemaUtil_ImplUtil::doRemoveAnnotations(ELEMENT_TYPE *element)
456 BasicSchemaUtil_ImplUtil::doRemoveAnnotations(
457 element->choice().begin(), element->choice().end()));
460template <
class ELEMENT_CHOICE_FORWARD_ITERATOR>
461ELEMENT_CHOICE_FORWARD_ITERATOR BasicSchemaUtil_ImplUtil::doRemoveAnnotations(
462 ELEMENT_CHOICE_FORWARD_ITERATOR beginElementChoices,
463 ELEMENT_CHOICE_FORWARD_ITERATOR endElementChoices)
465 const BasicSchemaUtil_IsAnnotationPredicate
isAnnotation;
466 const ELEMENT_CHOICE_FORWARD_ITERATOR newEnd =
467 std::remove_if(beginElementChoices, endElementChoices,
isAnnotation);
475template <
class PARENT_TYPE>
479 parent->choice().emplace_back();
480 parent->choice().back().makeAnnotation(element);
483template <
class PARENT_TYPE>
487 parent->choice().emplace_back();
488 parent->choice().back().makeChoice(element);
491template <
class PARENT_TYPE>
495 parent->choice().emplace_back();
496 parent->choice().back().makeComplexType(element);
499template <
class PARENT_TYPE>
503 parent->choice().emplace_back();
504 parent->choice().back().makeElement(element);
507template <
class PARENT_TYPE>
511 parent->choice().emplace_back();
512 parent->choice().back().makeEnumeration(element);
515template <
class PARENT_TYPE>
519 parent->choice().emplace_back();
520 parent->choice().back().makeRestriction(element);
523template <
class PARENT_TYPE>
527 parent->choice().emplace_back();
528 parent->choice().back().makeSequence(element);
531template <
class PARENT_TYPE>
535 parent->choice().emplace_back();
536 parent->choice().back().makeSimpleType(element);
539template <
class ELEMENT_CHOICE_TYPE>
542 return choice.isAnnotationValue();
545template <
class ELEMENT_TYPE>
548 BasicSchemaUtil_ImplUtil::doRemoveAnnotations(element);
562template <
class ELEMENT_CHOICE_TYPE>
564 ELEMENT_CHOICE_TYPE& element)
const
573 &element, removeAnnotations);
589template <
class SELECTION_TYPE>
591 SELECTION_TYPE *selection,
608template <
class ELEMENT_CHOICE_TYPE>
610 const ELEMENT_CHOICE_TYPE& element)
const
620template <
class SEQUENCE_CONTAINER>
622 SEQUENCE_CONTAINER *container,
623 typename SEQUENCE_CONTAINER::iterator position)
625 container->erase(position, container->end());
628template <
class INPUT_ITERATOR,
class TRANSFORM>
633 for (; first != last; ++first) {
Definition bslstl_stringview.h:441
Definition s_baltst_basicschema.h:95
Definition s_baltst_basicschema.h:1682
Definition s_baltst_basicschema.h:2134
Definition s_baltst_basicschema.h:2625
Definition s_baltst_basicschema.h:521
bdlb::NullableValue< bsl::string > & value()
Definition s_baltst_basicschema.h:4446
Definition s_baltst_basicschema.h:985
Definition s_baltst_basicschema.h:3202
Definition s_baltst_basicschema.h:1448
Definition s_baltst_basicschemautil.h:302
BasicSchemaUtil_ChoiceAnnotationRemover()
Create a BasicSchemaUtil_ChoiceAnnotationRemover object.
Definition s_baltst_basicschemautil.h:557
void operator()(ELEMENT_CHOICE_TYPE &element) const
Definition s_baltst_basicschemautil.h:563
Definition s_baltst_basicschemautil.h:357
bool operator()(const ELEMENT_CHOICE_TYPE &element) const
Definition s_baltst_basicschemautil.h:609
BasicSchemaUtil_IsAnnotationPredicate()
Create a BasicSchemaUtil_IsAnnotationPredicate object.
Definition s_baltst_basicschemautil.h:603
Definition s_baltst_basicschemautil.h:329
int operator()(SELECTION_TYPE *selection, const bdlat_SelectionInfo &) const
Definition s_baltst_basicschemautil.h:590
BasicSchemaUtil_SelectionAnnotationRemover()
Create a BasicSchemaUtil_SelectionAnnotationRemover object.
Definition s_baltst_basicschemautil.h:584
Definition s_baltst_basicschema.h:3920
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
static const t_TYPE value
Definition bslmf_integralconstant.h:258
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_INVOKE_NORETURN(X)
Definition bsls_assert.h:1895
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
int manipulateSelection(TYPE *object, MANIPULATOR &manipulator)
Definition s_baltst_address.h:66
Definition bdlat_selectioninfo.h:136
Definition bdlat_typecategory.h:1083
@ e_CHOICE_CATEGORY
Definition bdlat_typecategory.h:1047
Definition bslmf_enableif.h:525
Definition bslmf_integralconstant.h:244
Definition bslmf_isconst.h:144
Definition s_baltst_basicschemautil.h:379
static INPUT_ITERATOR forEach(INPUT_ITERATOR first, INPUT_ITERATOR last, TRANSFORM transform)
Definition s_baltst_basicschemautil.h:629
static void eraseToEnd(SEQUENCE_CONTAINER *container, typename SEQUENCE_CONTAINER::iterator position)
Definition s_baltst_basicschemautil.h:621
Definition s_baltst_basicschemautil.h:221
BasicSchemaRestrictionElement RestrictionElement
Definition s_baltst_basicschemautil.h:229
static bool isAnnotation(const ELEMENT_CHOICE_TYPE &choice)
Definition s_baltst_basicschemautil.h:540
BasicSchemaEnumerationElement EnumerationElement
Definition s_baltst_basicschemautil.h:228
BasicSchemaElement Element
Definition s_baltst_basicschemautil.h:227
static void removeAnnotations(ELEMENT_TYPE *element)
Remove all annotation sub-elements from the specified element.
Definition s_baltst_basicschemautil.h:546
BasicSchemaChoiceElement ChoiceElement
Definition s_baltst_basicschemautil.h:225
static void append(PARENT_TYPE *parent, const AnnotationElement &element)
Definition s_baltst_basicschemautil.h:476
BasicSchemaSequenceElement SequenceElement
Definition s_baltst_basicschemautil.h:230
BasicSchemaSimpleTypeElement SimpleTypeElement
Definition s_baltst_basicschemautil.h:231
BasicSchemaComplexTypeElement ComplexTypeElement
Definition s_baltst_basicschemautil.h:226
BasicSchemaAnnotationElement AnnotationElement
Definition s_baltst_basicschemautil.h:224
forward declaration
Definition s_baltst_basicschemautil.h:208
forward declaration
Definition s_baltst_basicschemautil.h:155
Definition s_baltst_basicschemautil.h:97
static bsl::enable_if<!bsl::is_const< PARENT_TYPE >::value &&IsElementOrSchema< PARENT_TYPE >::value &&IsElement< CHILD_TYPE >::value >::type append(PARENT_TYPE *parent, const CHILD_TYPE &element)
Definition s_baltst_basicschemautil.h:414
static void appendEnumeration(BasicSchemaRestrictionElement *parent, const bsl::string_view &value)
Definition s_baltst_basicschemautil.h:419
static bool areEqualUpToAnnotation(const BasicSchema &a, const BasicSchema &b)
Definition s_baltst_basicschemautil.h:427