1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <osl/interlck.h>
23 #include <osl/diagnose.h>
24 #include <rtl/character.hxx>
25 #include <rtl/ustrbuf.hxx>
29 #define RTL_LOG_STRING_BITS 16
32 #include "strtmpl.hxx"
34 void SAL_CALL
rtl_uStringbuffer_newFromStr_WithLength( rtl_uString
** newStr
,
35 const sal_Unicode
* value
,
38 rtl::str::stringbuffer_newFromStr_WithLength(newStr
, value
, count
);
41 rtl_uString
* SAL_CALL
rtl_uStringBuffer_refReturn( rtl_uString
* pThis
)
43 RTL_LOG_STRING_NEW( pThis
);
44 rtl::str::acquire( pThis
);
48 rtl_uString
* SAL_CALL
rtl_uStringBuffer_makeStringAndClear( rtl_uString
** ppThis
,
49 sal_Int32
*nCapacity
)
53 // avoid an un-necessary atomic ref/unref pair
54 rtl_uString
*pStr
= *ppThis
;
57 rtl::str::new_(ppThis
);
60 RTL_LOG_STRING_NEW( pStr
);
65 sal_Int32 SAL_CALL
rtl_uStringbuffer_newFromStringBuffer( rtl_uString
** newStr
,
67 rtl_uString
* oldStr
)
69 return rtl::str::stringbuffer_newFromStringBuffer(newStr
, capacity
, oldStr
);
72 void SAL_CALL rtl_uStringbuffer_ensureCapacity
73 (rtl_uString
** This
, sal_Int32
* capacity
, sal_Int32 minimumCapacity
)
75 rtl::str::stringbuffer_ensureCapacity(This
, capacity
, minimumCapacity
);
78 void SAL_CALL
rtl_uStringbuffer_insert( rtl_uString
** This
,
81 const sal_Unicode
* str
,
84 rtl::str::stringbuffer_insert(This
, capacity
, offset
, str
, len
);
87 void rtl_uStringbuffer_insertUtf32(
88 rtl_uString
** pThis
, sal_Int32
* capacity
, sal_Int32 offset
, sal_uInt32 c
)
92 sal_Int32 len
= rtl::splitSurrogates(c
, buf
);
93 rtl::str::stringbuffer_insert(pThis
, capacity
, offset
, buf
, len
);
96 void SAL_CALL
rtl_uStringbuffer_insert_ascii( /*inout*/rtl_uString
** This
,
97 /*inout*/sal_Int32
* capacity
,
102 rtl::str::stringbuffer_insert(This
, capacity
, offset
, str
, len
);
105 /*************************************************************************
106 * rtl_uStringbuffer_remove
108 void SAL_CALL
rtl_uStringbuffer_remove( rtl_uString
** This
,
112 rtl::str::stringbuffer_remove(This
, start
, len
);
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */