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/02/27 15:49:11 UTC
cvs commit: xml-xerces/c/src/validators/common CMAny.cpp CMAny.hpp ContentLeafNameTypeVector.cpp ContentLeafNameTypeVector.hpp CMStateSet.hpp CMUnaryOp.cpp ContentSpecNode.hpp DFAContentModel.cpp DFAContentModel.hpp Makefile.in MixedContentModel.cpp MixedContentModel.hpp SimpleContentModel.cpp SimpleContentModel.hpp
tng 01/02/27 06:49:10
Modified: c/Projects/OS2/VACPP40 xerces_validators.icc
c/Projects/Win32/VC6/xerces-all/XercesLib XercesLib.dsp
c/src/framework XMLContentModel.hpp
c/src/util QName.cpp QName.hpp
c/src/validators/common CMStateSet.hpp CMUnaryOp.cpp
ContentSpecNode.hpp DFAContentModel.cpp
DFAContentModel.hpp Makefile.in
MixedContentModel.cpp MixedContentModel.hpp
SimpleContentModel.cpp SimpleContentModel.hpp
Added: c/src/validators/common CMAny.cpp CMAny.hpp
ContentLeafNameTypeVector.cpp
ContentLeafNameTypeVector.hpp
Log:
Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
Revision Changes Path
1.3 +2 -0 xml-xerces/c/Projects/OS2/VACPP40/xerces_validators.icc
Index: xerces_validators.icc
===================================================================
RCS file: /home/cvs/xml-xerces/c/Projects/OS2/VACPP40/xerces_validators.icc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- xerces_validators.icc 2001/02/16 14:58:53 1.2
+++ xerces_validators.icc 2001/02/27 14:48:19 1.3
@@ -4,8 +4,10 @@
BASE_DIR "\\src\\validators\\DTD\\DTDElementDecl.cpp",
BASE_DIR "\\src\\validators\\DTD\\DTDValidator.cpp",
BASE_DIR "\\src\\validators\\DTD\\DTDValidator2.cpp",
+ BASE_DIR "\\src\\validators\\common\\CMAnyOp.cpp",
BASE_DIR "\\src\\validators\\common\\CMBinaryOp.cpp",
BASE_DIR "\\src\\validators\\common\\CMUnaryOp.cpp",
+ BASE_DIR "\\src\\validators\\common\\ContentLeafNameTypeVector.cpp",
BASE_DIR "\\src\\validators\\common\\ContentSpecNode.cpp",
BASE_DIR "\\src\\validators\\common\\DFAContentModel.cpp",
BASE_DIR "\\src\\validators\\common\\MixedContentModel.cpp",
1.49 +15 -0 xml-xerces/c/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
Index: XercesLib.dsp
===================================================================
RCS file: /home/cvs/xml-xerces/c/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- XercesLib.dsp 2001/02/26 19:44:10 1.48
+++ XercesLib.dsp 2001/02/27 14:48:25 1.49
@@ -1319,6 +1319,13 @@
# PROP Default_Filter "*.cpp, *.hpp"
# Begin Source File
+SOURCE=..\..\..\..\..\src\validators\common\CMAny.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\src\validators\common\CMAny.hpp
+# End Source File
+# Begin Source File
SOURCE=..\..\..\..\..\src\validators\common\CMBinaryOp.cpp
# End Source File
@@ -1345,6 +1352,14 @@
# Begin Source File
SOURCE=..\..\..\..\..\src\validators\common\CMUnaryOp.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\src\validators\common\ContentLeafNameTypeVector.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\src\validators\common\ContentLeafNameTypeVector.hpp
# End Source File
# Begin Source File
1.6 +21 -0 xml-xerces/c/src/framework/XMLContentModel.hpp
Index: XMLContentModel.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/framework/XMLContentModel.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLContentModel.hpp 2000/03/02 19:54:24 1.5
+++ XMLContentModel.hpp 2001/02/27 14:48:30 1.6
@@ -56,6 +56,9 @@
/*
* $Log: XMLContentModel.hpp,v $
+ * Revision 1.6 2001/02/27 14:48:30 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.5 2000/03/02 19:54:24 roddey
* This checkin includes many changes done while waiting for the
* 1.1.0 code to be finished. I can't list them all here, but a list is
@@ -85,6 +88,8 @@
#include <util/XercesDefs.hpp>
#include <util/RefVectorOf.hpp>
+class ContentLeafNameTypeVector;
+
/**
* This class defines the abstract interface for all content models. All
* elements have a content model against which (if validating) its content
@@ -119,6 +124,20 @@
, const unsigned int childCount
) const = 0;
+ virtual int validateContentSpecial
+ (
+ const unsigned int* childIds
+ , const unsigned int childCount
+ ) const = 0;
+
+ virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector()
+ const = 0;
+
+// Onhold, until EquivClassComparator is defined
+// void setEquivClassComparator(EquivClassComparator comparator) = 0;
+
+// Do not implement, it is NOT used in XercesJ.
+// int whatCanGoHere(bool, InsertableElementsInfo info) = 0;
protected :
// -----------------------------------------------------------------------
1.3 +3 -20 xml-xerces/c/src/util/QName.cpp
Index: QName.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/QName.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- QName.cpp 2001/02/26 21:56:15 1.2
+++ QName.cpp 2001/02/27 14:48:35 1.3
@@ -56,6 +56,9 @@
/*
* $Log: QName.cpp,v $
+ * Revision 1.3 2001/02/27 14:48:35 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.2 2001/02/26 21:56:15 tng
* Schema: QName can also be constructed with rawName.
*
@@ -164,21 +167,6 @@
// ---------------------------------------------------------------------------
// QName: Getter methods
// ---------------------------------------------------------------------------
-inline const XMLCh* QName::getPrefix() const
-{
- return fPrefix;
-}
-
-inline const XMLCh* QName::getLocalPart() const
-{
- return fLocalPart;
-}
-
-inline const int QName::getURI() const
-{
- return fURIId;
-}
-
const XMLCh* QName::getRawName() const
{
//
@@ -327,11 +315,6 @@
fLocalPart = new XMLCh[fLocalPartBufSz + 1];
}
XMLString::moveChars(fLocalPart, localPart, newLen + 1);
-}
-
-inline void QName::setURI(const int uriId)
-{
- fURIId = uriId;
}
// -----------------------------------------------------------------------
1.3 +28 -0 xml-xerces/c/src/util/QName.hpp
Index: QName.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/QName.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- QName.hpp 2001/02/26 21:56:16 1.2
+++ QName.hpp 2001/02/27 14:48:39 1.3
@@ -56,6 +56,9 @@
/*
* $Log: QName.hpp,v $
+ * Revision 1.3 2001/02/27 14:48:39 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.2 2001/02/26 21:56:16 tng
* Schema: QName can also be constructed with rawName.
*
@@ -181,4 +184,29 @@
};
+// ---------------------------------------------------------------------------
+// QName: Getter methods
+// ---------------------------------------------------------------------------
+inline const XMLCh* QName::getPrefix() const
+{
+ return fPrefix;
+}
+
+inline const XMLCh* QName::getLocalPart() const
+{
+ return fLocalPart;
+}
+
+inline const int QName::getURI() const
+{
+ return fURIId;
+}
+
+// ---------------------------------------------------------------------------
+// QName: Setter methods
+// ---------------------------------------------------------------------------
+inline void QName::setURI(const int uriId)
+{
+ fURIId = uriId;
+}
#endif
1.2 +22 -14 xml-xerces/c/src/validators/common/CMStateSet.hpp
Index: CMStateSet.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/CMStateSet.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CMStateSet.hpp 2001/02/16 14:17:29 1.1
+++ CMStateSet.hpp 2001/02/27 14:48:46 1.2
@@ -1,37 +1,37 @@
/*
* The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
+ *
+ * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache\@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -45,7 +45,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
- *
+ *
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
@@ -56,6 +56,9 @@
/*
* $Log: CMStateSet.hpp,v $
+ * Revision 1.2 2001/02/27 14:48:46 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.1 2001/02/16 14:17:29 tng
* Schema: Move the common Content Model files that are shared by DTD
* and schema from 'DTD' folder to 'common' folder. By Pei Yong Zhang.
@@ -124,8 +127,8 @@
// Init all the bits to zero
zeroBits();
}
+
-
/*
* This method with the 'for' statement (commented out) cannot be made inline
* because the antiquated CC (CFront) compiler under HPUX 10.20 does not allow
@@ -223,6 +226,10 @@
{
if (this == &srcSet)
return *this;
+
+ // They have to be the same size
+ if (fBitCount != srcSet.fBitCount)
+ ThrowXML(RuntimeException, XMLExcepts::Bitset_BadIndex); // later BitSet_NotEqualSize
if (fBitCount < 65)
{
1.3 +8 -2 xml-xerces/c/src/validators/common/CMUnaryOp.cpp
Index: CMUnaryOp.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/CMUnaryOp.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CMUnaryOp.cpp 2001/02/16 14:58:57 1.2
+++ CMUnaryOp.cpp 2001/02/27 14:48:47 1.3
@@ -56,6 +56,9 @@
/*
* $Log: CMUnaryOp.cpp,v $
+ * Revision 1.3 2001/02/27 14:48:47 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.2 2001/02/16 14:58:57 tng
* Schema: Update Makefile, configure files, project files, and include path in
* certain cpp files because of the move of the common Content Model files. By Pei Yong Zhang.
@@ -132,8 +135,10 @@
// ---------------------------------------------------------------------------
bool CMUnaryOp::isNullable() const
{
- // Repetition operations are always nullable
- return true;
+ if (getType() == ContentSpecNode::OneOrMore)
+ return fChild->isNullable();
+ else
+ return true;
}
1.2 +115 -16 xml-xerces/c/src/validators/common/ContentSpecNode.hpp
Index: ContentSpecNode.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/ContentSpecNode.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContentSpecNode.hpp 2001/02/16 14:17:29 1.1
+++ ContentSpecNode.hpp 2001/02/27 14:48:49 1.2
@@ -1,37 +1,37 @@
/*
* The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
+ *
+ * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache\@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -45,7 +45,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
- *
+ *
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
@@ -56,6 +56,9 @@
/*
* $Log: ContentSpecNode.hpp,v $
+ * Revision 1.2 2001/02/27 14:48:49 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.1 2001/02/16 14:17:29 tng
* Schema: Move the common Content Model files that are shared by DTD
* and schema from 'DTD' folder to 'common' folder. By Pei Yong Zhang.
@@ -104,6 +107,15 @@
, OneOrMore
, Choice
, Sequence
+ , Any
+ , Any_Other
+ , Any_Local
+ , Any_Lax
+ , Any_Other_Lax
+ , Any_Local_Lax
+ , Any_Skip
+ , Any_Other_Skip
+ , Any_Local_Skip
, UnknownType = -1
};
@@ -120,8 +132,11 @@
, ContentSpecNode* const firstToAdopt
, ContentSpecNode* const secondToAdopt
);
- ~ContentSpecNode();
+ ContentSpecNode(const ContentSpecNode&);
+ ~ContentSpecNode();
+ ContentSpecNode& operator=(const ContentSpecNode&);
+ bool operator==(const ContentSpecNode&);
// -----------------------------------------------------------------------
// Getter methods
@@ -160,10 +175,9 @@
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
- ContentSpecNode(const ContentSpecNode&);
- void operator=(const ContentSpecNode&);
+
// -----------------------------------------------------------------------
// Private Data Members
//
@@ -225,6 +239,27 @@
{
}
+inline
+ContentSpecNode::ContentSpecNode(const ContentSpecNode& toCopy)
+{
+ fElemId = toCopy.getElemId();
+
+ const ContentSpecNode *tmp;
+ tmp = toCopy.getFirst();
+ if (!tmp)
+ fFirst = new ContentSpecNode(*tmp);
+ else
+ fFirst = 0;
+
+ tmp = toCopy.getSecond();
+ if (!tmp)
+ fSecond = new ContentSpecNode(*tmp);
+ else
+ fSecond = 0;
+
+ fType = toCopy.getType();
+}
+
inline ContentSpecNode::~ContentSpecNode()
{
// Delete our children, which cause recursive cleanup
@@ -232,6 +267,69 @@
delete fSecond;
}
+/***
+ To map the SetValues(XMLContentSpec)
+***/
+inline ContentSpecNode& ContentSpecNode::operator=(const ContentSpecNode& toAssign)
+{
+ if (this == &toAssign)
+ return *this;
+
+ fElemId = toAssign.getElemId();
+
+ delete fFirst;
+ const ContentSpecNode *tmp;
+ tmp = toAssign.getFirst();
+ if (!tmp)
+ fFirst = new ContentSpecNode(*tmp);
+ else
+ fFirst = 0;
+
+ delete fSecond;
+ tmp = toAssign.getSecond();
+ if (!tmp)
+ fSecond = new ContentSpecNode(*tmp);
+ else
+ fSecond = 0;
+
+ fType = toAssign.getType();
+
+ return *this;
+}
+
+/***
+ To map the equals(XMLContentSpec)
+ To map
+***/
+inline bool ContentSpecNode::operator==(const ContentSpecNode& toCompare)
+{
+ if (this==&toCompare)
+ return true;
+/***
+ return ((fElemId == toCompare.getElemId()) &&
+ (*fFirst == *(toCompare.getFirst())) &&
+ (*fSecond == *(toCompare.getSecond())) &&
+ (fType == toCompare.getType()));
+***/
+
+ if (fElemId != toCompare.getElemId())
+ return false;
+
+ if (fType != toCompare.getType())
+ return false;
+
+ if (((fFirst != 0) && (toCompare.getFirst() ==0)) ||
+ ((fFirst == 0) && (toCompare.getFirst() !=0)) ||
+ (((fFirst != 0) && (toCompare.getFirst() !=0)) && (*fFirst == *(toCompare.getFirst()))))
+ return false;
+
+ if (((fSecond != 0) && (toCompare.getSecond() ==0)) ||
+ ((fSecond == 0) && (toCompare.getSecond() !=0)) ||
+ (((fSecond != 0) && (toCompare.getSecond() !=0)) && (*fSecond == *(toCompare.getSecond()))))
+ return false;
+
+ return true;
+}
// ---------------------------------------------------------------------------
// ContentSpecNode: Getter methods
1.3 +16 -0 xml-xerces/c/src/validators/common/DFAContentModel.cpp
Index: DFAContentModel.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/DFAContentModel.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DFAContentModel.cpp 2001/02/16 14:58:57 1.2
+++ DFAContentModel.cpp 2001/02/27 14:48:51 1.3
@@ -56,6 +56,9 @@
/*
* $Log: DFAContentModel.cpp,v $
+ * Revision 1.3 2001/02/27 14:48:51 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.2 2001/02/16 14:58:57 tng
* Schema: Update Makefile, configure files, project files, and include path in
* certain cpp files because of the move of the common Content Model files. By Pei Yong Zhang.
@@ -820,3 +823,15 @@
}
return newIndex;
}
+
+int DFAContentModel::validateContentSpecial( const unsigned int* childIds
+ , const unsigned int childCount) const
+{
+ return 0;
+};
+
+ContentLeafNameTypeVector* DFAContentModel::getContentLeafNameTypeVector() const
+{
+ //later change it to return the data member
+ return 0;
+};
1.2 +28 -13 xml-xerces/c/src/validators/common/DFAContentModel.hpp
Index: DFAContentModel.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/DFAContentModel.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DFAContentModel.hpp 2001/02/16 14:17:29 1.1
+++ DFAContentModel.hpp 2001/02/27 14:48:52 1.2
@@ -1,37 +1,37 @@
/*
* The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
+ *
+ * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache\@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -45,7 +45,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
- *
+ *
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
@@ -56,6 +56,9 @@
/*
* $Log: DFAContentModel.hpp,v $
+ * Revision 1.2 2001/02/27 14:48:52 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.1 2001/02/16 14:17:29 tng
* Schema: Move the common Content Model files that are shared by DTD
* and schema from 'DTD' folder to 'common' folder. By Pei Yong Zhang.
@@ -84,6 +87,7 @@
#include <util/XercesDefs.hpp>
#include <framework/XMLContentModel.hpp>
+#include <validators/common/ContentLeafNameTypeVector.hpp>
class ContentSpecNode;
class CMLeaf;
@@ -123,6 +127,16 @@
, const unsigned int childCount
) const;
+ virtual int validateContentSpecial
+ (
+ const unsigned int* childIds
+ , const unsigned int childCount
+ ) const;
+
+ virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector() const ;
+
+// Onhold, until EquivClassComparator is defined
+// void setEquivClassComparator(EquivClassComparator comparator);
private :
// -----------------------------------------------------------------------
1.2 +9 -1 xml-xerces/c/src/validators/common/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/Makefile.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.in 2001/02/16 14:58:57 1.1
+++ Makefile.in 2001/02/27 14:48:53 1.2
@@ -54,6 +54,9 @@
# <http://www.apache.org/>.
#
# $Log: Makefile.in,v $
+# Revision 1.2 2001/02/27 14:48:53 tng
+# Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+#
# Revision 1.1 2001/02/16 14:58:57 tng
# Schema: Update Makefile, configure files, project files, and include path in
# certain cpp files because of the move of the common Content Model files. By Pei Yong Zhang.
@@ -79,11 +82,13 @@
SUBMODULE = common
VALIDATORS_COMMON_CPP_PUBHEADERS = \
+ CMAny.hpp \
CMBinaryOp.hpp \
CMLeaf.hpp \
CMNode.hpp \
CMStateSet.hpp \
CMUnaryOp.hpp \
+ ContentLeafNameTypeVector.hpp \
ContentSpecNode.hpp \
DFAContentModel.hpp \
MixedContentModel.hpp \
@@ -94,8 +99,10 @@
VALIDATORS_COMMON_C_FILES =
VALIDATORS_COMMON_CPP_OBJECTS = \
+ CMAny.$(TO) \
CMBinaryOp.$(TO) \
CMUnaryOp.$(TO) \
+ ContentLeafNameTypeVector.$(TO) \
ContentSpecNode.$(TO) \
DFAContentModel.$(TO) \
MixedContentModel.$(TO) \
1.3 +15 -0 xml-xerces/c/src/validators/common/MixedContentModel.cpp
Index: MixedContentModel.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/MixedContentModel.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MixedContentModel.cpp 2001/02/16 14:58:57 1.2
+++ MixedContentModel.cpp 2001/02/27 14:48:54 1.3
@@ -56,6 +56,9 @@
/*
* $Log: MixedContentModel.cpp,v $
+ * Revision 1.3 2001/02/27 14:48:54 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.2 2001/02/16 14:58:57 tng
* Schema: Update Makefile, configure files, project files, and include path in
* certain cpp files because of the move of the common Content Model files. By Pei Yong Zhang.
@@ -290,3 +293,14 @@
buildChildList(*leftNode, toFill);
}
}
+
+int MixedContentModel::validateContentSpecial( const unsigned int* childIds
+ , const unsigned int childCount) const
+{
+ return 0;
+};
+
+ContentLeafNameTypeVector* MixedContentModel::getContentLeafNameTypeVector() const
+{
+ return 0;
+};
\ No newline at end of file
1.2 +28 -13 xml-xerces/c/src/validators/common/MixedContentModel.hpp
Index: MixedContentModel.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/MixedContentModel.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MixedContentModel.hpp 2001/02/16 14:17:29 1.1
+++ MixedContentModel.hpp 2001/02/27 14:48:55 1.2
@@ -1,37 +1,37 @@
/*
* The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
+ *
+ * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache\@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -45,7 +45,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
- *
+ *
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
@@ -56,6 +56,9 @@
/*
* $Log: MixedContentModel.hpp,v $
+ * Revision 1.2 2001/02/27 14:48:55 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.1 2001/02/16 14:17:29 tng
* Schema: Move the common Content Model files that are shared by DTD
* and schema from 'DTD' folder to 'common' folder. By Pei Yong Zhang.
@@ -80,6 +83,7 @@
#include <util/ValueVectorOf.hpp>
#include <framework/XMLContentModel.hpp>
+#include <validators/common/ContentLeafNameTypeVector.hpp>
class ContentSpecNode;
class DTDElementDecl;
@@ -128,6 +132,16 @@
, const unsigned int childCount
) const;
+ virtual int validateContentSpecial
+ (
+ const unsigned int* childIds
+ , const unsigned int childCount
+ ) const;
+
+ virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector() const ;
+
+// Onhold, until EquivClassComparator is defined
+// void setEquivClassComparator(EquivClassComparator comparator);
private :
// -----------------------------------------------------------------------
1.3 +15 -0 xml-xerces/c/src/validators/common/SimpleContentModel.cpp
Index: SimpleContentModel.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/SimpleContentModel.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SimpleContentModel.cpp 2001/02/16 14:58:57 1.2
+++ SimpleContentModel.cpp 2001/02/27 14:48:57 1.3
@@ -56,6 +56,9 @@
/*
* $Log: SimpleContentModel.cpp,v $
+ * Revision 1.3 2001/02/27 14:48:57 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.2 2001/02/16 14:58:57 tng
* Schema: Update Makefile, configure files, project files, and include path in
* certain cpp files because of the move of the common Content Model files. By Pei Yong Zhang.
@@ -234,3 +237,14 @@
}
return -1;
}
+
+int SimpleContentModel::validateContentSpecial( const unsigned int* childIds
+ , const unsigned int childCount) const
+{
+ return 0;
+};
+
+ContentLeafNameTypeVector* SimpleContentModel::getContentLeafNameTypeVector() const
+{
+ return 0;
+};
1.3 +15 -0 xml-xerces/c/src/validators/common/SimpleContentModel.hpp
Index: SimpleContentModel.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/SimpleContentModel.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SimpleContentModel.hpp 2001/02/16 14:58:57 1.2
+++ SimpleContentModel.hpp 2001/02/27 14:48:57 1.3
@@ -56,6 +56,9 @@
/*
* $Log: SimpleContentModel.hpp,v $
+ * Revision 1.3 2001/02/27 14:48:57 tng
+ * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
+ *
* Revision 1.2 2001/02/16 14:58:57 tng
* Schema: Update Makefile, configure files, project files, and include path in
* certain cpp files because of the move of the common Content Model files. By Pei Yong Zhang.
@@ -84,6 +87,7 @@
#include <framework/XMLContentModel.hpp>
#include <validators/common/ContentSpecNode.hpp>
+#include <validators/common/ContentLeafNameTypeVector.hpp>
//
@@ -136,6 +140,16 @@
, const unsigned int childCount
) const;
+ virtual int validateContentSpecial
+ (
+ const unsigned int* childIds
+ , const unsigned int childCount
+ ) const;
+
+ virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector() const;
+
+// Onhold, until EquivClassComparator is defined
+// void setEquivClassComparator(EquivClassComparator comparator);
private :
// -----------------------------------------------------------------------
1.1 xml-xerces/c/src/validators/common/CMAny.cpp
Index: CMAny.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Log: CMAny.cpp,v $
* Revision 1.1 2001/02/27 14:48:45 tng
* Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <util/XercesDefs.hpp>
#include <util/RuntimeException.hpp>
#include <validators/common/CMStateSet.hpp>
#include <validators/common/CMAny.hpp>
// ---------------------------------------------------------------------------
// CMUnaryOp: Constructors and Destructor
// ---------------------------------------------------------------------------
CMAny::CMAny( const ContentSpecNode::NodeTypes type
, const unsigned int URI
, const unsigned int position ) :
CMNode(type)
, fURI(URI)
, fPosition(position)
{
if ((type != ContentSpecNode::Any)
&& (type != ContentSpecNode::Any_Other)
&& (type != ContentSpecNode::Any_Local))
{
ThrowXML(RuntimeException, XMLExcepts::CM_BinOpHadUnaryType);
/***
ThrowXML1(RuntimeException,
XMLExcepts::CM_NotValidSpecTypeForNode,
"CMAny");
***/
}
}
CMAny::~CMAny()
{
}
// ---------------------------------------------------------------------------
// Getter methods
// ---------------------------------------------------------------------------
unsigned int CMAny::getURI() const
{
return fURI;
}
unsigned int CMAny::getPosition() const
{
return fPosition;
}
// ---------------------------------------------------------------------------
// Setter methods
// ---------------------------------------------------------------------------
void CMAny::setPosition(const unsigned int newPosition)
{
fPosition = newPosition;
}
// ---------------------------------------------------------------------------
// Implementation of public CMNode virtual interface
// ---------------------------------------------------------------------------
bool CMAny::isNullable() const
{
// Leaf nodes are never nullable unless its an epsilon node
return (fPosition == -1);
}
// ---------------------------------------------------------------------------
// Implementation of protected CMNode virtual interface
// ---------------------------------------------------------------------------
void CMAny::calcFirstPos(CMStateSet& toSet) const
{
// If we are an epsilon node, then the first pos is an empty set
if (fPosition == -1)
toSet.zeroBits();
else
// Otherwise, its just the one bit of our position
toSet.setBit(fPosition);
return;
}
void CMAny::calcLastPos(CMStateSet& toSet) const
{
// If we are an epsilon node, then the last pos is an empty set
if (fPosition == -1)
toSet.zeroBits();
// Otherwise, its just the one bit of our position
else
toSet.setBit(fPosition);
return;
}
1.1 xml-xerces/c/src/validators/common/CMAny.hpp
Index: CMAny.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Log: CMAny.hpp,v $
* Revision 1.1 2001/02/27 14:48:46 tng
* Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
*
*/
#if !defined(CMANY_HPP)
#define CMANY_HPP
#include <util/XercesDefs.hpp>
#include <validators/common/CMNode.hpp>
class CMStateSet;
class CMAny : public CMNode
{
public :
// -----------------------------------------------------------------------
// Constructors
// -----------------------------------------------------------------------
CMAny
(
const ContentSpecNode::NodeTypes type
, const unsigned int URI
, const unsigned int position
);
~CMAny();
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
unsigned int getURI() const;
unsigned int getPosition() const;
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
void setPosition(const unsigned int newPosition);
// -----------------------------------------------------------------------
// Implementation of the public CMNode virtual interface
// -----------------------------------------------------------------------
bool isNullable() const;
protected :
// -----------------------------------------------------------------------
// Implementation of the protected CMNode virtual interface
// -----------------------------------------------------------------------
void calcFirstPos(CMStateSet& toSet) const;
void calcLastPos(CMStateSet& toSet) const;
private :
// -----------------------------------------------------------------------
// Private data members
//
// fURI;
// URI of the any content model. This value is set if the type is
// of the following:
// XMLContentSpec.CONTENTSPECNODE_ANY,
// XMLContentSpec.CONTENTSPECNODE_ANY_OTHER.
//
// fPosition
// Part of the algorithm to convert a regex directly to a DFA
// numbers each leaf sequentially. If its -1, that means its an
// epsilon node. Zero and greater are non-epsilon positions.
// -----------------------------------------------------------------------
unsigned int fURI;
unsigned int fPosition;
};
#endif
1.1 xml-xerces/c/src/validators/common/ContentLeafNameTypeVector.cpp
Index: ContentLeafNameTypeVector.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Log: ContentLeafNameTypeVector.cpp,v $
* Revision 1.1 2001/02/27 14:48:49 tng
* Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
*
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <util/XercesDefs.hpp>
#include <validators/common/ContentLeafNameTypeVector.hpp>
// ---------------------------------------------------------------------------
// ContentLeafNameTypeVector: Constructors and Destructor
// ---------------------------------------------------------------------------
ContentLeafNameTypeVector::ContentLeafNameTypeVector()
: fLeafNames(0)
, fLeafTypes(0)
, fLeafCount(0)
{
}
ContentLeafNameTypeVector::ContentLeafNameTypeVector
( const unsigned int* const names
,const ContentSpecNode::NodeTypes* const types
,const unsigned int count
)
: fLeafNames(0)
, fLeafTypes(0)
, fLeafCount(0)
{
setValues(names, types, count);
}
/***
copy ctor
***/
ContentLeafNameTypeVector::ContentLeafNameTypeVector
(const ContentLeafNameTypeVector& toCopy)
:fLeafNames(0)
,fLeafTypes(0)
,fLeafCount(0)
{
fLeafCount=toCopy.getLeafCount();
init(fLeafCount);
for (unsigned int i=0; i<this->fLeafCount; i++)
{
*(fLeafNames+i)=toCopy.getLeafNameAt(i);
*(fLeafTypes+i)=toCopy.getLeafTypeAt(i);
}
}
ContentLeafNameTypeVector::~ContentLeafNameTypeVector()
{
cleanUp();
}
// ---------------------------------------------------------------------------
// ContentSpecType: Setter methods
// ---------------------------------------------------------------------------
void ContentLeafNameTypeVector::setValues
(
const unsigned int* const names
,const ContentSpecNode::NodeTypes* const types
,const unsigned int count
)
{
cleanUp();
init(count);
const unsigned int *tmpNames = names;
const ContentSpecNode::NodeTypes *tmpTypes = types;
for (unsigned int i=0; i<count; i++)
{
*(fLeafNames+i)=(*tmpNames++);
*(fLeafTypes+i)=(*tmpTypes++);
}
}
// ---------------------------------------------------------------------------
// ContentLeafNameTypeVector: Getter methods
// ---------------------------------------------------------------------------
const unsigned int ContentLeafNameTypeVector::getLeafNameAt
(const unsigned int pos) const
{
if (pos >= fLeafCount)
ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex);
return *(fLeafNames+pos);
}
const ContentSpecNode::NodeTypes ContentLeafNameTypeVector::getLeafTypeAt
(const unsigned int pos) const
{
if (pos >= fLeafCount)
ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Vector_BadIndex);
return *(fLeafTypes+pos);
}
const unsigned int ContentLeafNameTypeVector::getLeafCount() const
{
return fLeafCount;
}
1.1 xml-xerces/c/src/validators/common/ContentLeafNameTypeVector.hpp
Index: ContentLeafNameTypeVector.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Log: ContentLeafNameTypeVector.hpp,v $
* Revision 1.1 2001/02/27 14:48:49 tng
* Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
*
*/
#if !defined(CONTENTLEAFNAMETYPEVECTOR_HPP)
#define CONTENTLEAFNAMETYPEVECTOR_HPP
#include <util/XercesDefs.hpp>
#include <util/ValueVectorOf.hpp>
#include <validators/common/ContentSpecNode.hpp>
class ContentLeafNameTypeVector
{
public :
// -----------------------------------------------------------------------
// Class specific types
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// Constructors and Destructor
// -----------------------------------------------------------------------
ContentLeafNameTypeVector();
ContentLeafNameTypeVector
(
const unsigned int* const qName
,const ContentSpecNode::NodeTypes* const types
,const unsigned int count
);
~ContentLeafNameTypeVector();
ContentLeafNameTypeVector(const ContentLeafNameTypeVector&);
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
const unsigned int getLeafNameAt
(const unsigned int pos) const;
const ContentSpecNode::NodeTypes getLeafTypeAt
(const unsigned int pos) const;
const unsigned int getLeafCount() const;
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
void setValues
(
const unsigned int* const qName
,const ContentSpecNode::NodeTypes* const types
,const unsigned int count
);
// -----------------------------------------------------------------------
// Miscellaneous
// -----------------------------------------------------------------------
private :
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
void operator=(const ContentLeafNameTypeVector&);
// -----------------------------------------------------------------------
// helper methods
// -----------------------------------------------------------------------
void cleanUp();
void init(const unsigned int);
// -----------------------------------------------------------------------
// Private Data Members
//
// -----------------------------------------------------------------------
unsigned int *fLeafNames;
ContentSpecNode::NodeTypes *fLeafTypes;
unsigned int fLeafCount;
};
inline void ContentLeafNameTypeVector::cleanUp()
{
delete [] fLeafNames;
delete [] fLeafTypes;
}
inline void ContentLeafNameTypeVector::init(const unsigned int size)
{
fLeafNames = new unsigned int [size];
fLeafTypes = new ContentSpecNode::NodeTypes [size];
}
#endif