summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-08-27 11:40:59 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-08-28 08:07:09 +0200
commit33ecd0d5c4fff9511a8436513936a3f7044a775a (patch)
treec25809adda140ff89d9f2a2b6dfadba17e188fb0 /toolkit
parent554834484a3323f73b5aeace246bcd9635368967 (diff)
Change OUStringLiteral from char[] to char16_t[]
This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx148
-rw-r--r--toolkit/source/controls/unocontrol.cxx2
2 files changed, 75 insertions, 75 deletions
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index ab4d8ae58585..81fc7d618e19 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -694,82 +694,82 @@ struct ComponentInfo
ComponentInfo const aComponentInfos [] =
{
- { OUStringLiteral("animatedimages"), WindowType::CONTROL },
- { OUStringLiteral("buttondialog"), WindowType::BUTTONDIALOG },
- { OUStringLiteral("cancelbutton"), WindowType::CANCELBUTTON },
- { OUStringLiteral("checkbox"), WindowType::CHECKBOX },
- { OUStringLiteral("combobox"), WindowType::COMBOBOX },
- { OUStringLiteral("control"), WindowType::CONTROL },
- { OUStringLiteral("currencybox"), WindowType::CURRENCYBOX },
- { OUStringLiteral("currencyfield"), WindowType::CURRENCYFIELD },
- { OUStringLiteral("datebox"), WindowType::DATEBOX },
- { OUStringLiteral("datefield"), WindowType::CONTROL },
- { OUStringLiteral("dialog"), WindowType::DIALOG },
- { OUStringLiteral("dockingarea"), WindowType::DOCKINGAREA },
- { OUStringLiteral("dockingwindow"), WindowType::DOCKINGWINDOW },
- { OUStringLiteral("edit"), WindowType::EDIT },
- { OUStringLiteral("errorbox"), WindowType::ERRORBOX },
- { OUStringLiteral("filecontrol"), WindowType::CONTROL },
- { OUStringLiteral("fixedbitmap"), WindowType::FIXEDBITMAP },
- { OUStringLiteral("fixedhyperlink"), WindowType::CONTROL },
- { OUStringLiteral("fixedimage"), WindowType::FIXEDIMAGE },
- { OUStringLiteral("fixedline"), WindowType::FIXEDLINE },
- { OUStringLiteral("fixedtext"), WindowType::FIXEDTEXT },
- { OUStringLiteral("floatingwindow"), WindowType::FLOATINGWINDOW },
- { OUStringLiteral("formattedfield"), WindowType::CONTROL },
- { OUStringLiteral("frame"), WindowType::GROUPBOX },
- { OUStringLiteral("framewindow"), WindowType::TOOLKIT_FRAMEWINDOW },
- { OUStringLiteral("groupbox"), WindowType::GROUPBOX },
- { OUStringLiteral("helpbutton"), WindowType::HELPBUTTON },
- { OUStringLiteral("imagebutton"), WindowType::IMAGEBUTTON },
- { OUStringLiteral("infobox"), WindowType::INFOBOX },
- { OUStringLiteral("listbox"), WindowType::LISTBOX },
- { OUStringLiteral("longcurrencybox"), WindowType::LONGCURRENCYBOX },
- { OUStringLiteral("longcurrencyfield"), WindowType::CONTROL },
- { OUStringLiteral("menubutton"), WindowType::MENUBUTTON },
- { OUStringLiteral("messbox"), WindowType::MESSBOX },
- { OUStringLiteral("metricbox"), WindowType::METRICBOX },
- { OUStringLiteral("metricfield"), WindowType::METRICFIELD },
- { OUStringLiteral("modelessdialog"), WindowType::MODELESSDIALOG },
- { OUStringLiteral("morebutton"), WindowType::MOREBUTTON },
- { OUStringLiteral("multilineedit"), WindowType::MULTILINEEDIT },
- { OUStringLiteral("multilistbox"), WindowType::MULTILISTBOX },
- { OUStringLiteral("numericbox"), WindowType::NUMERICBOX },
- { OUStringLiteral("numericfield"), WindowType::CONTROL },
- { OUStringLiteral("okbutton"), WindowType::OKBUTTON },
- { OUStringLiteral("patternbox"), WindowType::PATTERNBOX },
- { OUStringLiteral("patternfield"), WindowType::PATTERNFIELD },
- { OUStringLiteral("progressbar"), WindowType::CONTROL },
- { OUStringLiteral("pushbutton"), WindowType::PUSHBUTTON },
- { OUStringLiteral("querybox"), WindowType::QUERYBOX },
- { OUStringLiteral("radiobutton"), WindowType::RADIOBUTTON },
- { OUStringLiteral("roadmap"), WindowType::CONTROL },
- { OUStringLiteral("scrollbar"), WindowType::SCROLLBAR },
- { OUStringLiteral("scrollbarbox"), WindowType::SCROLLBARBOX },
- { OUStringLiteral("spinbutton"), WindowType::SPINBUTTON },
- { OUStringLiteral("spinfield"), WindowType::SPINFIELD },
- { OUStringLiteral("splitter"), WindowType::SPLITTER },
- { OUStringLiteral("splitwindow"), WindowType::SPLITWINDOW },
- { OUStringLiteral("statusbar"), WindowType::STATUSBAR },
- { OUStringLiteral("systemchildwindow"), WindowType::TOOLKIT_SYSTEMCHILDWINDOW },
- { OUStringLiteral("tabcontrol"), WindowType::TABCONTROL },
- { OUStringLiteral("tabdialog"), WindowType::TABDIALOG },
- { OUStringLiteral("tabpage"), WindowType::TABPAGE },
- { OUStringLiteral("tabpagecontainer"), WindowType::CONTROL },
- { OUStringLiteral("tabpagemodel"), WindowType::TABPAGE },
- { OUStringLiteral("timebox"), WindowType::TIMEBOX },
- { OUStringLiteral("timefield"), WindowType::TIMEFIELD },
- { OUStringLiteral("toolbox"), WindowType::TOOLBOX },
- { OUStringLiteral("tree"), WindowType::CONTROL },
- { OUStringLiteral("tristatebox"), WindowType::TRISTATEBOX },
- { OUStringLiteral("warningbox"), WindowType::WARNINGBOX },
- { OUStringLiteral("window"), WindowType::WINDOW },
- { OUStringLiteral("workwindow"), WindowType::WORKWINDOW }
+ { OUStringLiteral(u"animatedimages"), WindowType::CONTROL },
+ { OUStringLiteral(u"buttondialog"), WindowType::BUTTONDIALOG },
+ { OUStringLiteral(u"cancelbutton"), WindowType::CANCELBUTTON },
+ { OUStringLiteral(u"checkbox"), WindowType::CHECKBOX },
+ { OUStringLiteral(u"combobox"), WindowType::COMBOBOX },
+ { OUStringLiteral(u"control"), WindowType::CONTROL },
+ { OUStringLiteral(u"currencybox"), WindowType::CURRENCYBOX },
+ { OUStringLiteral(u"currencyfield"), WindowType::CURRENCYFIELD },
+ { OUStringLiteral(u"datebox"), WindowType::DATEBOX },
+ { OUStringLiteral(u"datefield"), WindowType::CONTROL },
+ { OUStringLiteral(u"dialog"), WindowType::DIALOG },
+ { OUStringLiteral(u"dockingarea"), WindowType::DOCKINGAREA },
+ { OUStringLiteral(u"dockingwindow"), WindowType::DOCKINGWINDOW },
+ { OUStringLiteral(u"edit"), WindowType::EDIT },
+ { OUStringLiteral(u"errorbox"), WindowType::ERRORBOX },
+ { OUStringLiteral(u"filecontrol"), WindowType::CONTROL },
+ { OUStringLiteral(u"fixedbitmap"), WindowType::FIXEDBITMAP },
+ { OUStringLiteral(u"fixedhyperlink"), WindowType::CONTROL },
+ { OUStringLiteral(u"fixedimage"), WindowType::FIXEDIMAGE },
+ { OUStringLiteral(u"fixedline"), WindowType::FIXEDLINE },
+ { OUStringLiteral(u"fixedtext"), WindowType::FIXEDTEXT },
+ { OUStringLiteral(u"floatingwindow"), WindowType::FLOATINGWINDOW },
+ { OUStringLiteral(u"formattedfield"), WindowType::CONTROL },
+ { OUStringLiteral(u"frame"), WindowType::GROUPBOX },
+ { OUStringLiteral(u"framewindow"), WindowType::TOOLKIT_FRAMEWINDOW },
+ { OUStringLiteral(u"groupbox"), WindowType::GROUPBOX },
+ { OUStringLiteral(u"helpbutton"), WindowType::HELPBUTTON },
+ { OUStringLiteral(u"imagebutton"), WindowType::IMAGEBUTTON },
+ { OUStringLiteral(u"infobox"), WindowType::INFOBOX },
+ { OUStringLiteral(u"listbox"), WindowType::LISTBOX },
+ { OUStringLiteral(u"longcurrencybox"), WindowType::LONGCURRENCYBOX },
+ { OUStringLiteral(u"longcurrencyfield"), WindowType::CONTROL },
+ { OUStringLiteral(u"menubutton"), WindowType::MENUBUTTON },
+ { OUStringLiteral(u"messbox"), WindowType::MESSBOX },
+ { OUStringLiteral(u"metricbox"), WindowType::METRICBOX },
+ { OUStringLiteral(u"metricfield"), WindowType::METRICFIELD },
+ { OUStringLiteral(u"modelessdialog"), WindowType::MODELESSDIALOG },
+ { OUStringLiteral(u"morebutton"), WindowType::MOREBUTTON },
+ { OUStringLiteral(u"multilineedit"), WindowType::MULTILINEEDIT },
+ { OUStringLiteral(u"multilistbox"), WindowType::MULTILISTBOX },
+ { OUStringLiteral(u"numericbox"), WindowType::NUMERICBOX },
+ { OUStringLiteral(u"numericfield"), WindowType::CONTROL },
+ { OUStringLiteral(u"okbutton"), WindowType::OKBUTTON },
+ { OUStringLiteral(u"patternbox"), WindowType::PATTERNBOX },
+ { OUStringLiteral(u"patternfield"), WindowType::PATTERNFIELD },
+ { OUStringLiteral(u"progressbar"), WindowType::CONTROL },
+ { OUStringLiteral(u"pushbutton"), WindowType::PUSHBUTTON },
+ { OUStringLiteral(u"querybox"), WindowType::QUERYBOX },
+ { OUStringLiteral(u"radiobutton"), WindowType::RADIOBUTTON },
+ { OUStringLiteral(u"roadmap"), WindowType::CONTROL },
+ { OUStringLiteral(u"scrollbar"), WindowType::SCROLLBAR },
+ { OUStringLiteral(u"scrollbarbox"), WindowType::SCROLLBARBOX },
+ { OUStringLiteral(u"spinbutton"), WindowType::SPINBUTTON },
+ { OUStringLiteral(u"spinfield"), WindowType::SPINFIELD },
+ { OUStringLiteral(u"splitter"), WindowType::SPLITTER },
+ { OUStringLiteral(u"splitwindow"), WindowType::SPLITWINDOW },
+ { OUStringLiteral(u"statusbar"), WindowType::STATUSBAR },
+ { OUStringLiteral(u"systemchildwindow"), WindowType::TOOLKIT_SYSTEMCHILDWINDOW },
+ { OUStringLiteral(u"tabcontrol"), WindowType::TABCONTROL },
+ { OUStringLiteral(u"tabdialog"), WindowType::TABDIALOG },
+ { OUStringLiteral(u"tabpage"), WindowType::TABPAGE },
+ { OUStringLiteral(u"tabpagecontainer"), WindowType::CONTROL },
+ { OUStringLiteral(u"tabpagemodel"), WindowType::TABPAGE },
+ { OUStringLiteral(u"timebox"), WindowType::TIMEBOX },
+ { OUStringLiteral(u"timefield"), WindowType::TIMEFIELD },
+ { OUStringLiteral(u"toolbox"), WindowType::TOOLBOX },
+ { OUStringLiteral(u"tree"), WindowType::CONTROL },
+ { OUStringLiteral(u"tristatebox"), WindowType::TRISTATEBOX },
+ { OUStringLiteral(u"warningbox"), WindowType::WARNINGBOX },
+ { OUStringLiteral(u"window"), WindowType::WINDOW },
+ { OUStringLiteral(u"workwindow"), WindowType::WORKWINDOW }
};
bool ComponentInfoFindCompare( const ComponentInfo & lhs, const OUString & s)
{
- return rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(s.pData->buffer, s.pData->length,
+ return rtl_ustr_compareIgnoreAsciiCase_WithLength(s.pData->buffer, s.pData->length,
lhs.sName.data, lhs.sName.size) > 0;
}
@@ -781,7 +781,7 @@ WindowType ImplGetComponentType( const OUString& rServiceName )
assert( std::is_sorted( std::begin(aComponentInfos), std::end(aComponentInfos),
[](const ComponentInfo & lhs, const ComponentInfo & rhs) {
return
- rtl_str_compare_WithLength(
+ rtl_ustr_compare_WithLength(
lhs.sName.data, lhs.sName.size, rhs.sName.data, rhs.sName.size)
< 0;
} ) );
@@ -797,7 +797,7 @@ WindowType ImplGetComponentType( const OUString& rServiceName )
auto it = std::lower_bound( std::begin(aComponentInfos), std::end(aComponentInfos), sSearch,
ComponentInfoFindCompare );
if (it != std::end(aComponentInfos) &&
- rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(sSearch.pData->buffer, sSearch.pData->length, it->sName.data, it->sName.size) == 0)
+ rtl_ustr_compareIgnoreAsciiCase_WithLength(sSearch.pData->buffer, sSearch.pData->length, it->sName.data, it->sName.size) == 0)
return it->nWinType;
return WindowType::NONE;
}
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index e38a68ff8322..fdf7510001ea 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -1393,7 +1393,7 @@ void UnoControl::setDesignMode( sal_Bool bOn )
maAccessibleContext.clear();
aModeChangeEvent.Source = *this;
- aModeChangeEvent.NewMode = mbDesignMode ? OUStringLiteral("design") : OUStringLiteral("alive" );
+ aModeChangeEvent.NewMode = mbDesignMode ? OUStringLiteral(u"design") : OUStringLiteral(u"alive" );
}
// dispose current AccessibleContext, if we have one - without Mutex lock