Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
utility::tag::XMLSchemaSimpleSubelementList Class Reference

The XMLSchemaSimpleSubelementList class defines an interface that can be used by those wishing to define a complexType that contains sub-elements. The structure of the XML Schema for the sub-elements will determined by how this list is given to the XMLSchemaComplexTypeGenerator. "simple" subelements are those which themselves contain no subelements (but may contain attributes). Also allowed are subelements that refer to previously-defined complexTypes or those that refer to previously defined xs:groups. More...

#include <XMLSchemaGeneration.hh>

Inheritance diagram for utility::tag::XMLSchemaSimpleSubelementList:
Inheritance graph
[legend]

Classes

struct  ElementSummary
 

Public Types

typedef std::function
< std::string(std::string
const &) > 
DerivedNameFunction
 
typedef std::function
< std::string() > 
NameFunction
 

Public Member Functions

 XMLSchemaSimpleSubelementList ()
 
 ~XMLSchemaSimpleSubelementList () override
 
 XMLSchemaSimpleSubelementList (XMLSchemaSimpleSubelementList const &src)
 
XMLSchemaSimpleSubelementListoperator= (XMLSchemaSimpleSubelementList const &rhs)
 
XMLSchemaSimpleSubelementListcomplex_type_naming_func (DerivedNameFunction const &naming_function)
 the naming function is required if this subelement list is going to be repeatable More...
 
XMLSchemaSimpleSubelementListadd_simple_subelement (std::string const &name, AttributeList const &, std::string const &description)
 Add a new subelement to the growing list of subelements, defined by its name and a (possibly empty) list of attributes This subelement may not itself contain other subelements, however. The name for the complexType of this element will be derived from the function given in complex_type_naming_func, if provided, and otherwise, the complexType for this element will be listed within the element declaration and will be unnamed. More...
 
XMLSchemaSimpleSubelementListadd_simple_subelement (std::string const &name, AttributeList const &, std::string const &description, int min_occurs, int max_occurs=xsminmax_unspecified)
 Add a new subelement to the growing list of subelements, but where the minimum and maximum number of occurrences for this subelement has been set; note: usually, the min and max are set by the XMLSchemaComplexTypeGenerator, and so tension could arise between the generator and your settings. Consider this an advanced function. More...
 
XMLSchemaSimpleSubelementListadd_already_defined_subelement (std::string const &name, DerivedNameFunction const &ct_naming_function)
 Add a new subelement to the growing list of subelements, but one whose complexType definition has been provided elsewhere and where the name of the complexType for this subelement is derived from the subelement's name using the provided function. (Why pass a function to define the name for the complex type instead of just passing the result of the function? Because such an interface would also let you bypass a function entirely and let you pass in a raw string, and that would lead to brittle code. If we should want to change the complexType naming rule for a particular class of elements in the schema, we want to be able to change only a single function and have that change ripple outwards through all the parts of the schema that interacted with those elements.) More...
 
XMLSchemaSimpleSubelementListadd_already_defined_subelement (std::string const &name, DerivedNameFunction const &ct_naming_function, int min_occurs, int max_occurs=xsminmax_unspecified)
 Add a new subelement to the growing list of subelements, but where the minimum and maximum number of occurrences for this subelement has been set; note: usually, the min and max are set by the XMLSchemaComplexTypeGenerator, and so tension could arise between the generator and your settings. Consider this an advanced function. More...
 
XMLSchemaSimpleSubelementListadd_already_defined_subelement_w_alt_element_name (std::string const &alt_element_name, std::string const &reference_element_name, DerivedNameFunction const &ct_naming_function)
 Add a subelement with a different name than the complex type was created with so that to get the correct name for the complex type, the original name must also be provided. E.g. The PROTOCOLS subelement takes its structure from the ParsedProtocol mover. Instead of duplicating the complex type for that mover, instead, create an element whose type will be given by the protocols::moves::complex_type_name_for_mover function when given the "ParsedProtocol" element name. More...
 
XMLSchemaSimpleSubelementListadd_already_defined_subelement_w_alt_element_name (std::string const &alt_element_name, std::string const &reference_element_name, DerivedNameFunction const &ct_naming_function, int min_occurs, int max_occurs=xsminmax_unspecified)
 Add a subelement with a different name than the complex type was created with so that to get the correct name for the complex type, the original name must also be provided. E.g. The PROTOCOLS subelement takes its structure from the ParsedProtocol mover. Instead of duplicating the complex type for that mover, instead, create an element whose type will be given by the protocols::moves::complex_type_name_for_mover function when given the "ParsedProtocol" element name. More...
 
XMLSchemaSimpleSubelementListadd_group_subelement (NameFunction const &group_name_function)
 Add a new subelement to the growing list of subelements which refers to an already existing group whose name is given by the input function. More...
 
XMLSchemaSimpleSubelementListadd_group_subelement (NameFunction const &group_name_function, int min_occurs, int max_occurs=xsminmax_unspecified)
 Add a new subelement to the growing list of subelements, but where the minimum and maximum number of occurrences for this subelement has been set; note: usually, the min and max are set by the XMLSchemaComplexTypeGenerator, and so tension could arise between the generator and your settings. Consider this an advanced function. More...
 
XMLSchemaSimpleSubelementListadd_subelement (ElementSummary const &summary)
 Really only intended to be used by the XMLSchemaRepeatableCTNode. More...
 
bool simple_element_naming_func_has_been_set () const
 
std::string complex_typename_for_element (std::string const &element_name) const
 
DerivedNameFunction naming_func () const
 
std::list< ElementSummary > const & element_list () const
 
- Public Member Functions inherited from utility::VirtualBase
 VirtualBase ()=default
 Default constructor. More...
 
virtual ~VirtualBase ()=default
 The virtual destructor is one of the main reasons for the VirtualBase class. More...
 
 VirtualBase (VirtualBase const &)=default
 
 VirtualBase (VirtualBase &&)=default
 
VirtualBaseoperator= (VirtualBase const &)=default
 
VirtualBaseoperator= (VirtualBase &&)=default
 

Static Public Member Functions

static ElementSummary element_summary_as_simple_subelement (std::string const &name, AttributeList const &attributes, std::string const &description)
 
static ElementSummary element_summary_as_simple_subelement (std::string const &name, AttributeList const &attributes, std::string const &description, int min_occurs, int max_occurs)
 
static ElementSummary element_summary_as_already_defined_subelement (std::string const &name, DerivedNameFunction const &ct_naming_function)
 
static ElementSummary element_summary_as_already_defined_subelement (std::string const &name, DerivedNameFunction const &ct_naming_function, int min_occurs, int max_occurs)
 
static ElementSummary element_summary_as_already_defined_subelement_w_alt_element_name (std::string const &alt_element_name, std::string const &reference_element_name, DerivedNameFunction const &ct_naming_function)
 
static ElementSummary element_summary_as_already_defined_subelement_w_alt_element_name (std::string const &alt_element_name, std::string const &reference_element_name, DerivedNameFunction const &ct_naming_function, int min_occurs, int max_occurs)
 
static ElementSummary element_summary_as_group_subelement (NameFunction const &group_name_function)
 
static ElementSummary element_summary_as_group_subelement (NameFunction const &group_name_function, int min_occurs, int max_occurs)
 

Private Attributes

DerivedNameFunction ct_naming_func_for_simple_subelements_
 
std::list< ElementSummaryelements_
 

Detailed Description

The XMLSchemaSimpleSubelementList class defines an interface that can be used by those wishing to define a complexType that contains sub-elements. The structure of the XML Schema for the sub-elements will determined by how this list is given to the XMLSchemaComplexTypeGenerator. "simple" subelements are those which themselves contain no subelements (but may contain attributes). Also allowed are subelements that refer to previously-defined complexTypes or those that refer to previously defined xs:groups.

Member Typedef Documentation

typedef std::function< std::string ( std::string const & ) > utility::tag::XMLSchemaSimpleSubelementList::DerivedNameFunction

Constructor & Destructor Documentation

utility::tag::XMLSchemaSimpleSubelementList::XMLSchemaSimpleSubelementList ( )
default
utility::tag::XMLSchemaSimpleSubelementList::~XMLSchemaSimpleSubelementList ( )
overridedefault
utility::tag::XMLSchemaSimpleSubelementList::XMLSchemaSimpleSubelementList ( XMLSchemaSimpleSubelementList const &  src)

Member Function Documentation

XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::add_already_defined_subelement ( std::string const &  name,
DerivedNameFunction const &  ct_naming_function 
)

Add a new subelement to the growing list of subelements, but one whose complexType definition has been provided elsewhere and where the name of the complexType for this subelement is derived from the subelement's name using the provided function. (Why pass a function to define the name for the complex type instead of just passing the result of the function? Because such an interface would also let you bypass a function entirely and let you pass in a raw string, and that would lead to brittle code. If we should want to change the complexType naming rule for a particular class of elements in the schema, we want to be able to change only a single function and have that change ripple outwards through all the parts of the schema that interacted with those elements.)

References element_summary_as_already_defined_subelement(), and elements_.

Referenced by basic::resource_manager::ResourceManager::schema_for_resource_definition_file().

XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::add_already_defined_subelement ( std::string const &  name,
DerivedNameFunction const &  ct_naming_function,
int  min_occurs,
int  max_occurs = xsminmax_unspecified 
)

Add a new subelement to the growing list of subelements, but where the minimum and maximum number of occurrences for this subelement has been set; note: usually, the min and max are set by the XMLSchemaComplexTypeGenerator, and so tension could arise between the generator and your settings. Consider this an advanced function.

References element_summary_as_already_defined_subelement(), and elements_.

XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::add_already_defined_subelement_w_alt_element_name ( std::string const &  alt_element_name,
std::string const &  reference_element_name,
DerivedNameFunction const &  ct_naming_function 
)

Add a subelement with a different name than the complex type was created with so that to get the correct name for the complex type, the original name must also be provided. E.g. The PROTOCOLS subelement takes its structure from the ParsedProtocol mover. Instead of duplicating the complex type for that mover, instead, create an element whose type will be given by the protocols::moves::complex_type_name_for_mover function when given the "ParsedProtocol" element name.

References element_summary_as_already_defined_subelement_w_alt_element_name(), and elements_.

XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::add_already_defined_subelement_w_alt_element_name ( std::string const &  alt_element_name,
std::string const &  reference_element_name,
DerivedNameFunction const &  ct_naming_function,
int  min_occurs,
int  max_occurs = xsminmax_unspecified 
)

Add a subelement with a different name than the complex type was created with so that to get the correct name for the complex type, the original name must also be provided. E.g. The PROTOCOLS subelement takes its structure from the ParsedProtocol mover. Instead of duplicating the complex type for that mover, instead, create an element whose type will be given by the protocols::moves::complex_type_name_for_mover function when given the "ParsedProtocol" element name.

References element_summary_as_already_defined_subelement_w_alt_element_name(), and elements_.

XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::add_group_subelement ( NameFunction const &  group_name_function)

Add a new subelement to the growing list of subelements which refers to an already existing group whose name is given by the input function.

References element_summary_as_group_subelement(), and elements_.

XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::add_group_subelement ( NameFunction const &  group_name_function,
int  min_occurs,
int  max_occurs = xsminmax_unspecified 
)

Add a new subelement to the growing list of subelements, but where the minimum and maximum number of occurrences for this subelement has been set; note: usually, the min and max are set by the XMLSchemaComplexTypeGenerator, and so tension could arise between the generator and your settings. Consider this an advanced function.

References element_summary_as_group_subelement(), and elements_.

XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::add_simple_subelement ( std::string const &  name,
AttributeList const &  attributes,
std::string const &  description 
)

Add a new subelement to the growing list of subelements, defined by its name and a (possibly empty) list of attributes This subelement may not itself contain other subelements, however. The name for the complexType of this element will be derived from the function given in complex_type_naming_func, if provided, and otherwise, the complexType for this element will be listed within the element declaration and will be unnamed.

References CREATE_EXCEPTION, element_summary_as_simple_subelement(), elements_, and utility::tag::string_contains_gt_lt_or_ampersand().

XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::add_simple_subelement ( std::string const &  name,
AttributeList const &  attributes,
std::string const &  description,
int  min_occurs,
int  max_occurs = xsminmax_unspecified 
)

Add a new subelement to the growing list of subelements, but where the minimum and maximum number of occurrences for this subelement has been set; note: usually, the min and max are set by the XMLSchemaComplexTypeGenerator, and so tension could arise between the generator and your settings. Consider this an advanced function.

References CREATE_EXCEPTION, element_summary_as_simple_subelement(), elements_, and utility::tag::string_contains_gt_lt_or_ampersand().

XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::add_subelement ( ElementSummary const &  summary)
XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::complex_type_naming_func ( DerivedNameFunction const &  naming_function)

the naming function is required if this subelement list is going to be repeatable

References ct_naming_func_for_simple_subelements_.

Referenced by utility::tag::XMLSchemaRepeatableCTNode::recursively_write_ct_to_schema().

std::string utility::tag::XMLSchemaSimpleSubelementList::complex_typename_for_element ( std::string const &  element_name) const
std::list< XMLSchemaSimpleSubelementList::ElementSummary > const & utility::tag::XMLSchemaSimpleSubelementList::element_list ( ) const
XMLSchemaSimpleSubelementList::ElementSummary utility::tag::XMLSchemaSimpleSubelementList::element_summary_as_already_defined_subelement ( std::string const &  name,
DerivedNameFunction const &  ct_naming_function 
)
static
XMLSchemaSimpleSubelementList::ElementSummary utility::tag::XMLSchemaSimpleSubelementList::element_summary_as_already_defined_subelement ( std::string const &  name,
DerivedNameFunction const &  ct_naming_function,
int  min_occurs,
int  max_occurs 
)
static
XMLSchemaSimpleSubelementList::ElementSummary utility::tag::XMLSchemaSimpleSubelementList::element_summary_as_already_defined_subelement_w_alt_element_name ( std::string const &  alt_element_name,
std::string const &  reference_element_name,
DerivedNameFunction const &  ct_naming_function 
)
static
XMLSchemaSimpleSubelementList::ElementSummary utility::tag::XMLSchemaSimpleSubelementList::element_summary_as_already_defined_subelement_w_alt_element_name ( std::string const &  alt_element_name,
std::string const &  reference_element_name,
DerivedNameFunction const &  ct_naming_function,
int  min_occurs,
int  max_occurs 
)
static
XMLSchemaSimpleSubelementList::ElementSummary utility::tag::XMLSchemaSimpleSubelementList::element_summary_as_group_subelement ( NameFunction const &  group_name_function)
static
XMLSchemaSimpleSubelementList::ElementSummary utility::tag::XMLSchemaSimpleSubelementList::element_summary_as_group_subelement ( NameFunction const &  group_name_function,
int  min_occurs,
int  max_occurs 
)
static
XMLSchemaSimpleSubelementList::ElementSummary utility::tag::XMLSchemaSimpleSubelementList::element_summary_as_simple_subelement ( std::string const &  name,
AttributeList const &  attributes,
std::string const &  description 
)
static
XMLSchemaSimpleSubelementList::ElementSummary utility::tag::XMLSchemaSimpleSubelementList::element_summary_as_simple_subelement ( std::string const &  name,
AttributeList const &  attributes,
std::string const &  description,
int  min_occurs,
int  max_occurs 
)
static
XMLSchemaSimpleSubelementList::DerivedNameFunction utility::tag::XMLSchemaSimpleSubelementList::naming_func ( ) const
XMLSchemaSimpleSubelementList & utility::tag::XMLSchemaSimpleSubelementList::operator= ( XMLSchemaSimpleSubelementList const &  rhs)
bool utility::tag::XMLSchemaSimpleSubelementList::simple_element_naming_func_has_been_set ( ) const

Member Data Documentation

DerivedNameFunction utility::tag::XMLSchemaSimpleSubelementList::ct_naming_func_for_simple_subelements_
private
std::list< ElementSummary > utility::tag::XMLSchemaSimpleSubelementList::elements_
private

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