Orcus
Loading...
Searching...
No Matches
string_pool.hpp
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 */
7
8#ifndef INCLUDED_ORCUS_STRING_POOL_HPP
9#define INCLUDED_ORCUS_STRING_POOL_HPP
10
11#include "env.hpp"
12
13#include <string>
14#include <memory>
15#include <vector>
16
17namespace orcus {
18
22class ORCUS_PSR_DLLPUBLIC string_pool
23{
24public:
25 string_pool(const string_pool&) = delete;
26 string_pool& operator=(const string_pool&) = delete;
27
30
40 std::pair<std::string_view, bool> intern(std::string_view str);
41
47 std::vector<std::string_view> get_interned_strings() const;
48
49 void dump() const;
50
51 void clear();
52
53 size_t size() const;
54
55 void swap(string_pool& other);
56
66 void merge(string_pool& other);
67
68private:
69 struct impl;
70 std::unique_ptr<impl> mp_impl;
71};
72
73}
74
75#endif
76/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition string_pool.hpp:23
std::pair< std::string_view, bool > intern(std::string_view str)
void merge(string_pool &other)
std::vector< std::string_view > get_interned_strings() const