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
35
36namespace kiapi::common
37{
38
39std::optional<KICAD_T> TypeNameFromAny( const google::protobuf::Any& aMessage );
40
41LIB_ID LibIdFromProto( const types::LibraryIdentifier& aId );
42
43types::LibraryIdentifier LibIdToProto( const LIB_ID& aId );
44
45void PackVector2( kiapi::common::types::Vector2& aOutput, const VECTOR2I aInput );
46
47VECTOR2I UnpackVector2( const types::Vector2& aInput );
48
49void PackPolyLine( kiapi::common::types::PolyLine& aOutput, const SHAPE_LINE_CHAIN& aSlc );
50
51SHAPE_LINE_CHAIN UnpackPolyLine( const kiapi::common::types::PolyLine& aInput );
52
53} // namespace kiapi::common
54
55#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...
void PackVector2(kiapi::common::types::Vector2 &aOutput, const VECTOR2I aInput)
Definition: api_utils.cpp:69
std::optional< KICAD_T > TypeNameFromAny(const google::protobuf::Any &aMessage)
Definition: api_utils.cpp:27
types::LibraryIdentifier LibIdToProto(const LIB_ID &aId)
Definition: api_utils.cpp:60
VECTOR2I UnpackVector2(const types::Vector2 &aInput)
Definition: api_utils.cpp:75
void PackPolyLine(kiapi::common::types::PolyLine &aOutput, const SHAPE_LINE_CHAIN &aSlc)
Definition: api_utils.cpp:81
SHAPE_LINE_CHAIN UnpackPolyLine(const kiapi::common::types::PolyLine &aInput)
Definition: api_utils.cpp:111
LIB_ID LibIdFromProto(const types::LibraryIdentifier &aId)
Definition: api_utils.cpp:54