dbertoni 01/06/25 13:08:55
Modified: c/src/PlatformSupport DOMStringHelper.hpp
Log:
New indexOf() helper function.
Revision Changes Path
1.45 +33 -0 xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp
Index: DOMStringHelper.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- DOMStringHelper.hpp 2001/06/14 18:54:00 1.44
+++ DOMStringHelper.hpp 2001/06/25 20:08:52 1.45
@@ -371,9 +371,42 @@
const XalanDOMChar* theString,
XalanDOMChar theChar)
{
+ assert(theString != 0);
+
const XalanDOMChar* thePointer = theString;
while(*thePointer != theChar && *thePointer != 0)
+ {
+ ++thePointer;
+ }
+
+ return thePointer - theString;
+}
+
+
+
+/**
+ * Simulates the java String method indexOf().
+ *
+ * @param theString string to search
+ * @param theStringLength the length of theString
+ * @param theChar character searched for
+ * @return the index of theChar in theString,
+ * or length(theString) if the character is not
+ * found.
+ */
+inline unsigned int
+indexOf(
+ const XalanDOMChar* theString,
+ unsigned int theStringLength,
+ XalanDOMChar theChar)
+{
+ assert(theString != 0);
+
+ const XalanDOMChar* thePointer = theString;
+ const XalanDOMChar* const theEndPointer = theString +
theStringLength;
+
+ while(*thePointer != theChar && thePointer != theEndPointer)
{
++thePointer;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]