29#include "WSRestriction.h"
33#include <sptk5/wsdl/WSBasicTypes.h>
34#include <sptk5/xdoc/Document.h>
108class WSParserComplexType;
110using SWSParserAttribute = std::shared_ptr<WSParserAttribute>;
111using SWSParserComplexType = std::shared_ptr<WSParserComplexType>;
112using WSParserComplexTypeList = std::list<SWSParserComplexType>;
132 const String& typeName =
"");
157 return m_multiplicity;
183 return m_restriction;
199 void generate(std::ostream& classDeclaration, std::ostream& classImplementation,
200 const String& externalHeader,
const String& serviceNamespace)
const;
202 static std::map<String, xdoc::SNode> SimpleTypeElements;
204 static xdoc::SNode findSimpleType(
const String& typeName);
213 const String& serviceNamespace)
const;
221 const String& serviceNamespace)
const;
227 Strings ctor {
"WSComplexType(elementName, optional)"};
228 Strings copyCtor {
"WSComplexType(other)"};
229 Strings moveCtor {
"WSComplexType(std::move(other))"};
234 class ImplementationParts
237 std::stringstream declarations;
238 std::stringstream body;
239 std::stringstream checks;
241 size_t restrictionNumber {0};
243 void print(std::ostream& output)
const;
249 using AttributeMap = std::map<std::string, SWSParserAttribute, std::less<>>;
253 xdoc::SNode m_element;
254 AttributeMap m_attributes;
255 WSParserComplexTypeList m_sequence;
257 SWSRestriction m_restriction;
258 String m_documentation;
265 static void printImplementationIncludes(std::ostream& classImplementation,
const String& className);
267 void printImplementationRestrictions(std::ostream& classImplementation, std::ostream& checks)
const;
269 static void printDeclarationIncludes(std::ostream& classDeclaration,
const std::set<String>& usedClasses);
271 std::set<String> getUsedClasses()
const;
273 static void appendMemberDocumentation(std::ostream& classDeclaration,
const SWSParserComplexType& complexType);
275 void appendClassAttributes(std::ostream& classDeclaration, Strings& fieldNames,
276 Initializer& initializer)
const;
278 String addOptionalRestriction(std::ostream& implementation,
const SWSParserComplexType& complexType,
279 size_t& restrictionIndex)
const;
281 static String makeTagName(
const String& className);
283 Initializer makeInitializer()
const;
285 void printImplementationConstructors(std::ostream& classImplementation,
const String& className,
286 const Strings& elementNames,
const Strings& attributeNames)
const;
288 void printImplementationCheckRestrictions(std::ostream& classImplementation,
const String& className)
const;
290 static void generateSetFieldIndex(std::ostream& classDeclaration,
const Strings& elementNames,
291 const Strings& attributeNames);
Definition: WSParserComplexType.h:58
String name() const
Definition: WSParserComplexType.h:76
String generate(bool initialize) const
String cxxTypeName() const
Definition: WSParserComplexType.h:89
String wsTypeName() const
Definition: WSParserComplexType.h:97
WSParserAttribute(const String &name="", const String &typeName="")
WSParserAttribute(const WSParserAttribute &attr)=default
Definition: WSParserComplexType.h:118
String name() const
Definition: WSParserComplexType.h:142
WSMultiplicity multiplicity() const
Definition: WSParserComplexType.h:155
void generateImplementation(std::ostream &classImplementation, const Strings &fieldNames, const Strings &elementNames, const Strings &attributeNames, const String &serviceNamespace) const
WSParserComplexTypeList sequence() const
Definition: WSParserComplexType.h:172
SWSRestriction restriction() const
Definition: WSParserComplexType.h:181
void generate(std::ostream &classDeclaration, std::ostream &classImplementation, const String &externalHeader, const String &serviceNamespace) const
void generateDefinition(std::ostream &classDeclaration, sptk::Strings &fieldNames, sptk::Strings &elementNames, sptk::Strings &attributeNames, const String &serviceNamespace) const
static String wsClassName(const String &className)
bool isArray() const
Definition: WSParserComplexType.h:163
virtual ~WSParserComplexType()=default
void parseSequence(const xdoc::SNode &sequence)
WSParserComplexType(const xdoc::SNode &complexTypeElement, const String &name="", const String &typeName="")
std::map< String, SWSParserComplexType > WSComplexTypeMap
Definition: WSParserComplexType.h:302
WSMultiplicity
Definition: WSParserComplexType.h:47
@ ZERO_OR_ONE
Element is optional.
@ ZERO_OR_MORE
Element may occur 0 or more times.
@ REQUIRED
Element is required.
@ ONE_OR_MORE
Element may occur one or more times.