| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 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 |
}; |