LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
stringspool.h
Go to the documentation of this file.
1// Copyright 2002-2020 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6//
7// C++ Interface: stringspool
8//
9// Description:
10//
11//
12// Author: CEA LIST <Gael.de-Chalendar@cea.fr>
13//
14// Copyright: See COPYING file that comes with this distribution
15//
16//
17#ifndef LIMA_DATA_STRINGSPOOL_H
18#define LIMA_DATA_STRINGSPOOL_H
19
20#include "common/LimaCommon.h"
22
23#ifdef WIN32
24#include <hash_map>
25#else
26#ifndef NO_STDCPP0X
27#include <unordered_map>
28#else
29#include <ext/hash_map>
30#endif
31#endif
32#include <boost/serialization/strong_typedef.hpp>
33
34namespace Lima {
35
36class StringsPoolPrivate;
37
38#define STRINGS_POOL_INDEX_TYPE uint64_t
40#define STRINGS_POOL_INDEX_MAX_VALUE std::numeric_limits<STRINGS_POOL_INDEX_TYPE>::max()
41
46{
47public:
49
51
52 StringsPoolIndex operator[](const LimaString& str) const;
53 StringsPoolIndex operator[](const LimaString& str);
54
55 const LimaString& operator[](const StringsPoolIndex ind) const;
56 LimaString& operator[](const StringsPoolIndex ind);
57
58 void registerUser(void* p);
59 void unregisterUser(void* p);
60
61 void endResourcesPool();
62
63 bool empty() const;
64 uint64_t size() const;
65
66 StringsPool(const StringsPool& /*unused p*/) = delete;
67 StringsPool& operator=(const StringsPool& /*unused p*/) = delete;
68
69private:
70
72};
73
74} // closing namespace Lima
75
76namespace std {
77
78template<> struct hash<Lima::StringsPoolIndex> {
79 std::size_t operator()(const Lima::StringsPoolIndex s) const noexcept {
80 return (size_t) qHash(s);
81 }
82};
83
84}
85
86#endif // LIMA_DATA_STRINGSPOOL_H
#define LIMA_COMMONMISC_EXPORT
Definition LimaCommon.h:133
StringsPool & operator=(const StringsPool &)=delete
StringsPool(const StringsPool &)=delete
NAUTITIA.
BOOST_STRONG_TYPEDEF(char, NoParameters)
QString LimaString
Definition LimaString.h:33
STL namespace.
#define STRINGS_POOL_INDEX_TYPE
Definition stringspool.h:38