minor refactor
This commit is contained in:
parent
d2b4e096ae
commit
cefa26b497
@ -53,11 +53,11 @@ namespace xml {
|
||||
/// @brief Get element tag
|
||||
const std::string& getTag() const;
|
||||
|
||||
inline bool isText() const {
|
||||
bool isText() const {
|
||||
return getTag() == "#";
|
||||
}
|
||||
|
||||
inline const std::string& text() const {
|
||||
const std::string& getInnerText() const {
|
||||
return attr("#").getText();
|
||||
}
|
||||
|
||||
|
||||
@ -287,7 +287,7 @@ static std::wstring parse_inner_text(
|
||||
) {
|
||||
std::wstring text = L"";
|
||||
if (element.size() == 1) {
|
||||
std::string source = element.sub(0).attr("#").getText();
|
||||
std::string source = element.sub(0).getInnerText();
|
||||
util::trim(source);
|
||||
text = util::str2wstr_utf8(source);
|
||||
if (text[0] == '@') {
|
||||
@ -387,7 +387,7 @@ static std::shared_ptr<UINode> read_button(
|
||||
|
||||
std::shared_ptr<Button> button;
|
||||
auto& elements = element.getElements();
|
||||
if (!elements.empty() && elements[0]->getTag() != "#") {
|
||||
if (!elements.empty() && elements[0]->isText()) {
|
||||
auto inner = reader.readUINode(*elements.at(0));
|
||||
if (inner != nullptr) {
|
||||
button = std::make_shared<Button>(gui, inner, padding);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user