Loading...
Searching...
No Matches
OpaqueString.hpp
1#pragma once
2#include <QString>
3
4#include <string>
5
7{
8 friend bool operator==(const OpaqueString& lhs, const OpaqueString& rhs) noexcept
9 {
10 return lhs.impl == rhs.impl;
11 }
12
13 friend bool operator!=(const OpaqueString& lhs, const OpaqueString& rhs) noexcept
14 {
15 return lhs.impl != rhs.impl;
16 }
17
18 friend bool operator<(const OpaqueString& lhs, const OpaqueString& rhs) noexcept
19 {
20 return lhs.impl < rhs.impl;
21 }
22
23public:
24 OpaqueString() = default;
25
26 explicit OpaqueString(const char* str) noexcept
27 : impl{str}
28 {
29 }
30 explicit OpaqueString(std::string str) noexcept
31 : impl{std::move(str)}
32 {
33 }
34 explicit OpaqueString(const QString& str) noexcept
35 : impl{str.toStdString()}
36 {
37 }
38
39 explicit OpaqueString(const OpaqueString& str) noexcept
40 : impl{str.impl}
41 {
42 }
43 explicit OpaqueString(OpaqueString&& str) noexcept
44 : impl{std::move(str.impl)}
45 {
46 }
47
48 OpaqueString& operator=(const OpaqueString& str) noexcept
49 {
50 impl = str.impl;
51 return *this;
52 }
53 OpaqueString& operator=(OpaqueString&& str) noexcept
54 {
55 impl = std::move(str.impl);
56 return *this;
57 }
58
59protected:
60 std::string impl;
61};
Definition OpaqueString.hpp:7