wasm: make all val() accessors const

Enable using them in a const context, for instance when
calling "const" native API.

Change-Id: I0b3fe33ab7fabf4bda8565d4de88bb21367d356e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Sørvig 2023-08-30 11:33:21 +02:00
parent 89ce65c2d0
commit bcd3e500e1
2 changed files with 10 additions and 10 deletions

View File

@ -499,7 +499,7 @@ uint32_t ArrayBuffer::byteLength() const
return m_arrayBuffer["byteLength"].as<uint32_t>();
}
emscripten::val ArrayBuffer::val()
emscripten::val ArrayBuffer::val() const
{
return m_arrayBuffer;
}
@ -532,7 +532,7 @@ Blob Blob::copyFrom(const char *buffer, uint32_t size)
return copyFrom(buffer, size, "application/octet-stream");
}
emscripten::val Blob::val()
emscripten::val Blob::val() const
{
return m_blob;
}
@ -583,7 +583,7 @@ std::string File::type() const
return m_file["type"].as<std::string>();
}
emscripten::val File::val()
emscripten::val File::val() const
{
return m_file;
}
@ -642,7 +642,7 @@ void FileReader::onAbort(const std::function<void(emscripten::val)> &onAbort)
m_onAbort = std::make_unique<EventCallback>(m_fileReader, "abort", onAbort);
}
emscripten::val FileReader::val()
emscripten::val FileReader::val() const
{
return m_fileReader;
}
@ -740,7 +740,7 @@ Uint8Array Uint8Array::copyFrom(const QByteArray &buffer)
return copyFrom(buffer.constData(), buffer.size());
}
emscripten::val Uint8Array::val()
emscripten::val Uint8Array::val() const
{
return m_uint8Array;
}

View File

@ -58,7 +58,7 @@ namespace qstdweb {
explicit ArrayBuffer(uint32_t size);
explicit ArrayBuffer(const emscripten::val &arrayBuffer);
uint32_t byteLength() const;
emscripten::val val();
emscripten::val val() const;
private:
friend class Uint8Array;
@ -71,7 +71,7 @@ namespace qstdweb {
uint32_t size() const;
static Blob copyFrom(const char *buffer, uint32_t size, std::string mimeType);
static Blob copyFrom(const char *buffer, uint32_t size);
emscripten::val val();
emscripten::val val() const;
std::string type() const;
private:
@ -91,7 +91,7 @@ namespace qstdweb {
void stream(uint32_t offset, uint32_t length, char *buffer,
std::function<void()> completed) const;
void stream(char *buffer, std::function<void()> completed) const;
emscripten::val val();
emscripten::val val() const;
private:
emscripten::val m_file = emscripten::val::undefined();
@ -119,7 +119,7 @@ namespace qstdweb {
void onLoad(const std::function<void(emscripten::val)> &onLoad);
void onError(const std::function<void(emscripten::val)> &onError);
void onAbort(const std::function<void(emscripten::val)> &onAbort);
emscripten::val val();
emscripten::val val() const;
private:
emscripten::val m_fileReader = emscripten::val::global("FileReader").new_();
@ -147,7 +147,7 @@ namespace qstdweb {
static void copy(char *destination, const Uint8Array &source);
static Uint8Array copyFrom(const char *buffer, uint32_t size);
static Uint8Array copyFrom(const QByteArray &buffer);
emscripten::val val();
emscripten::val val() const;
private:
static emscripten::val heap_();