+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
#include <config.h>
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
#include <algorithm>
#include <cctype>
}
}
+///
+char lowercase(char c)
+{
+ return tolower(c);
+}
+///
+char uppercase(char c)
+{
+ return toupper(c);
+}
string lowercase(string const & a)
{
string::iterator result = tmp.begin();
for (string::iterator first = tmp.begin();
first != tmp.end(); ++first, ++result) {
- *result = tolower(*first);
+ *result = lowercase(*first);
}
//#else
// transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
string::iterator result = tmp.begin();
for (string::iterator first = tmp.begin();
first != tmp.end(); ++first, ++result) {
- *result = toupper(*first);
+ *result = uppercase(*first);
}
//#else
// transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
unsigned int l = strlen(pre);
if (l > a.length() || a.empty())
return false;
- else
+ else {
+#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
+ // Delete this code when the compilers get a bit better.
+ return ::strncmp(a.c_str(), pre, l) == 0;
+#else
+ // This is the code that we really want to use
+ // but until gcc ships with a basic_string that
+ // implements std::string correctly we have to
+ // use the code above.
return a.compare(0, l, pre, l) == 0;
+#endif
+ }
}
if (suflen > a.length())
return false;
else {
+#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
+ // Delete this code when the compilers get a bit better.
+ string tmp(a, a.length() - suflen);
+ return ::strncmp(tmp.c_str(), suf, suflen) == 0;
+#else
+ // This is the code that we really want to use
+ // but until gcc ships with a basic_string that
+ // implements std::string correctly we have to
+ // use the code above.
return a.compare(a.length() - suflen, suflen, suf) == 0;
+#endif
}
}