use more string_view in sc
Change-Id: I5f77167ad874200fa4f7bc16e5de8a3348cb1886 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133097 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
8f27cde891
commit
00e5bf746f
@ -846,9 +846,9 @@ void ScTiledRenderingTest::testViewLock()
|
||||
CPPUNIT_ASSERT(!aView1.m_bViewLock);
|
||||
}
|
||||
|
||||
void lcl_extractHandleParameters(const OString& selection, sal_uInt32& id, sal_uInt32& x, sal_uInt32& y)
|
||||
void lcl_extractHandleParameters(std::string_view selection, sal_uInt32& id, sal_uInt32& x, sal_uInt32& y)
|
||||
{
|
||||
OString extraInfo = selection.copy(selection.indexOf("{"));
|
||||
OString extraInfo( selection.substr(selection.find("{")) );
|
||||
std::stringstream aStream(extraInfo.getStr());
|
||||
boost::property_tree::ptree aTree;
|
||||
boost::property_tree::read_json(aStream, aTree);
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
void Add( const ScDocument& rDoc, const OUString& rName, const ScComplexRefData& rCRD );
|
||||
inline void Add( const ScDocument& rDoc, const OUString& rName, const ScRange& aScRange );
|
||||
bool FindRel( const OUString& rRef, sal_uInt16& rIndex );
|
||||
bool FindAbs( const OUString& rRef, sal_uInt16& rIndex );
|
||||
bool FindAbs( std::u16string_view rRef, sal_uInt16& rIndex );
|
||||
};
|
||||
|
||||
inline void RangeNameBufferWK3::Add( const ScDocument& rDoc, const OUString& rName, const ScRange& aScRange )
|
||||
|
@ -478,11 +478,11 @@ bool RangeNameBufferWK3::FindRel( const OUString& rRef, sal_uInt16& rIndex )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RangeNameBufferWK3::FindAbs( const OUString& rRef, sal_uInt16& rIndex )
|
||||
bool RangeNameBufferWK3::FindAbs( std::u16string_view rRef, sal_uInt16& rIndex )
|
||||
{
|
||||
if (rRef.isEmpty())
|
||||
if (rRef.empty())
|
||||
return false;
|
||||
StringHashEntry aRef(rRef.copy(1)); // search w/o '$'!
|
||||
StringHashEntry aRef(OUString(rRef.substr(1))); // search w/o '$'!
|
||||
|
||||
std::vector<Entry>::iterator itr = std::find_if(maEntries.begin(), maEntries.end(),
|
||||
[&aRef](const Entry& rEntry) { return aRef == rEntry.aStrHashEntry; });
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <comphelper/propertysequence.hxx>
|
||||
#include <sfx2/app.hxx>
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
using namespace com::sun::star;
|
||||
@ -701,11 +702,11 @@ bool ScFormatRangeStyles::AddStyleName(OUString const & rString, sal_Int32& rInd
|
||||
}
|
||||
}
|
||||
|
||||
sal_Int32 ScFormatRangeStyles::GetIndexOfStyleName(const OUString& rString, const OUString& rPrefix, bool& bIsAutoStyle)
|
||||
sal_Int32 ScFormatRangeStyles::GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix, bool& bIsAutoStyle)
|
||||
{
|
||||
sal_Int32 nPrefixLength(rPrefix.getLength());
|
||||
OUString sTemp(rString.copy(nPrefixLength));
|
||||
sal_Int32 nIndex(sTemp.toInt32());
|
||||
std::u16string_view sTemp(rString.substr(nPrefixLength));
|
||||
sal_Int32 nIndex(o3tl::toInt32(sTemp));
|
||||
if (nIndex > 0 && o3tl::make_unsigned(nIndex-1) < aAutoStyleNames.size() && aAutoStyleNames.at(nIndex - 1) == rString)
|
||||
{
|
||||
bIsAutoStyle = true;
|
||||
@ -913,11 +914,11 @@ sal_Int32 ScColumnRowStylesBase::AddStyleName(const OUString & rString)
|
||||
return aStyleNames.size() - 1;
|
||||
}
|
||||
|
||||
sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(const OUString& rString, const OUString& rPrefix)
|
||||
sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix)
|
||||
{
|
||||
sal_Int32 nPrefixLength(rPrefix.getLength());
|
||||
OUString sTemp(rString.copy(nPrefixLength));
|
||||
sal_Int32 nIndex(sTemp.toInt32());
|
||||
std::u16string_view sTemp(rString.substr(nPrefixLength));
|
||||
sal_Int32 nIndex(o3tl::toInt32(sTemp));
|
||||
if (nIndex > 0 && o3tl::make_unsigned(nIndex-1) < aStyleNames.size() && aStyleNames.at(nIndex - 1) == rString)
|
||||
return nIndex - 1;
|
||||
else
|
||||
|
@ -172,7 +172,7 @@ public:
|
||||
void SetColDefaults(const ScMyDefaultStyleList* pDefaults) { pColDefaults = pDefaults; }
|
||||
void AddNewTable(const sal_Int32 nTable);
|
||||
bool AddStyleName(const OUString& rString, sal_Int32& rIndex, const bool bIsAutoStyle = true);
|
||||
sal_Int32 GetIndexOfStyleName(const OUString& rString, const OUString& rPrefix, bool& bIsAutoStyle);
|
||||
sal_Int32 GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix, bool& bIsAutoStyle);
|
||||
// does not delete ranges
|
||||
sal_Int32 GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow,
|
||||
bool& bIsAutoStyle) const;
|
||||
@ -197,7 +197,7 @@ public:
|
||||
|
||||
virtual void AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields) = 0;
|
||||
sal_Int32 AddStyleName(const OUString & rString);
|
||||
sal_Int32 GetIndexOfStyleName(const OUString& rString, const OUString& rPrefix);
|
||||
sal_Int32 GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix);
|
||||
OUString& GetStyleNameByIndex(const sal_Int32 nIndex);
|
||||
};
|
||||
|
||||
|
@ -3085,7 +3085,7 @@ void writeContent(
|
||||
}
|
||||
|
||||
void flushParagraph(
|
||||
ScXMLExport& rExport, const OUString& rParaText,
|
||||
ScXMLExport& rExport, std::u16string_view rParaText,
|
||||
rtl::Reference<XMLPropertySetMapper> const & xMapper, rtl::Reference<SvXMLAutoStylePoolP> const & xStylePool,
|
||||
const ScXMLEditAttributeMap& rAttrMap,
|
||||
std::vector<editeng::Section>::const_iterator it, std::vector<editeng::Section>::const_iterator const & itEnd )
|
||||
@ -3098,7 +3098,7 @@ void flushParagraph(
|
||||
{
|
||||
const editeng::Section& rSec = *it;
|
||||
|
||||
OUString aContent(rParaText.copy(rSec.mnStart, rSec.mnEnd - rSec.mnStart));
|
||||
OUString aContent(rParaText.substr(rSec.mnStart, rSec.mnEnd - rSec.mnStart));
|
||||
|
||||
std::vector<XMLPropertyState> aPropStates;
|
||||
const SvxFieldData* pField = toXMLPropertyStates(aPropStates, rSec.maAttributes, xMapper, rAttrMap);
|
||||
|
Loading…
x
Reference in New Issue
Block a user