add an EMPTY_OUSTRING in OUString header

we already declare the same thing in various places,
and I intend to be using this some more, so it makes
sense to only declare it in one place

Change-Id: Ifea6b589e992dd9f6cd8f2301f837e71397481c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176046
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2024-11-06 09:25:10 +01:00
parent 34099cedc5
commit bd8539dfd1
8 changed files with 17 additions and 16 deletions
+10
View File
@@ -3987,6 +3987,16 @@ struct hash<::rtl::OUString>
}
#if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
/**
* static empty string object, handy for returning from functions where the function is
* returning a "const OUString &"
*
* @since LibreOffice 25.2
*/
static inline constexpr ::rtl::OUString EMPTY_OUSTRING = u""_ustr;
#endif
#endif
/// @endcond
+1 -3
View File
@@ -99,8 +99,6 @@ struct XMLPropertyMapEntry
*/
bool mbImportOnly;
static constexpr OUString EMPTY{u""_ustr};
constexpr XMLPropertyMapEntry(
const OUString& sApiName,
sal_uInt16 nNameSpace,
@@ -119,7 +117,7 @@ struct XMLPropertyMapEntry
/// used to mark the end of the array
constexpr XMLPropertyMapEntry(std::nullptr_t)
:
msApiName(EMPTY),
msApiName(EMPTY_OUSTRING),
meXMLName(xmloff::token::XML_TOKEN_INVALID), mnNameSpace(0), mnType(0),
mnContextId(0), mnEarliestODFVersionForExport(SvtSaveOptions::ODFSVER_010),
mbImportOnly(false)
@@ -539,12 +539,11 @@ static const TypeACCNameHashMap& GetACCHashMap()
const OUString & EnhancedCustomShapeTypeNames::GetAccName( const OUString& rShapeType )
{
static const OUString EMPTY;
const TypeACCNameHashMap& rACCMap = GetACCHashMap();
auto aHashIter = rACCMap.find( rShapeType );
if ( aHashIter != rACCMap.end() )
return aHashIter->second;
return EMPTY;
return EMPTY_OUSTRING;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+1 -3
View File
@@ -724,14 +724,12 @@ void SdrObject::SetName(const OUString& rStr, const bool bSetChanged)
const OUString & SdrObject::GetName() const
{
static constexpr OUString EMPTY = u""_ustr;
if(m_pPlusData)
{
return m_pPlusData->aObjName;
}
return EMPTY;
return EMPTY_OUSTRING;
}
void SdrObject::SetTitle(const OUString& rStr)
+1 -2
View File
@@ -160,7 +160,6 @@ struct CommandToRID
static OUString ImplGetRID( std::u16string_view aCommand )
{
static constexpr OUString EMPTY = u""_ustr;
static constexpr CommandToRID aImplCommandToResMap[] =
{
{ ".uno:GrafRed", RID_SVXBMP_GRAF_RED },
@@ -170,7 +169,7 @@ static OUString ImplGetRID( std::u16string_view aCommand )
{ ".uno:GrafContrast", RID_SVXBMP_GRAF_CONTRAST },
{ ".uno:GrafGamma", RID_SVXBMP_GRAF_GAMMA },
{ ".uno:GrafTransparence", RID_SVXBMP_GRAF_TRANSPARENCE },
{ nullptr, EMPTY }
{ nullptr, EMPTY_OUSTRING }
};
OUString sRID;
+1 -2
View File
@@ -858,8 +858,7 @@ const OUString& SwDocStyleSheet::GetParent() const
case SfxStyleFamily::Pseudo:
default:
{
static const OUString sEmpty;
return sEmpty; // there's no parent
return EMPTY_OUSTRING; // there's no parent
}
}
+1 -2
View File
@@ -382,8 +382,7 @@ const OUString& LocaleDataWrapper::getOneReservedWord( sal_Int16 nWord ) const
if ( nWord < 0 || o3tl::make_unsigned(nWord) >= aReservedWords.size() )
{
SAL_WARN( "unotools.i18n", "getOneReservedWord: bounds" );
static const OUString EMPTY;
return EMPTY;
return EMPTY_OUSTRING;
}
return aReservedWords[nWord];
}
@@ -112,8 +112,7 @@ const OUString& UnoInterfaceToUniqueIdentifierMapper::getIdentifier( const Refer
}
else
{
static const OUString aEmpty;
return aEmpty;
return EMPTY_OUSTRING;
}
}