Btk
textbuf.hpp
1
#if !defined(_BTKUTILS_TEXTBUFFER_HPP_)
2
#define _BTKUTILS_TEXTBUFFER_HPP_
3
#include <vector>
4
#include <string>
5
#include <cstddef>
6
#include <cstdlib>
7
#include <cstring>
8
#include <iosfwd>
9
#include <string_view>
10
#include <type_traits>
11
12
#include "../defs.hpp"
13
#include "./mem.hpp"
14
15
static_assert(
sizeof
(char16_t) ==
sizeof
(uint16_t),
"sizeof(char16_t) != sizeof(Uint16)"
);
16
17
namespace
Btk
{
18
class
BTKAPI
TextSelection
{
19
20
friend
class
TextBuffer
;
21
};
25
class
BTKAPI
TextBuffer
{
26
public
:
27
using
value_type = std::u16string;
28
using
iterator = long;
29
public
:
30
template
<
class
...Args>
31
TextBuffer
(Args &&...args):
32
data(std::forward<Args>(args)...){};
33
TextBuffer
(
const
TextBuffer
&) =
default
;
34
~
TextBuffer
();
35
36
TextBuffer
&append(std::u16string_view str){
37
data += str;
38
return
*
this
;
39
}
40
TextBuffer
&append(std::string_view str);
41
42
std::u16string *operator ->() noexcept{
43
return
&data;
44
}
45
private
:
46
std::u16string data;
//< The string container
47
friend
class
TextSelection
;
48
};
49
};
50
#endif // _BTKUTILS_TEXTBUFFER_HPP_
Btk::TextSelection
Definition:
textbuf.hpp:18
Btk
This header include many useful containers.
Definition:
async.hpp:7
Btk::TextBuffer
A container of utf16 encoded string for TextEditer.
Definition:
textbuf.hpp:25
include
Btk
utils
textbuf.hpp
Generated by
1.8.13