home *** CD-ROM | disk | FTP | other *** search
Wrap
//////////////////////////////////////////////////////////////////////// // // [=$module].cpp // // This file was generated by XMLSPY 5 Enterprise Edition. // // YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE // OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION. // // Refer to the XMLSPY Documentation for further details. // http://www.altova.com/xmlspy // //////////////////////////////////////////////////////////////////////// #include "StdAfx.h" #include "[=$module].h" [if $domtype = 1] void C[=$module]Doc::DeclareNamespaces(CNode& rNode) { [foreach $namespace in $namespaces if $namespace.URI <> "" ] DeclareNamespace(rNode, _T("[=$namespace.Prefix]"), _T("[=$namespace.URI]")); [ endif next ]} [else] void C[=$module]Doc::DeclareNamespaces(xercesc::DOMElement* pElement) { [foreach $namespace in $namespaces if $namespace.URI <> "" ] DeclareNamespace(pElement, _T("[=$namespace.Prefix]"), _T("[=$namespace.URI]")); [ endif next ]} [endif] [ foreach $class in $classes : if not $class.IsInternal if $class.NamespacePrefix <> "" ]namespace [=$class.NamespacePrefix][if $class.NamespaceURI <> ""] // URI: [=$class.NamespaceURI][endif] { [ endif ]//////////////////////////////////////////////////////////////////////// // // class [=$class.Name] // //////////////////////////////////////////////////////////////////////// [ if $class.IsComplexType if not $class.IsComplexFromSimpleType ]CNode::EGroupType [=$class.Name]::GetGroupType() { [ if $class.IsChoice ] return eChoice; [ else : if $class.IsAll ] return eAll; [ else ] return eSequence; [ endif : endif ]} [if $domtype = 2] void [=$class.Name]::AdjustPrefix() { int i, nCount; [ foreach $member in $class.Members if $member.IsQualified $IsQualified = "true" else $IsQualified = "false" endif if $member.HasTypeObject if $member.TypeObject.NamespacePrefix <> $class.NamespacePrefix $QualifiedType = $member.TypeObject.NamespacePrefix & "::" & $member.Type else $QualifiedType = $member.Type endif else $QualifiedType = $member.Type endif ] nCount = ChildCountInternal([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$member.SchemaName]")); for (i = 0; i < nCount; i++) { [if $domtype = 1]MSXML2::IXMLDOMNodePtr[else]xercesc::DOMNode*[endif] pDOMNode = InternalGetAt([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$member.SchemaName]"), i); InternalAdjustPrefix(pDOMNode, [=$IsQualified]); [ if $member.HasTypeObject and $member.TypeObject.IsComplexType ] [=$QualifiedType](pDOMNode).AdjustPrefix(); [ endif ] } [ next ]} [endif] [ endif foreach $member in $class.Members if $domtype = 1 $QualifiedName = $member.XmlName else $QualifiedName = $member.SchemaName endif if $member.HasTypeObject if $member.TypeObject.NamespacePrefix <> $class.NamespacePrefix $QualifiedType = $member.TypeObject.NamespacePrefix & "::" & $member.Type else $QualifiedType = $member.Type endif else $QualifiedType = $member.Type endif ]int [=$class.Name]::Get[=$member.Name]MinCount() { return [=$member.MinOcc]; } int [=$class.Name]::Get[=$member.Name]MaxCount() { return [if $member.MaxOcc = -1]INT_MAX[else][=$member.MaxOcc][endif]; } int [=$class.Name]::Get[=$member.Name]Count() { return ChildCountInternal([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]")); } bool [=$class.Name]::Has[=$member.Name]() { return InternalHasChild([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]")); } [ if $member.IsSimpleType ]void [=$class.Name]::Add[=$member.Name]([=$QualifiedType] [=$member.Name]) { InternalAppend([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), [=$member.Name]); } void [=$class.Name]::Insert[=$member.Name]At([=$QualifiedType] [=$member.Name], int nIndex) { InternalInsertAt([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), nIndex, [=$member.Name]); } void [=$class.Name]::Replace[=$member.Name]At([=$QualifiedType] [=$member.Name], int nIndex) { InternalReplaceAt([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), nIndex, [=$member.Name]); } [ else ]void [=$class.Name]::Add[=$member.Name]([=$QualifiedType]& [=$member.Name]) { InternalAppendNode(_T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), [=$member.Name]); } void [=$class.Name]::Insert[=$member.Name]At([=$QualifiedType]& [=$member.Name], int nIndex) { InternalInsertNodeAt(_T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), nIndex, [=$member.Name]); } void [=$class.Name]::Replace[=$member.Name]At([=$QualifiedType]& [=$member.Name], int nIndex) { InternalReplaceNodeAt(_T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), nIndex, [=$member.Name]); } [ endif ] [if $domtype = 1] [=$QualifiedType] [=$class.Name]::Get[=$member.Name]At(int nIndex) { [ if $member.IsSimpleType ] return (LPCTSTR)InternalGetAt([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), nIndex)->text; [ else ] return [=$QualifiedType](*this, InternalGetAt([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), nIndex)); [ endif ]} [else] [=$QualifiedType] [=$class.Name]::Get[=$member.Name]At(int nIndex) { [ if $member.IsSimpleType ] return InternalGetNodeValue([=$member.NodeType], InternalGetAt([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), nIndex)).c_str(); [ else ] return [=$QualifiedType](InternalGetAt([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), nIndex)); [ endif ]} [endif] [=$QualifiedType] [=$class.Name]::Get[=$member.Name]() { return Get[=$member.Name]At(0); } void [=$class.Name]::Remove[=$member.Name]At(int nIndex) { InternalRemoveAt([=$member.NodeType], _T("[=$member.NamespaceURI]"), _T("[=$QualifiedName]"), nIndex); } void [=$class.Name]::Remove[=$member.Name]() { [ if $member.MaxOcc > 1 ] Remove[=$member.Name]At(0); [ else ] while (Has[=$member.Name]()) Remove[=$member.Name]At(0); [endif ]} [ next else : if $class.IsSimpleType if $class.Base = $class.BuiltInBase $IsDirectChild = true else $IsDirectChild = false endif ][=$class.Name]::[=$class.Name]([=$class.BuiltInBase]::basetype Value) : [=$class.Base](Value) { Validate(); } [=$class.Name]::[=$class.Name](tstring Value) : [=$class.Base](Value.c_str()) { Validate(); } void [=$class.Name]::Validate() { [ $BuiltInType = $class.BuiltInSchemaBase if $BuiltInType = "base64Binary" or $BuiltInType = "hexBinary" $InstanceLength = "m_nSize" else $InstanceLength = "m_Value.size()" endif if $BuiltInType = "time" or $BuiltInType = "date" or $BuiltInType = "dateTime" $InstanceValue = "*this" else $InstanceValue = "m_Value" endif if $BuiltInType = "duration" or $BuiltInType = "gYear" or $BuiltInType = "gYearMonth" or $BuiltInType = "gMonth" or $BuiltInType = "gMonthDay" or $BuiltInType = "gDay" $AllowComparison = false else $AllowComparison = true endif foreach $facet in $class.Facets if $facet.IsMinLength ] if ([=$InstanceLength] < GetMinLength()) throw CXmlException(CXmlException::eError1, _T("Validation error")); [ else:if $facet.IsMaxLength ] if ([=$InstanceLength] > GetMaxLength()) throw CXmlException(CXmlException::eError1, _T("Validation error")); [ else:if $facet.IsLength ] if ([=$InstanceLength] != GetLength()) throw CXmlException(CXmlException::eError1, _T("Validation error")); [ else:if $facet.IsMinInclusive and $AllowComparison ] if ([=$InstanceValue] < GetMinInclusive()) throw CXmlException(CXmlException::eError1, _T("Validation error")); [ else:if $facet.IsMinExclusive and $AllowComparison ] if ([=$InstanceValue] <= GetMinExclusive()) throw CXmlException(CXmlException::eError1, _T("Validation error")); [ else:if $facet.IsMaxExclusive and $AllowComparison ] if ([=$InstanceValue] >= GetMaxExclusive()) throw CXmlException(CXmlException::eError1, _T("Validation error")); [ else:if $facet.IsMaxInclusive and $AllowComparison ] if ([=$InstanceValue] > GetMaxInclusive()) throw CXmlException(CXmlException::eError1, _T("Validation error")); [ else:if $facet.IsTotalDigits else:if $facet.IsFractionDigits else:if $facet.IsWhiteSpace else:if $facet.IsPattern else:if $facet.IsEnumeration endif:endif:endif:endif:endif:endif:endif:endif:endif:endif:endif:endif next ]} [ endif : endif if $class.NamespacePrefix <> "" ]} // end of namespace [=$class.NamespacePrefix] [ endif endif : next ]