Avoid potential negative array index access to cached text.
[LibreOffice.git] / l10ntools / inc / helper.hxx
blobc1347db04c64ac77a84ed18be7e5e41903e92e9b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 // Helper string methods
12 #ifndef INCLUDED_L10NTOOLS_INC_HELPER_HXX
13 #define INCLUDED_L10NTOOLS_INC_HELPER_HXX
15 #include <sal/config.h>
17 #include <string_view>
19 #include <libxml/xmlstring.h>
21 #include <rtl/string.hxx>
24 namespace helper {
26 /// Escape all given character in the text
27 OString escapeAll(
28 std::string_view rText, std::string_view rUnEscaped, std::string_view rEscaped );
29 /// Unescape all given character in the text
30 OString unEscapeAll(
31 std::string_view rText, std::string_view rEscaped, std::string_view rUnEscaped );
33 /// Convert special characters to XML entity references
34 OString QuotHTML( std::string_view rString );
35 /// Convert XML entity references to single characters
36 OString UnQuotHTML( std::string_view rString );
38 /// Check whether text is a valid XML expression
39 bool isWellFormedXML( std::string_view text );
41 /// Convert xmlChar* to OString
42 OString xmlStrToOString( const xmlChar* pString );
46 #endif
48 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */