knoaman 2003/11/21 09:19:31
Modified: c/src/xercesc/framework/psvi XSComplexTypeDefinition.hpp
XSComplexTypeDefinition.cpp XSAttributeUse.hpp
XSAttributeUse.cpp XSAttributeGroupDefinition.hpp
XSAttributeGroupDefinition.cpp
XSAttributeDeclaration.hpp
XSAttributeDeclaration.cpp
Log:
PSVI update.
Revision Changes Path
1.5 +54 -15
xml-xerces/c/src/xercesc/framework/psvi/XSComplexTypeDefinition.hpp
Index: XSComplexTypeDefinition.hpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSComplexTypeDefinition.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSComplexTypeDefinition.hpp 14 Nov 2003 22:47:53 -0000 1.4
+++ XSComplexTypeDefinition.hpp 21 Nov 2003 17:19:30 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/11/21 17:19:30 knoaman
+ * PSVI update.
+ *
* Revision 1.4 2003/11/14 22:47:53 neilg
* fix bogus log message from previous commit...
*
@@ -94,9 +97,7 @@
class XSSimpleTypeDefinition;
class XSParticle;
class XSWildcard;
-
class ComplexTypeInfo;
-class XMLStringPool;
class XMLPARSER_EXPORT XSComplexTypeDefinition : public XSTypeDefinition
{
@@ -137,9 +138,18 @@
*
* @param manager The configurable memory manager
*/
- XSComplexTypeDefinition(ComplexTypeInfo* complexTypeInfo,
- XSModel* xsModel,
- MemoryManager* const manager =
XMLPlatformUtils::fgMemoryManager);
+ XSComplexTypeDefinition
+ (
+ ComplexTypeInfo* const complexTypeInfo
+ , XSWildcard* const xsWildcard
+ , XSSimpleTypeDefinition* const xsSimpleType
+ , XSAttributeUseList* const xsAttList
+ , XSTypeDefinition* const xsBaseType
+ , XSParticle* const xsParticle
+ , XSAnnotation* const headAnnot
+ , XSModel* const xsModel
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
//@};
@@ -175,7 +185,7 @@
/**
* Optional.An attribute wildcard.
*/
- XSWildcard *getAttributeWildcard();
+ XSWildcard *getAttributeWildcard() const;
/**
* [content type]: one of empty (<code>CONTENTTYPE_EMPTY</code>), a simple
@@ -189,13 +199,13 @@
* A simple type definition corresponding to simple content model,
* otherwise <code>null</code>
*/
- XSSimpleTypeDefinition *getSimpleType();
+ XSSimpleTypeDefinition *getSimpleType() const;
/**
* A particle for mixed or element-only content model, otherwise
* <code>null</code>
*/
- XSParticle *getParticle();
+ XSParticle *getParticle() const;
/**
* [prohibited substitutions]: a subset of {extension, restriction}
@@ -211,7 +221,7 @@
* <code>DERIVATION_NONE</code> represented as a bit flag (see
* <code>XSObject</code>).
*/
- short getProhibitedSubstitutions();
+ short getProhibitedSubstitutions() const;
/**
* A set of [annotations].
@@ -270,7 +280,9 @@
//@{
+
//@}
+
private:
// -----------------------------------------------------------------------
@@ -284,13 +296,40 @@
// -----------------------------------------------------------------------
// data members
// -----------------------------------------------------------------------
- ComplexTypeInfo* fComplexTypeInfo;
- XSWildcard* fXSWildcard;
- XSAttributeUseList* fXSAttributeUseList;
- XSSimpleTypeDefinition* fXSSimpleTypeDefinition;
- XSAnnotationList* fXSAnnotationList;
- short fProhibitedSubstitution;
+ ComplexTypeInfo* fComplexTypeInfo;
+ XSWildcard* fXSWildcard;
+ XSAttributeUseList* fXSAttributeUseList;
+ XSSimpleTypeDefinition* fXSSimpleTypeDefinition;
+ XSAnnotationList* fXSAnnotationList;
+ XSParticle* fParticle;
+ short fProhibitedSubstitution;
};
+
+
+inline XSAttributeUseList* XSComplexTypeDefinition::getAttributeUses()
+{
+ return fXSAttributeUseList;
+}
+
+inline XSWildcard* XSComplexTypeDefinition::getAttributeWildcard() const
+{
+ return fXSWildcard;
+}
+
+inline XSSimpleTypeDefinition* XSComplexTypeDefinition::getSimpleType() const
+{
+ return fXSSimpleTypeDefinition;
+}
+
+inline short XSComplexTypeDefinition::getProhibitedSubstitutions() const
+{
+ return fProhibitedSubstitution;
+}
+
+inline XSParticle *XSComplexTypeDefinition::getParticle() const
+{
+ return fParticle;
+}
XERCES_CPP_NAMESPACE_END
1.6 +51 -168
xml-xerces/c/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp
Index: XSComplexTypeDefinition.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSComplexTypeDefinition.cpp 14 Nov 2003 22:47:53 -0000 1.5
+++ XSComplexTypeDefinition.cpp 21 Nov 2003 17:19:30 -0000 1.6
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.6 2003/11/21 17:19:30 knoaman
+ * PSVI update.
+ *
* Revision 1.5 2003/11/14 22:47:53 neilg
* fix bogus log message from previous commit...
*
@@ -77,98 +80,63 @@
*/
#include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp>
-#include <xercesc/validators/schema/ComplexTypeInfo.hpp>
-#include <xercesc/validators/schema/SchemaElementDecl.hpp>
-#include <xercesc/validators/schema/SchemaAttDefList.hpp>
#include <xercesc/framework/psvi/XSWildcard.hpp>
#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
#include <xercesc/framework/psvi/XSAttributeUse.hpp>
+#include <xercesc/framework/psvi/XSModel.hpp>
#include <xercesc/framework/psvi/XSAnnotation.hpp>
+#include <xercesc/validators/schema/ComplexTypeInfo.hpp>
+#include <xercesc/validators/schema/SchemaElementDecl.hpp>
+#include <xercesc/validators/schema/SchemaAttDefList.hpp>
+
XERCES_CPP_NAMESPACE_BEGIN
-XSComplexTypeDefinition::XSComplexTypeDefinition(ComplexTypeInfo*
complexTypeInfo,
- XSModel* xsModel,
- MemoryManager* const manager ):
- fComplexTypeInfo(complexTypeInfo),
- fXSWildcard(0),
- fXSAttributeUseList(0),
- fXSSimpleTypeDefinition(0),
- fProhibitedSubstitution(0),
- fXSAnnotationList(0),
- XSTypeDefinition(COMPLEX_TYPE, xsModel, manager)
+// ---------------------------------------------------------------------------
+// XSComplexTypeDefinition: Constructors and Destructor
+// ---------------------------------------------------------------------------
+XSComplexTypeDefinition::XSComplexTypeDefinition
+(
+ ComplexTypeInfo* const complexTypeInfo
+ , XSWildcard* const xsWildcard
+ , XSSimpleTypeDefinition* const xsSimpleType
+ , XSAttributeUseList* const xsAttList
+ , XSTypeDefinition* const xsBaseType
+ , XSParticle* const xsParticle
+ , XSAnnotation* const headAnnot
+ , XSModel* const xsModel
+ , MemoryManager* const manager
+)
+ : XSTypeDefinition(COMPLEX_TYPE, xsBaseType, xsModel, manager)
+ , fComplexTypeInfo(complexTypeInfo)
+ , fXSWildcard(xsWildcard)
+ , fXSAttributeUseList(xsAttList)
+ , fXSSimpleTypeDefinition(xsSimpleType)
+ , fXSAnnotationList(0)
+ , fParticle(xsParticle)
+ , fProhibitedSubstitution(0)
{
- int blockset;
- if (blockset = fComplexTypeInfo->getBlockSet())
+ int blockset = fComplexTypeInfo->getBlockSet();
+ if (blockset)
{
if (blockset & SchemaSymbols::XSD_EXTENSION)
- {
fProhibitedSubstitution |= XSConstants::DERIVATION_EXTENSION;
- }
+
if (blockset & SchemaSymbols::XSD_RESTRICTION)
- {
fProhibitedSubstitution |= XSConstants::DERIVATION_RESTRICTION;
- }
- }
-
- if (fComplexTypeInfo->getAttWildCard())
- {
- fXSWildcard = (XSWildcard*)
getObjectFromMap(fComplexTypeInfo->getAttWildCard());
- if (!fXSWildcard)
- {
- fXSWildcard = new (manager)
XSWildcard(fComplexTypeInfo->getAttWildCard(), fXSModel, manager);
- putObjectInMap((void*)fComplexTypeInfo->getAttWildCard(), fXSWildcard);
- }
- }
-
- if ((fComplexTypeInfo->getContentType() == SchemaElementDecl::Simple) &&
- (fComplexTypeInfo->getDatatypeValidator()))
- {
- fXSSimpleTypeDefinition = (XSSimpleTypeDefinition*) getObjectFromMap((void
*)fComplexTypeInfo->getDatatypeValidator());
- if (!fXSSimpleTypeDefinition)
- {
- fXSSimpleTypeDefinition = new (manager)
XSSimpleTypeDefinition(fComplexTypeInfo->getDatatypeValidator(), fXSModel, manager);
- putObjectInMap((void *)fComplexTypeInfo->getDatatypeValidator(),
fXSSimpleTypeDefinition);
- }
}
- if (fComplexTypeInfo->hasAttDefs())
+ if (headAnnot)
{
- SchemaAttDefList& schemaAttDefList = (SchemaAttDefList&)
fComplexTypeInfo->getAttDefList();
- // REVISIT: size of vector...
- fXSAttributeUseList = new (manager) RefVectorOf <XSAttributeUse> (10,
false, manager);
-
- for(unsigned int i=0; i<schemaAttDefList.getAttDefCount(); i++)
- {
- SchemaAttDef& attDef = (SchemaAttDef&) schemaAttDefList.getAttDef(i);
- XSAttributeUse* attrUse = (XSAttributeUse*)
getObjectFromMap((void*)&attDef);
- if (!attrUse)
- {
- attrUse = new (manager) XSAttributeUse(&attDef, fXSModel, manager);
- putObjectInMap((void*)&attDef, attrUse);
- }
- fXSAttributeUseList->addElement(attrUse);
- }
- }
+ // REVISIT Size
+ fXSAnnotationList = new (manager) RefVectorOf<XSAnnotation>(3, false,
manager);
+ XSAnnotation* annot = headAnnot;
- // compute fBase
- if (fComplexTypeInfo->getBaseComplexTypeInfo())
- {
- fBaseType = (XSTypeDefinition*)
getObjectFromMap(fComplexTypeInfo->getBaseComplexTypeInfo());
- if (!fBaseType)
- {
- fBaseType = new (fMemoryManager)
XSComplexTypeDefinition(fComplexTypeInfo->getBaseComplexTypeInfo(), fXSModel,
fMemoryManager);
- putObjectInMap((void*)fComplexTypeInfo->getBaseComplexTypeInfo(),
fBaseType);
- }
- }
- else if (fComplexTypeInfo->getBaseDatatypeValidator())
- {
- fBaseType = (XSTypeDefinition*)
getObjectFromMap(fComplexTypeInfo->getBaseDatatypeValidator());
- if (!fBaseType)
+ do
{
- fBaseType = new (fMemoryManager)
XSSimpleTypeDefinition(fComplexTypeInfo->getBaseDatatypeValidator(), fXSModel,
fMemoryManager);
- putObjectInMap((void*)fComplexTypeInfo->getBaseDatatypeValidator(),
fBaseType);
- }
+ fXSAnnotationList->addElement(annot);
+ annot = annot->getNext();
+ } while (annot);
}
}
@@ -177,22 +145,15 @@
// don't delete fXSWildcard - deleted by XSModel
// don't delete fXSSimpleTypeDefinition - deleted by XSModel
if (fXSAttributeUseList)
- {
delete fXSAttributeUseList;
- }
+
if (fXSAnnotationList)
- {
delete fXSAnnotationList;
- }
}
-// XSComplexTypeDefinition methods
-
-/**
- * [derivation method]: either <code>DERIVATION_EXTENSION</code>,
- * <code>DERIVATION_RESTRICTION</code>, or <code>DERIVATION_NONE</code>
- * (see <code>XSObject</code>).
- */
+// ---------------------------------------------------------------------------
+// XSComplexTypeDefinition: access methods
+// ---------------------------------------------------------------------------
XSConstants::DERIVATION_TYPE XSComplexTypeDefinition::getDerivationMethod() const
{
switch(fComplexTypeInfo->getDerivedBy()) {
@@ -205,38 +166,12 @@
}
}
-/**
- * [abstract]: a boolean. Complex types for which <code>abstract</code> is
- * true must not be used as the type definition for the validation of
- * element information items.
- */
bool XSComplexTypeDefinition::getAbstract() const
{
return fComplexTypeInfo->getAbstract();
}
-/**
- * A set of attribute uses.
- */
-XSAttributeUseList *XSComplexTypeDefinition::getAttributeUses()
-{
- return fXSAttributeUseList;
-}
-
-/**
- * Optional.An attribute wildcard.
- */
-XSWildcard *XSComplexTypeDefinition::getAttributeWildcard()
-{
- return fXSWildcard;
-}
-/**
- * [content type]: one of empty (<code>CONTENTTYPE_EMPTY</code>), a simple
- * type definition (<code>CONTENTTYPE_SIMPLE</code>), mixed (
- * <code>CONTENTTYPE_MIXED</code>), or element-only (
- * <code>CONTENTTYPE_ELEMENT</code>).
- */
XSComplexTypeDefinition::CONTENT_TYPE XSComplexTypeDefinition::getContentType()
const
{
switch(fComplexTypeInfo->getContentType()) {
@@ -254,74 +189,22 @@
}
}
-/**
- * A simple type definition corresponding to simple content model,
- * otherwise <code>null</code>
- */
-XSSimpleTypeDefinition *XSComplexTypeDefinition::getSimpleType()
-{
- return fXSSimpleTypeDefinition;
-}
-
-/**
- * A particle for mixed or element-only content model, otherwise
- * <code>null</code>
- */
-XSParticle *XSComplexTypeDefinition::getParticle()
-{
- // REVISIT
- return 0;
-}
-
-/**
- * [prohibited substitutions]: a subset of {extension, restriction}
- * @param restriction Extention or restriction constants (see
- * <code>XSObject</code>).
- * @return True if toTest is a prohibited substitution, otherwise
- * false.
- */
bool XSComplexTypeDefinition::isProhibitedSubstitution(XSConstants::DERIVATION_TYPE
toTest)
{
if (fProhibitedSubstitution & toTest)
- {
return true;
- }
- return false;
-}
-/**
- * [prohibited substitutions]: A subset of {extension, restriction} or
- * <code>DERIVATION_NONE</code> represented as a bit flag (see
- * <code>XSObject</code>).
- */
-short XSComplexTypeDefinition::getProhibitedSubstitutions()
-{
- return fProhibitedSubstitution;
+ return false;
}
-/**
- * A set of [annotations].
- */
XSAnnotationList *XSComplexTypeDefinition::getAnnotations()
{
- if (fXSAnnotationList)
- {
- return fXSAnnotationList;
- }
- // REVISIT Size
- fXSAnnotationList = new (fMemoryManager) RefVectorOf <XSAnnotation> (3, false,
fMemoryManager);
- XSAnnotation* annot = getAnnotationFromModel(fComplexTypeInfo);
- while (annot)
- {
- fXSAnnotationList->addElement(annot);
- annot = annot->getNext();
- }
return fXSAnnotationList;
}
-/**
- * virtual function from XSTypeDefinition
- */
+// ---------------------------------------------------------------------------
+// XSComplexTypeDefinition: virtual methods
+// ---------------------------------------------------------------------------
const XMLCh *XSComplexTypeDefinition::getName()
{
return fComplexTypeInfo->getTypeLocalName();
@@ -334,7 +217,7 @@
XSNamespaceItem *XSComplexTypeDefinition::getNamespaceItem()
{
- return getNamespaceItemFromHash(getNamespace());
+ return fXSModel->getNamespaceItem(getNamespace());
}
bool XSComplexTypeDefinition::getAnonymous() const
1.5 +17 -9 xml-xerces/c/src/xercesc/framework/psvi/XSAttributeUse.hpp
Index: XSAttributeUse.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSAttributeUse.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSAttributeUse.hpp 14 Nov 2003 22:47:53 -0000 1.4
+++ XSAttributeUse.hpp 21 Nov 2003 17:19:30 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/11/21 17:19:30 knoaman
+ * PSVI update.
+ *
* Revision 1.4 2003/11/14 22:47:53 neilg
* fix bogus log message from previous commit...
*
@@ -90,9 +93,6 @@
// forward declarations
class XSAttributeDeclaration;
-class SchemaAttDef;
-class XMLStringPool;
-
class XMLPARSER_EXPORT XSAttributeUse : public XSObject
{
public:
@@ -107,9 +107,12 @@
*
* @param manager The configurable memory manager
*/
- XSAttributeUse(SchemaAttDef* attDef,
- XSModel* xsModel,
- MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+ XSAttributeUse
+ (
+ XSAttributeDeclaration* const xsAttDecl,
+ XSModel* const xsModel,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
//@};
@@ -134,7 +137,7 @@
* [attribute declaration]: provides the attribute declaration itself,
* which will in turn determine the simple type definition used.
*/
- XSAttributeDeclaration *getAttrDeclaration();
+ XSAttributeDeclaration *getAttrDeclaration() const;
/**
* Value Constraint: one of default, fixed.
@@ -168,9 +171,14 @@
// -----------------------------------------------------------------------
// data members
// -----------------------------------------------------------------------
- SchemaAttDef* fAttDef;
- XSAttributeDeclaration* fXSAttributeDeclaration;
+ XSAttributeDeclaration* fXSAttributeDeclaration;
};
+
+inline XSAttributeDeclaration *XSAttributeUse::getAttrDeclaration() const
+{
+ return fXSAttributeDeclaration;
+}
+
XERCES_CPP_NAMESPACE_END
1.5 +17 -51 xml-xerces/c/src/xercesc/framework/psvi/XSAttributeUse.cpp
Index: XSAttributeUse.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSAttributeUse.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSAttributeUse.cpp 14 Nov 2003 22:47:53 -0000 1.4
+++ XSAttributeUse.cpp 21 Nov 2003 17:19:30 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/11/21 17:19:30 knoaman
+ * PSVI update.
+ *
* Revision 1.4 2003/11/14 22:47:53 neilg
* fix bogus log message from previous commit...
*
@@ -75,22 +78,18 @@
#include <xercesc/framework/psvi/XSAttributeUse.hpp>
#include <xercesc/framework/psvi/XSAttributeDeclaration.hpp>
-#include <xercesc/validators/schema/SchemaAttDef.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-XSAttributeUse::XSAttributeUse(SchemaAttDef* attDef,
- XSModel* xsModel,
- MemoryManager * const manager):
- fAttDef(attDef),
- XSObject(XSConstants::ATTRIBUTE_USE, xsModel, manager )
+// ---------------------------------------------------------------------------
+// XSAttributeUse: Constructors and Destructor
+// ---------------------------------------------------------------------------
+XSAttributeUse::XSAttributeUse(XSAttributeDeclaration* const xsAttDecl,
+ XSModel* const xsModel,
+ MemoryManager* const manager)
+ : XSObject(XSConstants::ATTRIBUTE_USE, xsModel, manager)
+ , fXSAttributeDeclaration(xsAttDecl)
{
- fXSAttributeDeclaration = (XSAttributeDeclaration*) getObjectFromMap(fAttDef);
- if (!fXSAttributeDeclaration)
- {
- fXSAttributeDeclaration = new (manager) XSAttributeDeclaration(fAttDef,
xsModel, manager);
- putObjectInMap((void*)fAttDef, fXSAttributeDeclaration);
- }
}
@@ -101,55 +100,22 @@
// XSAttributeUse methods
-/**
- * [required]: determines whether this use of an attribute declaration
- * requires an appropriate attribute information item to be present, or
- * merely allows it.
- */
+// ---------------------------------------------------------------------------
+// XSAttributeUse: access methods
+// ---------------------------------------------------------------------------
bool XSAttributeUse::getRequired() const
{
- if (fAttDef->getDefaultType() == XMLAttDef::Required ||
- fAttDef->getDefaultType() == XMLAttDef::Required_And_Fixed)
- {
- return true;
- }
- return false;
-}
-
-/**
- * [attribute declaration]: provides the attribute declaration itself,
- * which will in turn determine the simple type definition used.
- */
-XSAttributeDeclaration *XSAttributeUse::getAttrDeclaration()
-{
- return fXSAttributeDeclaration;
+ return fXSAttributeDeclaration->getRequired();
}
-/**
- * Value Constraint: one of default, fixed.
- */
XSConstants::VALUE_CONSTRAINT XSAttributeUse::getConstraintType() const
{
- // REVISIT: same as XSAttributeDeclaration????
- if (fAttDef->getDefaultType() & XMLAttDef::Default)
- {
- return XSConstants::VC_DEFAULT;
- }
- if (fAttDef->getDefaultType() & XMLAttDef::Fixed ||
- fAttDef->getDefaultType() & XMLAttDef::Required_And_Fixed)
- {
- return XSConstants::VC_FIXED;
- }
- return XSConstants::VC_NONE;
+ return fXSAttributeDeclaration->getConstraintType();
}
-/**
- * Value Constraint: The actual value.
- */
const XMLCh *XSAttributeUse::getConstraintValue()
{
- // REVISIT: same as XSAttributeDeclaration????
- return fAttDef->getValue();
+ return fXSAttributeDeclaration->getConstraintValue();
}
XERCES_CPP_NAMESPACE_END
1.5 +30 -7
xml-xerces/c/src/xercesc/framework/psvi/XSAttributeGroupDefinition.hpp
Index: XSAttributeGroupDefinition.hpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSAttributeGroupDefinition.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSAttributeGroupDefinition.hpp 14 Nov 2003 22:47:53 -0000 1.4
+++ XSAttributeGroupDefinition.hpp 21 Nov 2003 17:19:30 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/11/21 17:19:30 knoaman
+ * PSVI update.
+ *
* Revision 1.4 2003/11/14 22:47:53 neilg
* fix bogus log message from previous commit...
*
@@ -91,9 +94,7 @@
class XSAnnotation;
class XSAttributeUse;
class XSWildcard;
-
class XercesAttGroupInfo;
-class XMLStringPool;
class XMLPARSER_EXPORT XSAttributeGroupDefinition : public XSObject
{
@@ -109,9 +110,15 @@
*
* @param manager The configurable memory manager
*/
- XSAttributeGroupDefinition(XercesAttGroupInfo* xercesAttGroupInfo,
- XSModel* xsModel,
- MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+ XSAttributeGroupDefinition
+ (
+ XercesAttGroupInfo* const xercesAttGroupInfo
+ , XSAttributeUseList* const xsAttList
+ , XSWildcard* const xsWildcard
+ , XSAnnotation* const xsAnnot
+ , XSModel* const xsModel
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
//@};
@@ -133,12 +140,12 @@
/**
* Optional. A [wildcard].
*/
- XSWildcard *getAttributeWildcard();
+ XSWildcard *getAttributeWildcard() const;
/**
* Optional. An [annotation].
*/
- XSAnnotation *getAnnotation();
+ XSAnnotation *getAnnotation() const;
//@}
@@ -164,7 +171,23 @@
XercesAttGroupInfo* fXercesAttGroupInfo;
XSAttributeUseList* fXSAttributeUseList;
XSWildcard* fXSWildcard;
+ XSAnnotation* fAnnotation;
};
+
+inline XSAttributeUseList* XSAttributeGroupDefinition::getAttributeUses()
+{
+ return fXSAttributeUseList;
+}
+
+inline XSWildcard* XSAttributeGroupDefinition::getAttributeWildcard() const
+{
+ return fXSWildcard;
+}
+
+inline XSAnnotation* XSAttributeGroupDefinition::getAnnotation() const
+{
+ return fAnnotation;
+}
XERCES_CPP_NAMESPACE_END
1.5 +22 -61
xml-xerces/c/src/xercesc/framework/psvi/XSAttributeGroupDefinition.cpp
Index: XSAttributeGroupDefinition.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSAttributeGroupDefinition.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSAttributeGroupDefinition.cpp 14 Nov 2003 22:47:53 -0000 1.4
+++ XSAttributeGroupDefinition.cpp 21 Nov 2003 17:19:30 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/11/21 17:19:30 knoaman
+ * PSVI update.
+ *
* Revision 1.4 2003/11/14 22:47:53 neilg
* fix bogus log message from previous commit...
*
@@ -74,81 +77,39 @@
*/
#include <xercesc/framework/psvi/XSAttributeGroupDefinition.hpp>
-#include <xercesc/validators/schema/XercesAttGroupInfo.hpp>
#include <xercesc/framework/psvi/XSAttributeUse.hpp>
-#include <xercesc/framework/psvi/XSWildcard.hpp>
+#include <xercesc/validators/schema/XercesAttGroupInfo.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-XSAttributeGroupDefinition::XSAttributeGroupDefinition(XercesAttGroupInfo*
xercesAttGroupInfo,
- XSModel* xsModel,
- MemoryManager * const
manager):
- fXercesAttGroupInfo(xercesAttGroupInfo),
- fXSAttributeUseList(0),
- fXSWildcard(0),
- XSObject(XSConstants::ATTRIBUTE_GROUP_DEFINITION, xsModel, manager )
+// ---------------------------------------------------------------------------
+// XSAttributeGroupDefinition: Constructors and Destructor
+// ---------------------------------------------------------------------------
+XSAttributeGroupDefinition::XSAttributeGroupDefinition
+(
+ XercesAttGroupInfo* const xercesAttGroupInfo
+ , XSAttributeUseList* const xsAttList
+ , XSWildcard* const xsWildcard
+ , XSAnnotation* const xsAnnot
+ , XSModel* const xsModel
+ , MemoryManager * const manager
+)
+ : XSObject(XSConstants::ATTRIBUTE_GROUP_DEFINITION, xsModel, manager)
+ , fXercesAttGroupInfo(xercesAttGroupInfo)
+ , fXSAttributeUseList(xsAttList)
+ , fXSWildcard(xsWildcard)
+ , fAnnotation(xsAnnot)
{
- unsigned int attCount = fXercesAttGroupInfo->attributeCount();
- if (attCount)
- {
- fXSAttributeUseList = new (manager) RefVectorOf <XSAttributeUse> (attCount,
false, manager);
- for (unsigned int i=0; i < attCount; i++)
- {
- XSAttributeUse* attrUse = (XSAttributeUse*)
getObjectFromMap((void*)fXercesAttGroupInfo->attributeAt(i));
- if (!attrUse)
- {
- attrUse = new (manager)
XSAttributeUse(fXercesAttGroupInfo->attributeAt(i), fXSModel, manager);
- putObjectInMap((void*)fXercesAttGroupInfo->attributeAt(i), attrUse);
- }
- fXSAttributeUseList->addElement(attrUse);
- }
- }
-
- if (fXercesAttGroupInfo->getCompleteWildCard())
- {
- fXSWildcard = (XSWildcard*)
getObjectFromMap(fXercesAttGroupInfo->getCompleteWildCard());
- if (!fXSWildcard)
- {
- fXSWildcard = new (manager)
XSWildcard(fXercesAttGroupInfo->getCompleteWildCard(), fXSModel, manager);
- putObjectInMap((void*)fXercesAttGroupInfo->getCompleteWildCard(),
fXSWildcard);
- }
- }
}
XSAttributeGroupDefinition::~XSAttributeGroupDefinition()
{
if (fXSAttributeUseList)
- {
delete fXSAttributeUseList;
- }
- // don't delete fXSWildcard - deleted by XSModel
-}
-
-// XSAttributeGroupDefinition methods
-/**
- * A set of [attribute uses].
- */
-XSAttributeUseList *XSAttributeGroupDefinition::getAttributeUses()
-{
- return fXSAttributeUseList;
-}
-
-/**
- * Optional. A [wildcard].
- */
-XSWildcard *XSAttributeGroupDefinition::getAttributeWildcard()
-{
- return fXSWildcard;
+ // don't delete fXSWildcard - deleted by XSModel
}
-/**
- * Optional. An [annotation].
- */
-XSAnnotation *XSAttributeGroupDefinition::getAnnotation()
-{
- return getAnnotationFromModel(fXercesAttGroupInfo);
-}
XERCES_CPP_NAMESPACE_END
1.5 +36 -7
xml-xerces/c/src/xercesc/framework/psvi/XSAttributeDeclaration.hpp
Index: XSAttributeDeclaration.hpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSAttributeDeclaration.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSAttributeDeclaration.hpp 14 Nov 2003 22:47:53 -0000 1.4
+++ XSAttributeDeclaration.hpp 21 Nov 2003 17:19:30 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/11/21 17:19:30 knoaman
+ * PSVI update.
+ *
* Revision 1.4 2003/11/14 22:47:53 neilg
* fix bogus log message from previous commit...
*
@@ -91,9 +94,7 @@
class XSAnnotation;
class XSComplexTypeDefinition;
class XSSimpleTypeDefinition;
-
class SchemaAttDef;
-class XMLStringPool;
class XMLPARSER_EXPORT XSAttributeDeclaration : public XSObject
{
@@ -109,9 +110,14 @@
*
* @param manager The configurable memory manager
*/
- XSAttributeDeclaration(SchemaAttDef* attDef,
- XSModel* xsModel,
- MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+ XSAttributeDeclaration
+ (
+ SchemaAttDef* const attDef
+ , XSSimpleTypeDefinition* const typeDef
+ , XSAnnotation* const annot
+ , XSModel* const xsModel
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
//@};
@@ -160,7 +166,7 @@
/**
* [type definition]: A simple type definition
*/
- XSSimpleTypeDefinition *getTypeDefinition();
+ XSSimpleTypeDefinition *getTypeDefinition() const;
/**
* Optional. One of <code>SCOPE_GLOBAL</code>, <code>SCOPE_LOCAL</code>,
@@ -189,7 +195,7 @@
/**
* Optional. Annotation.
*/
- XSAnnotation *getAnnotation();
+ XSAnnotation *getAnnotation() const;
//@}
@@ -201,6 +207,8 @@
* Set the id to be returned on getId().
*/
void setId(unsigned int id);
+
+ bool getRequired() const;
//@}
private:
@@ -218,8 +226,29 @@
// -----------------------------------------------------------------------
SchemaAttDef* fAttDef;
XSSimpleTypeDefinition* fTypeDefinition;
+ XSAnnotation* fAnnotation;
unsigned int fId;
};
+
+// ---------------------------------------------------------------------------
+// XSAttributeDeclaration: inline methods
+// ---------------------------------------------------------------------------
+inline XSSimpleTypeDefinition* XSAttributeDeclaration::getTypeDefinition() const
+{
+ return fTypeDefinition;
+}
+
+inline void XSAttributeDeclaration::setId(unsigned int id)
+{
+ fId = id;
+}
+
+inline XSAnnotation *XSAttributeDeclaration::getAnnotation() const
+{
+ return fAnnotation;
+}
+
+
XERCES_CPP_NAMESPACE_END
1.6 +36 -68
xml-xerces/c/src/xercesc/framework/psvi/XSAttributeDeclaration.cpp
Index: XSAttributeDeclaration.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSAttributeDeclaration.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSAttributeDeclaration.cpp 14 Nov 2003 22:47:53 -0000 1.5
+++ XSAttributeDeclaration.cpp 21 Nov 2003 17:19:30 -0000 1.6
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.6 2003/11/21 17:19:30 knoaman
+ * PSVI update.
+ *
* Revision 1.5 2003/11/14 22:47:53 neilg
* fix bogus log message from previous commit...
*
@@ -77,39 +80,37 @@
*/
#include <xercesc/framework/psvi/XSAttributeDeclaration.hpp>
-#include <xercesc/validators/schema/SchemaAttDef.hpp>
-#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
-#include <xercesc/util/QName.hpp>
-#include <xercesc/util/StringPool.hpp>
#include <xercesc/framework/psvi/XSModel.hpp>
#include <xercesc/framework/psvi/XSNamespaceItem.hpp>
+#include <xercesc/util/StringPool.hpp>
#include <xercesc/validators/schema/SchemaGrammar.hpp>
+#include <xercesc/validators/schema/SchemaAttDef.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-XSAttributeDeclaration::XSAttributeDeclaration(SchemaAttDef* attDef,
- XSModel* xsModel,
- MemoryManager * const manager):
- fAttDef(attDef),
- fTypeDefinition(0),
- XSObject(XSConstants::ATTRIBUTE_DECLARATION, xsModel, manager)
-{
- if (fAttDef->getDatatypeValidator())
- {
- fTypeDefinition = (XSSimpleTypeDefinition*) getObjectFromMap((void
*)fAttDef->getDatatypeValidator());
- if (!fTypeDefinition)
- {
- fTypeDefinition = new (manager)
XSSimpleTypeDefinition(fAttDef->getDatatypeValidator(), fXSModel, manager);
- putObjectInMap((void *)fAttDef->getDatatypeValidator(),
fTypeDefinition);
- }
- }
+// ---------------------------------------------------------------------------
+// XSAttributeDeclaration: Constructors and Destructor
+// ---------------------------------------------------------------------------
+XSAttributeDeclaration::XSAttributeDeclaration(SchemaAttDef* const attDef,
+ XSSimpleTypeDefinition* const
typeDef,
+ XSAnnotation* const annot,
+ XSModel* const
xsModel,
+ MemoryManager * const
manager)
+ : XSObject(XSConstants::ATTRIBUTE_DECLARATION, xsModel, manager)
+ , fAttDef(attDef)
+ , fTypeDefinition(typeDef)
+ , fAnnotation(annot)
+{
}
XSAttributeDeclaration::~XSAttributeDeclaration()
{
// don't delete fTypeDefinition - deleted by XSModel
}
-// XSObject methods
+
+// ---------------------------------------------------------------------------
+// XSAttributeDeclaration: XSObject virtual methods
+// ---------------------------------------------------------------------------
const XMLCh *XSAttributeDeclaration::getName()
{
return fAttDef->getAttName()->getLocalPart();
@@ -122,24 +123,18 @@
XSNamespaceItem *XSAttributeDeclaration::getNamespaceItem()
{
- return getNamespaceItemFromHash(getNamespace());
+ return fXSModel->getNamespaceItem(getNamespace());
}
-// XSAttributeDeclaration methods
-
-/**
- * [type definition]: A simple type definition
- */
-XSSimpleTypeDefinition *XSAttributeDeclaration::getTypeDefinition()
+unsigned int XSAttributeDeclaration::getId() const
{
- return fTypeDefinition;
+ return fId;
}
-/**
- * Optional. One of <code>SCOPE_GLOBAL</code>, <code>SCOPE_LOCAL</code>,
- * or <code>SCOPE_ABSENT</code>. If the scope is local, then the
- * <code>enclosingCTDefinition</code> is present.
- */
+
+// ---------------------------------------------------------------------------
+// XSAttributeDeclaration: access methods
+// ---------------------------------------------------------------------------
XSConstants::SCOPE XSAttributeDeclaration::getScope() const
{
// REVISIT: review... what about SCOPE_ABSENT?
@@ -149,64 +144,37 @@
if (((XSAttributeDeclaration*)
this)->getNamespaceItem()->getSchemaGrammar()->getAttributeDeclRegistry()->get(fAttDef))
return XSConstants::SCOPE_GLOBAL;
return XSConstants::SCOPE_LOCAL;
-
}
-/**
- * The complex type definition for locally scoped declarations (see
- * <code>scope</code>).
- */
XSComplexTypeDefinition *XSAttributeDeclaration::getEnclosingCTDefinition()
{
- // REVISIT
return 0;
}
-/**
- * Value constraint: one of <code>VC_NONE, VC_DEFAULT, VC_FIXED</code>.
- */
XSConstants::VALUE_CONSTRAINT XSAttributeDeclaration::getConstraintType() const
{
if (fAttDef->getDefaultType() & XMLAttDef::Default)
- {
return XSConstants::VC_DEFAULT;
- }
+
if (fAttDef->getDefaultType() & XMLAttDef::Fixed ||
fAttDef->getDefaultType() & XMLAttDef::Required_And_Fixed)
- {
return XSConstants::VC_FIXED;
- }
+
return XSConstants::VC_NONE;
}
-/**
- * Value constraint: The actual value with respect to the [type definition
- * ].
- */
const XMLCh *XSAttributeDeclaration::getConstraintValue()
{
return fAttDef->getValue();
}
-/**
- * Optional. Annotation.
- */
-XSAnnotation *XSAttributeDeclaration::getAnnotation()
+bool XSAttributeDeclaration::getRequired() const
{
- return getAnnotationFromModel(fAttDef);
-}
+ if (fAttDef->getDefaultType() == XMLAttDef::Required ||
+ fAttDef->getDefaultType() == XMLAttDef::Required_And_Fixed)
+ return true;
-/**
- * Process Id
- */
-void XSAttributeDeclaration::setId(unsigned int id)
-{
- fId = id;
-}
-
-unsigned int XSAttributeDeclaration::getId() const
-{
- return fId;
+ return false;
}
XERCES_CPP_NAMESPACE_END
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]