libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
stringptr.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
3#pragma once
4
5#include "global.h"
6
7namespace libscratchcpp
8{
9
10extern "C"
11{
14 {
15 // NOTE: Constructors and destructors only work in C++ code and are not supposed to be used in LLVM IR
16 StringPtr() = default;
17 StringPtr(const std::string &str);
18 StringPtr(const StringPtr &) = delete;
19
21 {
22 if (data && allocatedSize > 0)
23 free(data);
24 }
25
26 // NOTE: Any changes must also be done in the LLVM code builder!
27 char16_t *data = nullptr;
28 size_t size = 0;
29 size_t allocatedSize = 0;
30 };
31}
32
33} // namespace libscratchcpp
#define LIBSCRATCHCPP_EXPORT
Definition global.h:17
The main namespace of the library.
Definition asset.h:10
StringPtr(const StringPtr &)=delete
char16_t * data
Definition stringptr.h:27
~StringPtr()
Definition stringptr.h:20
size_t size
Definition stringptr.h:28
size_t allocatedSize
Definition stringptr.h:29