aboutsummaryrefslogtreecommitdiff
path: root/src/stflrichtext.cpp
blob: 0f3a169eb8619196b31e045695ef867f58f2c649 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "stflrichtext.h"

namespace newsboat {

StflRichText::StflRichText(rust::Box<stflrichtext::bridged::StflRichText>&& rs_object)
	: rs_object(std::move(rs_object))
{
}

StflRichText::StflRichText(const StflRichText& other)
	: rs_object(stflrichtext::bridged::copy(*other.rs_object))
{
}

StflRichText& StflRichText::operator=(const StflRichText& other)
{
	this->rs_object = stflrichtext::bridged::copy(*other.rs_object);
	return *this;
}

StflRichText StflRichText::from_plaintext(std::string text)
{
	auto rs_object = stflrichtext::bridged::from_plaintext(text);

	return StflRichText(std::move(rs_object));
}

StflRichText StflRichText::from_quoted(std::string text)
{
	auto rs_object = stflrichtext::bridged::from_quoted(text);

	return StflRichText(std::move(rs_object));
}

void StflRichText::apply_style_tag(const std::string& tag, size_t start, size_t end)
{
	stflrichtext::bridged::apply_style_tag(*rs_object, tag, start, end);
}

std::string StflRichText::plaintext() const
{
	return std::string(stflrichtext::bridged::plaintext(*rs_object));
}

std::string StflRichText::stfl_quoted() const
{
	return std::string(stflrichtext::bridged::quoted(*rs_object));
}

}