mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
Rename the C++ header files
This commit is contained in:
parent
8781c6e867
commit
fcf59f3793
27 changed files with 84 additions and 88 deletions
72
api/cpp/include/slint_pathdata.h
Normal file
72
api/cpp/include/slint_pathdata.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
// Copyright © SixtyFPS GmbH <info@sixtyfps.io>
|
||||
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
||||
|
||||
#pragma once
|
||||
#include <initializer_list>
|
||||
#include <string_view>
|
||||
#include "slint_pathdata_internal.h"
|
||||
|
||||
// The C++ code generator assumes that enums are in the cbindgen_private namespace
|
||||
namespace slint::cbindgen_private {
|
||||
using cbindgen_private::types::PathEvent;
|
||||
}
|
||||
namespace slint::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::PathQuadraticTo;
|
||||
using cbindgen_private::types::Point;
|
||||
|
||||
struct PathData
|
||||
{
|
||||
public:
|
||||
using Tag = cbindgen_private::types::PathData::Tag;
|
||||
|
||||
PathData() : data(Data::None()) { }
|
||||
PathData(const PathElement *firstElement, size_t count)
|
||||
: data(Data::Elements(elements_from_array(firstElement, count)))
|
||||
{
|
||||
}
|
||||
|
||||
PathData(const PathEvent *firstEvent, size_t event_count, const Point *firstCoordinate,
|
||||
size_t coordinate_count)
|
||||
: data(events_from_array(firstEvent, event_count, firstCoordinate, coordinate_count))
|
||||
{
|
||||
}
|
||||
|
||||
PathData(const SharedString &commands)
|
||||
: data(cbindgen_private::types::PathData::Commands(commands))
|
||||
{
|
||||
}
|
||||
|
||||
friend bool operator==(const PathData &a, const PathData &b) = default;
|
||||
|
||||
private:
|
||||
static SharedVector<PathElement> elements_from_array(const PathElement *firstElement,
|
||||
size_t count)
|
||||
{
|
||||
SharedVector<PathElement> tmp;
|
||||
slint_new_path_elements(&tmp, firstElement, count);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static cbindgen_private::types::PathData events_from_array(const PathEvent *firstEvent,
|
||||
size_t event_count,
|
||||
const Point *firstCoordinate,
|
||||
size_t coordinate_count)
|
||||
{
|
||||
SharedVector<PathEvent> events;
|
||||
SharedVector<Point> coordinates;
|
||||
slint_new_path_events(&events, &coordinates, firstEvent, event_count, firstCoordinate,
|
||||
coordinate_count);
|
||||
return Data::Events(events, coordinates);
|
||||
}
|
||||
|
||||
using Data = cbindgen_private::types::PathData;
|
||||
Data data;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue