improved bindings
This commit is contained in:
parent
acc7d4fa34
commit
aae349f803
8 changed files with 69 additions and 82 deletions
|
|
@ -22,6 +22,7 @@ module;
|
|||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
export module Crafter.CppDOM;
|
||||
|
||||
extern "C" {
|
||||
|
|
@ -36,8 +37,16 @@ extern "C" {
|
|||
|
||||
|
||||
|
||||
export namespace Crafter::CppDOM {
|
||||
__attribute__((import_module("env"), import_name("setInnerHTML"))) void SetInnerHTML(const char* id, std::size_t idLenght, const char* html, std::size_t htmlLenght);
|
||||
export namespace Crafter::CppDOM::Bindings {
|
||||
__attribute__((import_module("env"), import_name("getElementById"))) void* GetElementById(const char* id, std::size_t idLenght);
|
||||
inline void* GetElementById(const std::string& id){
|
||||
return GetElementById(id.c_str(), id.size());
|
||||
}
|
||||
__attribute__((import_module("env"), import_name("setInnerHTML"))) void SetInnerHTML(void* ptr, const char* html, std::size_t htmlLenght);
|
||||
inline void SetInnerHTML(void* ptr, const std::string& html){
|
||||
SetInnerHTML(ptr, html.c_str(), html.size());
|
||||
}
|
||||
__attribute__((import_module("env"), import_name("freeJs"))) void FreeJs(void* ptr);
|
||||
// __attribute__((import_module("env"), import_name("strokeRect"))) void StrokeRect(std::uint64_t id, std::uint32_t x, std::uint32_t y, std::uint32_t width, std::uint32_t height, const char* color, std::size_t colorLenght);
|
||||
// __attribute__((import_module("env"), import_name("putImageData"))) void PutImageData(std::uint64_t id, Crafter::Web::Pixel* buffer, std::uint32_t width, std::uint32_t height);
|
||||
// __attribute__((import_module("env"), import_name("fetch"))) void Fetch(void* obj, const char* url, std::size_t urlCallback, char* buffer, void (*listener)(void* obj, std::uint32_t, char*));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue