added HtmlElement class
This commit is contained in:
parent
3174f75e21
commit
9ee52266b5
8 changed files with 55 additions and 38 deletions
26
Crafter.CppDOM-HtmlElement.cppm
Normal file
26
Crafter.CppDOM-HtmlElement.cppm
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
module;
|
||||
#include <string>
|
||||
export module Crafter.CppDOM:HtmlElement;
|
||||
import :Bindings;
|
||||
|
||||
namespace Crafter::CppDOM {
|
||||
export class HtmlElement {
|
||||
public:
|
||||
void* const ptr;
|
||||
inline HtmlElement(const char* id, std::size_t idLenght): ptr(Bindings::GetElementById(id, idLenght)) {
|
||||
|
||||
}
|
||||
inline HtmlElement(const std::string& id): ptr(Bindings::GetElementById(id)) {
|
||||
|
||||
}
|
||||
inline void SetInnerHTML(const char* html, std::size_t htmlLenght) {
|
||||
Bindings::SetInnerHTML(ptr, html, htmlLenght);
|
||||
}
|
||||
inline void SetInnerHTML(const std::string& html) {
|
||||
Bindings::SetInnerHTML(ptr, html);
|
||||
}
|
||||
inline ~HtmlElement(){
|
||||
Bindings::FreeJs(ptr);
|
||||
}
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue