diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-10-15 22:46:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-10-15 22:52:26 +0200 |
commit | 57af2ee947feb06caaa8ffca1320a950bb049605 (patch) | |
tree | c885e8741400cab7cf9cfc97f243ed06de8394b6 /unoidl | |
parent | bb20def9f65689633928fe2f6f5e34584122b17e (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 'unoidl')
-rw-r--r-- | unoidl/source/sourceprovider-parser.y | 7 | ||||
-rw-r--r-- | unoidl/source/unoidl-read.cxx | 3 | ||||
-rw-r--r-- | unoidl/source/unoidl-write.cxx | 3 |
3 files changed, 4 insertions, 9 deletions
diff --git a/unoidl/source/sourceprovider-parser.y b/unoidl/source/sourceprovider-parser.y index 6512e4a69d64..8f813c3a6c45 100644 --- a/unoidl/source/sourceprovider-parser.y +++ b/unoidl/source/sourceprovider-parser.y @@ -261,9 +261,7 @@ unoidl::detail::SourceProviderEntity * findEntity_( assert(data != 0); assert(name != 0); OUString n; - if (name->startsWith(".")) { - n = name->copy(1); - } else { + if (!name->startsWith(".", &n)) { for (std::vector<OUString>::const_reverse_iterator i(data->modules.rbegin()); i != data->modules.rend(); ++i) { @@ -345,7 +343,7 @@ Found findEntity( static_cast<unoidl::TypedefEntity *>(e->entity.get()) ->getType()); typeNucleus = t; - while (typeNucleus.startsWith("[]")) { + while (typeNucleus.startsWith("[]", &typeNucleus)) { if (!args.empty()) { error( location, yyscanner, @@ -363,7 +361,6 @@ Found findEntity( return FOUND_ERROR; } ++rank; - typeNucleus = typeNucleus.copy(2); } sal_Int32 i = typeNucleus.indexOf('<'); if (i != -1) { diff --git a/unoidl/source/unoidl-read.cxx b/unoidl/source/unoidl-read.cxx index 2bbe8b672dba..1a7633535579 100644 --- a/unoidl/source/unoidl-read.cxx +++ b/unoidl/source/unoidl-read.cxx @@ -91,9 +91,8 @@ OUString decomposeType( OUString nucl(type); *rank = 0; typeArguments->clear(); - while (nucl.startsWith("[]")) { + while (nucl.startsWith("[]", &nucl)) { ++*rank; - nucl = nucl.copy(2); } sal_Int32 i = nucl.indexOf('<'); if (i != -1) { diff --git a/unoidl/source/unoidl-write.cxx b/unoidl/source/unoidl-write.cxx index ad9268e59a6e..8b3b3bf4b287 100644 --- a/unoidl/source/unoidl-write.cxx +++ b/unoidl/source/unoidl-write.cxx @@ -57,12 +57,11 @@ void badUsage() { OUString getArgumentUri(sal_uInt32 argument, bool * entities) { OUString arg; rtl_getAppCommandArg(argument, &arg.pData); - if (arg.startsWith("@")) { + if (arg.startsWith("@", &arg)) { if (entities == 0) { badUsage(); } *entities = true; - arg = arg.copy(1); } else if (entities != 0) { *entities = false; } |