summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-10-15 22:46:05 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-10-15 22:52:26 +0200
commit57af2ee947feb06caaa8ffca1320a950bb049605 (patch)
treec885e8741400cab7cf9cfc97f243ed06de8394b6 /configmgr
parentbb20def9f65689633928fe2f6f5e34584122b17e (diff)
Allow starts-/endsWith* to also return the rest of the matched string
...as there are many cases where the code later wants to obtain this part, and esp. for the string literal variants it is awkward to calculate the length of the literal again if this is coded with a following copy() call. Adapt some code to use this new feature. (Strictly speaking, the @since tags for the---backwards-compatibly---modified functions are no longer accurate of course. Also, clean up some sal_Bool and SAL_THROWS(()) that are unnecesssary cargo-cult here, and where the clean-up should have no practical compatibility consequences.) Change-Id: I43e5c578c8c4b44cb47fd08f170b5c69322ad641
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/access.cxx10
-rw-r--r--configmgr/source/components.cxx16
2 files changed, 9 insertions, 17 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx
index 31c632c453a2..a181d6216583 100644
--- a/configmgr/source/access.cxx
+++ b/configmgr/source/access.cxx
@@ -1398,9 +1398,11 @@ rtl::Reference< Node > Access::getParentNode() {
}
rtl::Reference< ChildAccess > Access::getChild(OUString const & name) {
- if (getNode()->kind() == Node::KIND_LOCALIZED_PROPERTY && name.match("*")) {
- OUString locale(name.copy(1));
- if (locale.match("*")) {
+ OUString locale;
+ if (getNode()->kind() == Node::KIND_LOCALIZED_PROPERTY
+ && name.startsWith("*", &locale))
+ {
+ if (locale.startsWith("*")) {
SAL_WARN(
"configmgr",
("access best-matching localized property value via"
@@ -1443,7 +1445,7 @@ rtl::Reference< ChildAccess > Access::getChild(OUString const & name) {
i != children.end(); ++i)
{
OUString name2((*i)->getNameInternal());
- if (name2.match(locale) &&
+ if (name2.startsWith(locale) &&
(name2.getLength() == locale.getLength() ||
name2[locale.getLength()] == '-' ||
name2[locale.getLength()] == '_'))
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index b5b38b5b9371..85865fd00e7d 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -43,9 +43,7 @@
#include "osl/mutex.hxx"
#include "rtl/bootstrap.hxx"
#include "rtl/ref.hxx"
-#include "rtl/string.h"
#include "rtl/ustrbuf.hxx"
-#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "rtl/instance.hxx"
#include "sal/log.hxx"
@@ -639,9 +637,7 @@ void Components::parseFiles(
parseFiles(layer, extension, parseFile, stat.getFileURL(), true);
} else {
OUString file(stat.getFileName());
- if (file.getLength() >= extension.getLength() &&
- file.match(extension, file.getLength() - extension.getLength()))
- {
+ if (file.endsWith(extension)) {
try {
parseFileLeniently(
parseFile, stat.getFileURL(), layer, data_, 0, 0, 0);
@@ -718,14 +714,8 @@ void Components::parseXcdFiles(int layer, OUString const & url) {
}
if (stat.getFileType() != osl::FileStatus::Directory) { //TODO: symlinks
OUString file(stat.getFileName());
- if (file.getLength() >= RTL_CONSTASCII_LENGTH(".xcd") &&
- file.matchAsciiL(
- RTL_CONSTASCII_STRINGPARAM(".xcd"),
- file.getLength() - RTL_CONSTASCII_LENGTH(".xcd")))
- {
- OUString name(
- file.copy(
- 0, file.getLength() - RTL_CONSTASCII_LENGTH(".xcd")));
+ OUString name;
+ if (file.endsWith(".xcd", &name)) {
existingDeps.insert(name);
rtl::Reference< ParseManager > manager;
try {