From f1965f4bd5f988d9ed64d34618b226dc12a94438 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 19 Nov 2021 08:10:00 +0100 Subject: [PATCH] Added 3 helper methods. --- core/html/html_parser.cpp | 14 ++++++++++++++ core/html/html_parser.h | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/core/html/html_parser.cpp b/core/html/html_parser.cpp index 51fc291..e493cdd 100644 --- a/core/html/html_parser.cpp +++ b/core/html/html_parser.cpp @@ -1,6 +1,20 @@ #include "html_parser.h" #include "core/error_macros.h" +bool HTMLParserAttribute::match_attrib(const String &attrib) { + return attribute == attrib; +} +bool HTMLParserAttribute::match_data(const String &d) { + return data == d; +} +bool HTMLParserAttribute::match_data(const Vector &d) { + //todo + return false; +} +bool HTMLParserAttribute::contains_data(const String &d) { + return attribute.find(d) != -1; +} + String HTMLParserAttribute::to_string() { if (single) { return attribute; diff --git a/core/html/html_parser.h b/core/html/html_parser.h index 8cbd0f9..52dffe5 100644 --- a/core/html/html_parser.h +++ b/core/html/html_parser.h @@ -10,6 +10,11 @@ public: String data; bool single; + bool match_attrib(const String &attrib); + bool match_data(const String &d); + bool match_data(const Vector &d); + bool contains_data(const String &d); + String to_string(); void print();