C++: Hide sixtyfps::PathData from the public API

This commit is contained in:
Simon Hausmann 2021-06-21 14:26:52 +02:00 committed by Simon Hausmann
parent 51bc21c9a5
commit fe59fb3ec3
2 changed files with 18 additions and 20 deletions

View file

@ -12,14 +12,14 @@ LICENSE END */
#include <string_view>
#include "sixtyfps_pathdata_internal.h"
namespace sixtyfps {
namespace sixtyfps::private_api {
using cbindgen_private::types::PathArcTo;
using cbindgen_private::types::PathCubicTo;
using cbindgen_private::types::PathElement;
using cbindgen_private::types::PathEvent;
using cbindgen_private::types::PathLineTo;
using cbindgen_private::types::PathMoveTo;
using cbindgen_private::types::PathCubicTo;
using cbindgen_private::types::PathQuadraticTo;
using cbindgen_private::types::Point;
@ -40,7 +40,8 @@ public:
{
}
friend bool operator==(const PathData &a, const PathData &b) {
friend bool operator==(const PathData &a, const PathData &b)
{
if (a.data.tag != b.data.tag)
return false;
switch (a.data.tag) {
@ -53,10 +54,7 @@ public:
}
return false; // unreachable
}
friend bool operator!=(const PathData &a, const PathData &b) {
return !(a == b);
}
friend bool operator!=(const PathData &a, const PathData &b) { return !(a == b); }
private:
static SharedVector<PathElement> elements_from_array(const PathElement *firstElement,

View file

@ -2068,7 +2068,7 @@ fn compile_path(path: &crate::expression_tree::Path, component: &Rc<Component>)
sixtyfps::PathElement elements[{}] = {{
{}
}};
return sixtyfps::PathData(&elements[0], std::size(elements));
return sixtyfps::private_api::PathData(&elements[0], std::size(elements));
}}()"#,
converted_elements.len(),
converted_elements.join(",")
@ -2084,7 +2084,7 @@ fn compile_path(path: &crate::expression_tree::Path, component: &Rc<Component>)
sixtyfps::Point coordinates[{}] = {{
{}
}};
return sixtyfps::PathData(&events[0], std::size(events), &coordinates[0], std::size(coordinates));
return sixtyfps::private_api::PathData(&events[0], std::size(events), &coordinates[0], std::size(coordinates));
}}()"#,
converted_events.len(),
converted_events.join(","),