office-gobmx/include/o3tl/nonstaticstring.hxx
Stephan Bergmann d98e014cf6 Extended loplugin:ostr manual changes
I had done these a while ago, when I looked into extending loplugin:ostr to do
more automatic rewriting, and these were places where I needed to do something
manually, for one reason or another, because the automatic rewriting would not
pick it up correctly.

However, I got distracted, and a wholesale automatic rewrite would still run
into cases where an _ostr/_ustr instance from a library's .rodata would still be
referenced after the library has already been dlcose'd.  So I never came around
to finishing all that.

But there appears to be renewed interest in (automatic) rewritings here now, so
it probably makes sense if I share this part of my work anyway.

Change-Id: I3da9d38398e4bca373cb0000a9d34b49a36ad58a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166792
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-04-28 11:29:52 +02:00

27 lines
890 B
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <sal/config.h>
#include <string>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
namespace o3tl
{
// Some test code requires OUString instances that do not have their SAL_STRING_STATIC_FLAG set; so
// they cannot be created from u"..."_ustr literals, but should rather be created through this
// function:
OUString nonStaticString(std::u16string_view s) { return OUStringBuffer(s).makeStringAndClear(); }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */