Skip to content

Commit 23044db

Browse files
committed
fix #564: Do not use utf8cpp functions in value.h
1 parent 17ba443 commit 23044db

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

include/scratchcpp/value.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <ctgmath>
99
#include <cassert>
1010
#include <iomanip>
11-
#include <utf8.h>
1211
#include <iostream>
1312
#include <clocale>
1413

@@ -370,7 +369,7 @@ class LIBSCRATCHCPP_EXPORT Value
370369
};
371370

372371
/*! Returns the UTF-16 representation of the value. */
373-
std::u16string toUtf16() const { return utf8::utf8to16(toString()); };
372+
std::u16string toUtf16() const;
374373

375374
/*! Adds the given value to the value. */
376375
void add(const Value &v)

src/engine/virtualmachine_p.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <scratchcpp/list.h>
77
#include <iostream>
88
#include <cassert>
9+
#include <utf8.h>
910

1011
#include "virtualmachine_p.h"
1112
#include "internal/randomgenerator.h"

src/scratch/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
target_sources(scratchcpp
22
PRIVATE
3+
value.cpp
34
target.cpp
45
target_p.cpp
56
target_p.h

src/scratch/value.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <scratchcpp/value.h>
2+
#include <utf8.h>
3+
4+
using namespace libscratchcpp;
5+
6+
std::u16string Value::toUtf16() const
7+
{
8+
return utf8::utf8to16(toString());
9+
}

test/scratch_classes/value_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <scratchcpp/value.h>
2+
#include <utf8.h>
23

34
#include "../common.h"
45

0 commit comments

Comments
 (0)