KiCad PCB EDA Suite
Loading...
Searching...
No Matches
api_handler_footprint.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) 2026 Benjamin Chung ([email protected])
5 * Copyright The 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_HANDLER_FOOTPRINT_H
22#define KICAD_API_HANDLER_FOOTPRINT_H
23
26#include <api/common/commands/project_commands.pb.h>
27
28
29class FOOTPRINT;
31
32
34{
35public:
37 API_HANDLER_FOOTPRINT( std::shared_ptr<FOOTPRINT_CONTEXT> aContext,
38 FOOTPRINT_EDIT_FRAME* aFrame = nullptr );
39
40private:
42
45
47
50
53
56
57protected:
58 kiapi::common::types::DocumentType thisDocumentType() const override
59 {
60 return kiapi::common::types::DOCTYPE_FOOTPRINT;
61 }
62
63 tl::expected<bool, ApiResponseStatus> validateDocumentInternal( const DocumentSpecifier& aDocument ) const override;
64
66
67private:
69 {
70 return static_cast<FOOTPRINT_CONTEXT*>( context() );
71 }
72
74
75 HANDLER_RESULT<FOOTPRINT*> validateAndGetFootprint( const DocumentSpecifier& aDocument );
76};
77
78
79#endif //KICAD_API_HANDLER_FOOTPRINT_H
tl::expected< T, ApiResponseStatus > HANDLER_RESULT
Definition api_handler.h:45
API_HANDLER_BOARD(std::shared_ptr< BOARD_CONTEXT > aContext, EDA_BASE_FRAME *aFrame=nullptr)
BOARD_CONTEXT * context() const
HANDLER_RESULT< commands::GetItemsResponse > handleGetItems(const HANDLER_CONTEXT< commands::GetItems > &aCtx)
FOOTPRINT_EDIT_FRAME * frame() const
HANDLER_RESULT< commands::GetOpenDocumentsResponse > handleGetOpenDocuments(const HANDLER_CONTEXT< commands::GetOpenDocuments > &aCtx)
FOOTPRINT_CONTEXT * footprintContext() const
BOARD_ITEM_CONTAINER * getDefaultContainer() override
kiapi::common::types::DocumentType thisDocumentType() const override
Override this to specify which document type this editor handles.
tl::expected< bool, ApiResponseStatus > validateDocumentInternal(const DocumentSpecifier &aDocument) const override
HANDLER_RESULT< Empty > handleOpenLibraryItem(const HANDLER_CONTEXT< commands::OpenLibraryItem > &aCtx)
API_HANDLER_FOOTPRINT(FOOTPRINT_EDIT_FRAME *aFrame)
HANDLER_RESULT< Empty > handleSaveDocument(const HANDLER_CONTEXT< commands::SaveDocument > &aCtx)
HANDLER_RESULT< FOOTPRINT * > validateAndGetFootprint(const DocumentSpecifier &aDocument)
HANDLER_RESULT< Empty > handleRevertDocument(const HANDLER_CONTEXT< commands::RevertDocument > &aCtx)
HANDLER_RESULT< Empty > handleSaveCopyOfDocument(const HANDLER_CONTEXT< commands::SaveCopyOfDocument > &aCtx)
Abstract interface for BOARD_ITEMs capable of storing other items inside.