Debian Codegraph @

src/util/UserphraseSet.h

raw symbols SCIP
1 /*
2 * chewing-editor: Chewing userphrase editor
3 * Copyright (C) 2014 Chewing Development Team
4
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 #include <set>
23 #include <vector>
24
25 #include <QString>
26
27 #include "Userphrase.h"
28
29 class UserphraseSet {
30 public:
31 UserphraseSet() = default;
32 UserphraseSet(const UserphraseSet&) = default;
33 UserphraseSet& operator=(const UserphraseSet&) = default;
34 virtual ~UserphraseSet() = default;
35
36 typedef std::vector<Userphrase>::const_iterator const_iterator;
37 typedef std::vector<Userphrase>::iterator iterator;
38
39 bool insert(Userphrase&& userphrase);
40 void erase(iterator it);
41
42 iterator begin();
43 iterator end();
44
45 const_iterator begin() const;
46 const_iterator end() const;
47 size_t size() const;
48 bool empty() const { return userphrase_.empty(); }
49
50 const Userphrase& operator[](size_t index) const;
51
52 void swap(UserphraseSet& set) noexcept;
53
54 private:
55 std::vector<Userphrase> userphrase_;
56 std::set<QString> dedup_;
57 };