[xsd-users] Map types on std::pair and std::map
Chris Delnooz
Chris.Delnooz at hydrix.com
Tue Dec 3 21:41:40 EST 2013
Hi all,
I am wondering if it would be possible to map certain complex types onto std::pair and std::map or something that behaves similarly. Basically, I have the following types:
<xs:complexType name="LabelWeight">
<xs:sequence/>
<xs:attribute name="label" use="optional" type="xs:integer"/>
<xs:attribute name="weight" use="optional" type="xs:integer"/>
</xs:complexType>
Ideally, I would like to map this on a std::pair<int, int>, I have the feeling I should be able to do that with a bit of tinkering along the lines of the xsd:datetime example, but I can't quite grasp it yet.
In the second case, I have something like the following snippet
<xs:complexType name="Settings">
<xs:sequence>
<xs:element name="allowedFeatures" type="EnabledFeatures" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EnabledFeatures">
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="features" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
In this case I would ideally end up with "allowedFeatures" being a std::map<string, sequence<bool> >. This would probably involve mapping EnabledFeatures onto a pair again, but is there any way to generate a map-like container out of the "allowedFeatures" association?
Any thoughts would be greatly appreciated!
Chris Delnooz | Software Architect
chris.delnooz at hydrix.com
Hydrix: Our Expertise - Your Competitive Advantage
www.hydrix.com | fax +61 3 8573 5289 | direct +61 3 8573 5248
More information about the xsd-users
mailing list