You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/06/06 23:50:44 UTC
cvs commit: xml-xalan/c/src/XPath XPathExpression.cpp XPathExpression.hpp
dbertoni 01/06/06 14:50:44
Modified: c/src/XPath XPathExpression.cpp XPathExpression.hpp
Log:
Replaced set with static array.
Revision Changes Path
1.30 +19 -39 xml-xalan/c/src/XPath/XPathExpression.cpp
Index: XPathExpression.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- XPathExpression.cpp 2001/05/02 15:51:22 1.29
+++ XPathExpression.cpp 2001/06/06 21:50:43 1.30
@@ -87,10 +87,25 @@
-const XPathExpression::NodeTestSetType XPathExpression::s_NodeTestOpCodes =
- XPathExpression::InitializeNodeTestSet();
+const unsigned int s_nodeTestOpCodesArraySize = 100;
+const bool XPathExpression::s_nodeTestOpCodesArray[] =
+{
+ false, false, true, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, true, true, true, false, false, false
+};
+
+
+
XPathExpression::XPathExpressionException::XPathExpressionException(const XalanDOMString& theMessage) :
XPathException(theMessage)
{
@@ -578,12 +593,9 @@
bool
XPathExpression::isNodeTestOpCode(OpCodeMapValueType theOpCode)
{
- const NodeTestSetType::const_iterator i =
- s_NodeTestOpCodes.find(theOpCode);
-
- if (i != s_NodeTestOpCodes.end())
+ if (theOpCode < s_nodeTestOpCodesArraySize)
{
- return true;
+ return s_nodeTestOpCodesArray[theOpCode];
}
else
{
@@ -880,36 +892,4 @@
theMap[eMATCH_ANY_ANCESTOR_WITH_FUNCTION_CALL] = 2 + s__opCodeMapLengthIndex;
return theMap;
-}
-
-
-
-XPathExpression::NodeTestSetType
-XPathExpression::InitializeNodeTestSet()
-{
- NodeTestSetType theSet;
-
- theSet.insert(eMATCH_ANY_ANCESTOR);
- theSet.insert(eMATCH_IMMEDIATE_ANCESTOR);
- theSet.insert(eMATCH_ATTRIBUTE);
- theSet.insert(eFROM_ATTRIBUTES);
- theSet.insert(eFROM_DESCENDANTS_OR_SELF);
- theSet.insert(eFROM_CHILDREN);
- theSet.insert(eFROM_ANCESTORS);
- theSet.insert(eFROM_ANCESTORS_OR_SELF);
- theSet.insert(eFROM_ATTRIBUTES);
- theSet.insert(eFROM_CHILDREN);
- theSet.insert(eFROM_DESCENDANTS);
- theSet.insert(eFROM_DESCENDANTS_OR_SELF);
- theSet.insert(eFROM_FOLLOWING);
- theSet.insert(eFROM_FOLLOWING_SIBLINGS);
- theSet.insert(eFROM_PARENT);
- theSet.insert(eFROM_PRECEDING);
- theSet.insert(eFROM_PRECEDING_SIBLINGS);
- theSet.insert(eFROM_SELF);
- theSet.insert(eFROM_NAMESPACE);
- theSet.insert(eFROM_ROOT);
- theSet.insert(eOP_OR);
-
- return theSet;
}
1.18 +1 -8 xml-xalan/c/src/XPath/XPathExpression.hpp
Index: XPathExpression.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.hpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- XPathExpression.hpp 2001/04/18 14:46:12 1.17
+++ XPathExpression.hpp 2001/06/06 21:50:43 1.18
@@ -753,8 +753,6 @@
typedef OpCodeMapType::value_type OpCodeMapValueType;
typedef OpCodeMapType::size_type OpCodeMapSizeType;
- typedef set<OpCodeMapValueType, less<OpCodeMapValueType> > NodeTestSetType;
-
typedef vector<OpCodeMapValueType> OpCodeMapValueVectorType;
typedef vector<double> NumberLiteralValueVectorType;
@@ -768,7 +766,6 @@
typedef OpCodeMapType::value_type OpCodeMapValueType;
typedef OpCodeMapType::size_type OpCodeMapSizeType;
- typedef std::set<OpCodeMapValueType> NodeTestSetType;
typedef std::vector<OpCodeMapValueType> OpCodeMapValueVectorType;
typedef std::vector<double> NumberLiteralValueVectorType;
@@ -1500,12 +1497,8 @@
static OpCodeLengthMapType
IntializeOpCodeLengthMap();
-
- // A static set of Op codes that are node tests.
- const static NodeTestSetType s_NodeTestOpCodes;
- static NodeTestSetType
- InitializeNodeTestSet();
+ const static bool s_nodeTestOpCodesArray[];
};
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org