File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ target_sources(scratchcpp
3838 include /scratchcpp/value .h
3939 include /scratchcpp/valuedata.h
4040 include /scratchcpp/value_functions.h
41+ include /scratchcpp/stringptr.h
4142 include /scratchcpp/entity.h
4243 include /scratchcpp/variable .h
4344 include /scratchcpp/list.h
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: Apache-2.0
2+
3+ #pragma once
4+
5+ #include " global.h"
6+
7+ namespace libscratchcpp
8+ {
9+
10+ extern " C"
11+ {
12+ /* ! \brief The StringPtr struct holds a string data pointer and string size */
13+ struct LIBSCRATCHCPP_EXPORT StringPtr
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 StringPtr &) = delete ;
18+
19+ ~StringPtr ()
20+ {
21+ if (data && allocatedSize > 0 )
22+ free (data);
23+ }
24+
25+ // NOTE: Any changes must also be done in the LLVM code builder!
26+ char16_t *data = nullptr ;
27+ size_t size = 0 ;
28+ size_t allocatedSize = 0 ;
29+ };
30+ }
31+
32+ } // namespace libscratchcpp
You can’t perform that action at this time.
0 commit comments