Bump version to 24.04.3.4
[LibreOffice.git] / sal / rtl / ustrbuf.cxx
blob6154814ebb9eadfcb03734e7cbe976018d26ce49
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <osl/interlck.h>
21 #include <rtl/character.hxx>
22 #include <rtl/ustrbuf.h>
23 #include "strimp.hxx"
25 #if USE_SDT_PROBES
26 #define RTL_LOG_STRING_BITS 16
27 #endif
29 #include "strtmpl.hxx"
31 void SAL_CALL rtl_uStringbuffer_newFromStr_WithLength( rtl_uString ** newStr,
32 const sal_Unicode * value,
33 sal_Int32 count)
35 rtl::str::stringbuffer_newFromStr_WithLength(newStr, value, count);
38 rtl_uString * SAL_CALL rtl_uStringBuffer_refReturn( rtl_uString * pThis )
40 RTL_LOG_STRING_NEW( pThis );
41 rtl::str::acquire( pThis );
42 return pThis;
45 rtl_uString * SAL_CALL rtl_uStringBuffer_makeStringAndClear( rtl_uString ** ppThis,
46 sal_Int32 *nCapacity )
48 assert(ppThis);
49 assert(nCapacity);
50 // avoid an un-necessary atomic ref/unref pair
51 rtl_uString *pStr = *ppThis;
52 *ppThis = nullptr;
54 rtl::str::new_(ppThis);
55 *nCapacity = 0;
57 RTL_LOG_STRING_NEW( pStr );
59 return pStr;
62 sal_Int32 SAL_CALL rtl_uStringbuffer_newFromStringBuffer( rtl_uString ** newStr,
63 sal_Int32 capacity,
64 rtl_uString * oldStr )
66 return rtl::str::stringbuffer_newFromStringBuffer(newStr, capacity, oldStr);
69 void SAL_CALL rtl_uStringbuffer_ensureCapacity
70 (rtl_uString ** This, sal_Int32* capacity, sal_Int32 minimumCapacity)
72 rtl::str::stringbuffer_ensureCapacity(This, capacity, minimumCapacity);
75 void SAL_CALL rtl_uStringbuffer_insert( rtl_uString ** This,
76 sal_Int32 * capacity,
77 sal_Int32 offset,
78 const sal_Unicode * str,
79 sal_Int32 len)
81 rtl::str::stringbuffer_insert(This, capacity, offset, str, len);
84 void rtl_uStringbuffer_insertUtf32(
85 rtl_uString ** pThis, sal_Int32 * capacity, sal_Int32 offset, sal_uInt32 c)
86 SAL_THROW_EXTERN_C()
88 sal_Unicode buf[2];
89 sal_Int32 len = rtl::splitSurrogates(c, buf);
90 rtl::str::stringbuffer_insert(pThis, capacity, offset, buf, len);
93 void SAL_CALL rtl_uStringbuffer_insert_ascii( /*inout*/rtl_uString ** This,
94 /*inout*/sal_Int32 * capacity,
95 sal_Int32 offset,
96 const char * str,
97 sal_Int32 len)
99 rtl::str::stringbuffer_insert(This, capacity, offset, str, len);
102 /*************************************************************************
103 * rtl_uStringbuffer_remove
105 void SAL_CALL rtl_uStringbuffer_remove( rtl_uString ** This,
106 sal_Int32 start,
107 sal_Int32 len )
109 rtl::str::stringbuffer_remove(This, start, len);
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */