Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / svl / sharedstringpool.hxx
blob6880fec2a101d62aef6350478692e8cbb6238d8f
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 #ifndef INCLUDED_SVL_SHAREDSTRINGPOOL_HXX
11 #define INCLUDED_SVL_SHAREDSTRINGPOOL_HXX
13 #include <svl/svldllapi.h>
14 #include <rtl/ustring.hxx>
15 #include <memory>
17 class CharClass;
19 namespace svl
21 class SharedString;
23 /**
24 * Storage for pool of shared strings. It also provides mapping from
25 * original-cased strings to upper-cased strings for case insensitive
26 * operations.
28 class SVL_DLLPUBLIC SharedStringPool
30 struct Impl;
31 std::unique_ptr<Impl> mpImpl;
33 SharedStringPool(const SharedStringPool&) = delete;
34 SharedStringPool& operator=(const SharedStringPool&) = delete;
36 public:
37 SharedStringPool(const CharClass& rCharClass);
38 ~SharedStringPool();
40 /**
41 * Intern a string object into the shared string pool.
43 * @param rStr string object to intern.
45 * @return a pointer to the string object stored inside the pool, or NULL
46 * if the insertion fails.
48 SharedString intern(const OUString& rStr);
50 /**
51 * Go through all string objects in the pool, and clear those that are no
52 * longer used outside of the pool.
54 void purge();
56 // For unit tests. Note that an "empty" pool may contain some internal items,
57 // such as SharedString::getEmptyString().
58 size_t getCount() const;
59 size_t getCountIgnoreCase() const;
63 #endif
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */