Skip to content

Text

A std::variant of String and std::shared_ptr<AttributedString>.

Declaration

namespace bdn::ui {
    class Text : public std::variant<String, std::shared_ptr<AttributedString>>
}

Example

#include <bdn/ui/Text.h>
#include <bdn/Json.h>

int main() {
    bdn::ui::Text text;
    bdn::json j = JsonStringify({
        "text" : 
            {"html" : "<a href=\"http://www.boden.io\">www.boden.io</a>"}
    });

    text = j.get<bdn::ui::Text>();

    return 0;
}

Operators

  • String operator()

    Returns a String whether the variant holds a String or an AttributedString.

  • bool operator!=(const bdn::ui::Text &lhs, const bdn::ui::Text &rhs)

    Checks for inequality.

Stylesheet

You can de-/serialize Text objects into JSON taking two forms:

Source

Text.h