KiCad PCB EDA Suite
Loading...
Searching...
No Matches
api_utils.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2024 Jon Evans <[email protected]>
5 * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef KICAD_API_UTILS_H
22#define KICAD_API_UTILS_H
23
24#include <optional>
25#include <google/protobuf/any.pb.h>
26
27#include <core/typeinfo.h>
28#include <lib_id.h>
29#include <api/common/types/base_types.pb.h>
30#include <layer_ids.h>
32#include <math/vector2d.h>
33#include <math/vector3.h>
34
36
44extern const KICOMMON_API wxChar* const traceApi;
45
46namespace kiapi::common
47{
48
49KICOMMON_API std::optional<KICAD_T> TypeNameFromAny( const google::protobuf::Any& aMessage );
50
51KICOMMON_API LIB_ID LibIdFromProto( const types::LibraryIdentifier& aId );
52
53KICOMMON_API types::LibraryIdentifier LibIdToProto( const LIB_ID& aId );
54
55KICOMMON_API void PackVector2( types::Vector2& aOutput, const VECTOR2I& aInput );
56
57KICOMMON_API VECTOR2I UnpackVector2( const types::Vector2& aInput );
58
59KICOMMON_API void PackVector3D( types::Vector3D& aOutput, const VECTOR3D& aInput );
60
61KICOMMON_API VECTOR3D UnpackVector3D( const types::Vector3D& aInput );
62
63KICOMMON_API void PackBox2( types::Box2& aOutput, const BOX2I& aInput );
64
65KICOMMON_API BOX2I UnpackBox2( const types::Box2& aInput );
66
67KICOMMON_API void PackPolyLine( types::PolyLine& aOutput, const SHAPE_LINE_CHAIN& aSlc );
68
69KICOMMON_API SHAPE_LINE_CHAIN UnpackPolyLine( const types::PolyLine& aInput );
70
71KICOMMON_API void PackPolySet( types::PolySet& aOutput, const SHAPE_POLY_SET& aInput );
72
73KICOMMON_API SHAPE_POLY_SET UnpackPolySet( const types::PolySet& aInput );
74
75} // namespace kiapi::common
76
77#endif //KICAD_API_UTILS_H
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
const KICOMMON_API wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
Definition: api_utils.cpp:26
#define KICOMMON_API
Definition: kicommon.h:28
KICOMMON_API SHAPE_LINE_CHAIN UnpackPolyLine(const types::PolyLine &aInput)
Definition: api_utils.cpp:147
KICOMMON_API BOX2I UnpackBox2(const types::Box2 &aInput)
Definition: api_utils.cpp:111
KICOMMON_API void PackBox2(types::Box2 &aOutput, const BOX2I &aInput)
Definition: api_utils.cpp:104
KICOMMON_API std::optional< KICAD_T > TypeNameFromAny(const google::protobuf::Any &aMessage)
Definition: api_utils.cpp:32
KICOMMON_API VECTOR3D UnpackVector3D(const types::Vector3D &aInput)
Definition: api_utils.cpp:98
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput)
Definition: api_utils.cpp:84
KICOMMON_API SHAPE_POLY_SET UnpackPolySet(const types::PolySet &aInput)
Definition: api_utils.cpp:196
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput)
Definition: api_utils.cpp:77
KICOMMON_API LIB_ID LibIdFromProto(const types::LibraryIdentifier &aId)
Definition: api_utils.cpp:62
KICOMMON_API types::LibraryIdentifier LibIdToProto(const LIB_ID &aId)
Definition: api_utils.cpp:68
KICOMMON_API void PackPolyLine(types::PolyLine &aOutput, const SHAPE_LINE_CHAIN &aSlc)
Definition: api_utils.cpp:117
KICOMMON_API void PackVector3D(types::Vector3D &aOutput, const VECTOR3D &aInput)
Definition: api_utils.cpp:90
KICOMMON_API void PackPolySet(types::PolySet &aOutput, const SHAPE_POLY_SET &aInput)
Definition: api_utils.cpp:172