use more string_view in unodevtools
Change-Id: I60e090381e6e56d531b9727604b4755b96c608c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133516 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
2b418c16cd
commit
7e3c2e46c6
3 changed files with 11 additions and 10 deletions
|
@ -29,7 +29,7 @@ namespace unodevtools {
|
|||
|
||||
|
||||
bool readOption( OUString * pValue, const char * pOpt,
|
||||
sal_uInt32 * pnIndex, const OUString & aArg);
|
||||
sal_uInt32 * pnIndex, std::u16string_view aArg);
|
||||
// throws CannotDumpException
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace skeletonmaker::cpp {
|
|||
|
||||
static void generateIncludes(std::ostream & o,
|
||||
const std::set< OUString >& interfaces,
|
||||
const OUString & propertyhelper, const bool serviceobject,
|
||||
std::u16string_view propertyhelper, const bool serviceobject,
|
||||
const bool supportxcomponent)
|
||||
{
|
||||
o << "#include \"sal/config.h\"\n";
|
||||
|
@ -51,8 +51,8 @@ static void generateIncludes(std::ostream & o,
|
|||
o << "#include \"cppuhelper/implbase" << interfaces.size() << ".hxx\"\n";
|
||||
}
|
||||
|
||||
if (propertyhelper.getLength() > 1) {
|
||||
if (propertyhelper == "_")
|
||||
if (propertyhelper.size() > 1) {
|
||||
if (propertyhelper == u"_")
|
||||
o << "#include \"cppuhelper/rpopshlp.hxx\"\n";
|
||||
else
|
||||
o << "#include \"cppuhelper/propertysetmixin.hxx\"\n";
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <codemaker/global.hxx>
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <rtl/process.h>
|
||||
|
@ -28,18 +29,18 @@ namespace unodevtools {
|
|||
|
||||
|
||||
bool readOption( OUString * pValue, const char * pOpt,
|
||||
sal_uInt32 * pnIndex, const OUString & aArg)
|
||||
sal_uInt32 * pnIndex, std::u16string_view aArg)
|
||||
{
|
||||
static const OUStringLiteral dash = u"-";
|
||||
if(aArg.indexOf(dash) != 0)
|
||||
if(aArg.find(dash) != 0)
|
||||
return false;
|
||||
|
||||
OUString aOpt = OUString::createFromAscii( pOpt );
|
||||
|
||||
if (aArg.getLength() < aOpt.getLength())
|
||||
if (aArg.size() < o3tl::make_unsigned(aOpt.getLength()))
|
||||
return false;
|
||||
|
||||
if (aOpt.equalsIgnoreAsciiCase( aArg.subView(1) )) {
|
||||
if (aOpt.equalsIgnoreAsciiCase( aArg.substr(1) )) {
|
||||
// take next argument
|
||||
++(*pnIndex);
|
||||
|
||||
|
@ -53,8 +54,8 @@ bool readOption( OUString * pValue, const char * pOpt,
|
|||
SAL_INFO("unodevtools", "identified option -" << pOpt << " = " << *pValue);
|
||||
++(*pnIndex);
|
||||
return true;
|
||||
} else if (aArg.indexOf(aOpt) == 1) {
|
||||
*pValue = aArg.copy(1 + aOpt.getLength());
|
||||
} else if (aArg.find(aOpt) == 1) {
|
||||
*pValue = aArg.substr(1 + aOpt.getLength());
|
||||
SAL_INFO("unodevtools", "identified option -" << pOpt << " = " << *pValue);
|
||||
++(*pnIndex);
|
||||
|
||||
|
|
Loading…
Reference in a new issue