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 .
20 #ifndef INCLUDED_SAL_RTL_STRIMP_HXX
21 #define INCLUDED_SAL_RTL_STRIMP_HXX
23 #include <config_probes.h>
29 #include "sal/types.h"
31 /* ======================================================================= */
32 /* Help functions for String and UString */
33 /* ======================================================================= */
36 * refCount is opaqueincludes 2 bit-fields;
37 * MSB: 'interned' - is stored in the intern hash
38 * MSB-1: 'static' - is a const / static string,
41 #define SAL_STRING_INTERN_FLAG 0x80000000
42 #define SAL_STRING_STATIC_FLAG 0x40000000
43 #define SAL_STRING_REFCOUNT(a) ((a) & 0x3fffffff)
45 #define SAL_STRING_IS_INTERN(a) ((a)->refCount & SAL_STRING_INTERN_FLAG)
46 #define SAL_STRING_IS_STATIC(a) ((a)->refCount & SAL_STRING_STATIC_FLAG)
48 sal_Int16
rtl_ImplGetDigit( sal_Unicode ch
, sal_Int16 nRadix
);
50 bool rtl_ImplIsWhitespace( sal_Unicode c
);
52 // string lifetime instrumentation / diagnostics
54 # define PROBE_SNAME(n,b) n ## _ ## b
55 # define PROBE_NAME(n,b) PROBE_SNAME(n,b)
56 # define PROBE_NEW PROBE_NAME (new_string,RTL_LOG_STRING_BITS)
57 # define PROBE_DEL PROBE_NAME (delete_string,RTL_LOG_STRING_BITS)
58 # define PROBE_INTERN_NEW PROBE_NAME (new_string_intern,RTL_LOG_STRING_BITS)
59 # define PROBE_INTERN_DEL PROBE_NAME (delete_string_intern,RTL_LOG_STRING_BITS)
60 # define RTL_LOG_STRING_NEW(s) \
61 DTRACE_PROBE4(libreoffice, PROBE_NEW, s, \
62 (s)->refCount, (s)->length, (s)->buffer)
63 # define RTL_LOG_STRING_DELETE(s) \
64 DTRACE_PROBE4(libreoffice, PROBE_DEL, s, \
65 (s)->refCount, (s)->length, (s)->buffer)
66 # define RTL_LOG_STRING_INTERN_NEW(s,o) \
67 DTRACE_PROBE5(libreoffice, PROBE_INTERN_NEW, s, \
68 (s)->refCount, (s)->length, (s)->buffer, o)
69 # define RTL_LOG_STRING_INTERN_DELETE(s) \
70 DTRACE_PROBE4(libreoffice, PROBE_INTERN_DEL, s, \
71 (s)->refCount, (s)->length, (s)->buffer)
73 # define RTL_LOG_STRING_NEW(s)
74 # define RTL_LOG_STRING_DELETE(s)
75 # define RTL_LOG_STRING_INTERN_NEW(s,o)
76 # define RTL_LOG_STRING_INTERN_DELETE(s)
77 #endif /* USE_SDT_PROBES */
79 #endif // INCLUDED_SAL_RTL_STRIMP_HXX
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */