You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/05/03 23:09:55 UTC
cvs commit: xml-xerces/c/src/validators/datatype DatatypeValidator.cpp DatatypeValidator.hpp
tng 01/05/03 14:09:55
Modified: c/src/validators/datatype DatatypeValidator.cpp
DatatypeValidator.hpp
Log:
Schema: DatatypeValidator Update. By Pei Yong Zhang.
Revision Changes Path
1.3 +9 -1 xml-xerces/c/src/validators/datatype/DatatypeValidator.cpp
Index: DatatypeValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/DatatypeValidator.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DatatypeValidator.cpp 2001/05/03 19:17:43 1.2
+++ DatatypeValidator.cpp 2001/05/03 21:09:52 1.3
@@ -56,6 +56,9 @@
/*
* $Log: DatatypeValidator.cpp,v $
+ * Revision 1.3 2001/05/03 21:09:52 tng
+ * Schema: DatatypeValidator Update. By Pei Yong Zhang.
+ *
* Revision 1.2 2001/05/03 19:17:43 knoaman
* TraverseSchema Part II.
*
@@ -76,10 +79,15 @@
// ---------------------------------------------------------------------------
DatatypeValidator::DatatypeValidator(DatatypeValidator* const baseValidator,
RefHashTableOf<KVStringPair>* const facets,
- const int finalSet)
+ const int finalSet,
+ const ValidatorType type)
: fFinalSet(finalSet)
, fBaseValidator(baseValidator)
, fFacets(facets)
+ , fType(type)
+ , fFacetsDefined(0)
+ , fPattern(0)
+ , fRegex(0)
{
}
1.3 +152 -9 xml-xerces/c/src/validators/datatype/DatatypeValidator.hpp
Index: DatatypeValidator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/datatype/DatatypeValidator.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DatatypeValidator.hpp 2001/05/03 19:17:46 1.2
+++ DatatypeValidator.hpp 2001/05/03 21:09:54 1.3
@@ -55,7 +55,7 @@
*/
/*
- * $Id: DatatypeValidator.hpp,v 1.2 2001/05/03 19:17:46 knoaman Exp $
+ * $Id: DatatypeValidator.hpp,v 1.3 2001/05/03 21:09:54 tng Exp $
*/
#if !defined(DATATYPEVALIDATOR_HPP)
@@ -63,6 +63,8 @@
#include <util/RefHashTableOf.hpp>
#include <util/KVStringPair.hpp>
+#include <dom/DOMString.hpp>
+#include <util/regx/RegularExpression.hpp>
/**
* DataTypeValidator defines the interface that data type validators must
@@ -111,6 +113,53 @@
COLLAPSE = 2
};
+ enum ValidatorType {
+ String,
+ NormalizedString,
+ AnyURI,
+ QName,
+ Token,
+ Language,
+ Name,
+ NCName,
+ Boolean,
+ Float,
+ Double,
+ Decimal,
+ HexBinary,
+ Base64Binary,
+ Integer,
+ NonPositiveInteger,
+ NegativeInteger,
+ Long,
+ Int,
+ Short,
+ Byte,
+ NonNegativeInteger,
+ UnsignedLong,
+ UnsignedInt,
+ UnsignedShort,
+ UnsignedByte,
+ PositiveInteger,
+ Duration,
+ Time,
+ DateTime,
+ Date,
+ MonthDay,
+ YearMonth,
+ Year,
+ Month,
+ Day,
+ ID,
+ IDREF,
+ ENTITY,
+ NOTATION,
+ IDREFS,
+ ENTITIES,
+ NMTOKEN,
+ NMTOKENS
+ };
+
// -----------------------------------------------------------------------
// Public Destructor
// -----------------------------------------------------------------------
@@ -148,6 +197,11 @@
*/
DatatypeValidator* getBaseValidator() const;
+ /**
+ * Returns the 'class' type of datatype validator
+ */
+ ValidatorType getType() const;
+
//@}
// -----------------------------------------------------------------------
@@ -170,7 +224,10 @@
*
* @param toCheck A datatype validator of the type to be used as a
* substitute
+ *
+ * To be redefined in UnionDatatypeValidator
*/
+
bool isSubstitutableBy(const DatatypeValidator* const toCheck);
//@}
@@ -198,6 +255,14 @@
//@}
+ /**
+ * Returns an instance of the base datatype validator class
+ * Used by the DatatypeValidatorFactory.
+ */
+ virtual DatatypeValidator* newInstance(DatatypeValidator* const,
+ RefHashTableOf<KVStringPair>* const,
+ const int finalSet) = 0;
+
protected:
// -----------------------------------------------------------------------
// Protected Constructors
@@ -212,20 +277,16 @@
*
* @param facets A hashtable of datatype facets.
*
+ * @param finalSet 'final' value of the simpleType
*/
+
DatatypeValidator(DatatypeValidator* const baseValidator,
RefHashTableOf<KVStringPair>* const facets,
- const int finalSet);
+ const int finalSet,
+ const ValidatorType type);
//@}
- /**
- * Returns an instance of the base datatype validator class
- * Used by the DatatypeValidatorFactory.
- */
- virtual DatatypeValidator* newInstance(DatatypeValidator* const,
- RefHashTableOf<KVStringPair>* const,
- const int finalSet) = 0;
friend class DatatypeValidatorFactory;
@@ -239,6 +300,25 @@
*/
virtual void processWhiteSpace(RefHashTableOf<KVStringPair>* const facets);
+ /**
+ * facetDefined
+ */
+ int getFacetsDefined() const;
+ void setFacetsDefined(int);
+
+
+ /**
+ * fPattern
+ */
+ const XMLCh* getPattern() const;
+ void setPattern(const XMLCh* const);
+
+ /**
+ * fRegex
+ */
+ RegularExpression* getRegex() const;
+ void setRegex(RegularExpression* const);
+
private:
// -----------------------------------------------------------------------
// CleanUp methods
@@ -257,10 +337,37 @@
//
// fFacets
// This is a hashtable of dataype facets.
+ //
+ // fType
+ // Stores the class type of datatype validator
+ //
+ // fFacetsDefined
+ // Stores the constaiting facets flag
+ //
+ // fPattern
+ // the String of the pattern
+ //
+ // fRegex
+ // pointer to the RegularExpress object
+ //
+ //
+ // fFixed
+ // if {fixed} is true, then types for which this type is the
+ // {base type definition} cannot specify a value for a specific
+ // facet.
+ //
// -----------------------------------------------------------------------
+
int fFinalSet;
DatatypeValidator* fBaseValidator;
RefHashTableOf<KVStringPair>* fFacets;
+
+ ValidatorType fType;
+ int fFacetsDefined;
+ DOMString fPattern;
+ RegularExpression *fRegex;
+
+ //ValueVectorOf<bool> *fFixed;
};
@@ -287,6 +394,11 @@
return COLLAPSE;
}
+inline DatatypeValidator::ValidatorType DatatypeValidator::getType() const
+{
+ return fType;
+}
+
// ---------------------------------------------------------------------------
// DatatypeValidator: CleanUp methods
// ---------------------------------------------------------------------------
@@ -324,6 +436,37 @@
return false;
}
+
+inline int DatatypeValidator::getFacetsDefined() const
+{
+ return fFacetsDefined;
+}
+
+inline void DatatypeValidator::setFacetsDefined(int facets)
+{
+ fFacetsDefined |= facets;
+}
+
+inline const XMLCh* DatatypeValidator::getPattern() const
+{
+ return fPattern.rawBuffer();
+}
+
+inline void DatatypeValidator::setPattern(const XMLCh* const pattern)
+{
+ fPattern = pattern;
+}
+
+inline RegularExpression* DatatypeValidator::getRegex() const
+{
+ return fRegex;
+}
+
+inline void DatatypeValidator::setRegex(RegularExpression* const regex)
+{
+ fRegex = regex;
+}
+
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org