SILICON
Toggle main menu visibility
Loading...
Searching...
No Matches
document_conversion.hpp
Go to the documentation of this file.
1
/*
2
Copyright (c) 2026. Giulio Cocconi
3
4
This program is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#pragma once
19
20
#include <functional>
21
#include <span>
22
#include <string>
23
#include <string_view>
24
#include <vector>
25
26
#include <
core/projectDocument.hpp
>
27
#include <
core/serialization/document_conversion.hpp
>
28
29
namespace
SILICON::core
{
30
class
ComponentRegistry
;
31
class
CircuitResolver
;
32
}
// namespace SILICON::core
33
34
namespace
SILICON::ui
{
35
36
struct
ConversionResult
{
37
std::vector<SILICON::project::Document>
documents
;
38
std::string
activatePath
;
39
};
40
41
struct
PreparedDocumentConversion
{
42
std::vector<SILICON::conversion::ConversionChoice>
choices
;
43
std::function<
ConversionResult
(std::span<const std::string>)>
execute
;
44
};
45
46
struct
DocumentConverter
{
47
SILICON::project::DocumentType
source
;
48
SILICON::project::DocumentType
target
;
49
bool
available
;
50
std::string_view
unavailableReason
;
51
};
52
53
[[nodiscard]]
const
DocumentConverter
*
54
documentConverterFor
(
SILICON::project::DocumentType
source,
55
SILICON::project::DocumentType
target);
56
57
[[nodiscard]] std::vector<const DocumentConverter*>
58
documentConvertersFor
(
SILICON::project::DocumentType
source);
59
60
[[nodiscard]]
PreparedDocumentConversion
61
prepareDocumentConversion
(
const
SILICON::project::Document
& source,
62
SILICON::project::DocumentType
target,
63
std::span<const SILICON::project::Document> projectDocuments,
64
const
SILICON::core::ComponentRegistry
& registry,
65
const
SILICON::core::CircuitResolver
& resolver);
66
67
}
// namespace SILICON::ui
SILICON::core::CircuitResolver
Definition
circuitDocument.hpp:52
SILICON::core::ComponentRegistry
Definition
component_registry.hpp:35
SILICON::project::Document
Definition
projectDocument.hpp:109
document_conversion.hpp
SILICON::core
Definition
activeKeyGuard.hpp:28
SILICON::project::DocumentType
DocumentType
Definition
projectDocument.hpp:37
SILICON::ui
Definition
actionGroups.hpp:14
SILICON::ui::documentConvertersFor
std::vector< const DocumentConverter * > documentConvertersFor(const DocumentType source)
Definition
document_conversion.cpp:102
SILICON::ui::prepareDocumentConversion
PreparedDocumentConversion prepareDocumentConversion(const Document &source, const DocumentType target, const std::span< const Document > projectDocuments, const SILICON::core::ComponentRegistry ®istry, const SILICON::core::CircuitResolver &resolver)
Definition
document_conversion.cpp:113
SILICON::ui::documentConverterFor
const DocumentConverter * documentConverterFor(const DocumentType source, const DocumentType target)
Definition
document_conversion.cpp:92
projectDocument.hpp
SILICON::ui::ConversionResult
Definition
document_conversion.hpp:36
SILICON::ui::ConversionResult::activatePath
std::string activatePath
Definition
document_conversion.hpp:38
SILICON::ui::ConversionResult::documents
std::vector< SILICON::project::Document > documents
Definition
document_conversion.hpp:37
SILICON::ui::DocumentConverter
Definition
document_conversion.hpp:46
SILICON::ui::DocumentConverter::target
SILICON::project::DocumentType target
Definition
document_conversion.hpp:48
SILICON::ui::DocumentConverter::unavailableReason
std::string_view unavailableReason
Definition
document_conversion.hpp:50
SILICON::ui::DocumentConverter::available
bool available
Definition
document_conversion.hpp:49
SILICON::ui::DocumentConverter::source
SILICON::project::DocumentType source
Definition
document_conversion.hpp:47
SILICON::ui::PreparedDocumentConversion
Definition
document_conversion.hpp:41
SILICON::ui::PreparedDocumentConversion::choices
std::vector< SILICON::conversion::ConversionChoice > choices
Definition
document_conversion.hpp:42
SILICON::ui::PreparedDocumentConversion::execute
std::function< ConversionResult(std::span< const std::string >)> execute
Definition
document_conversion.hpp:43
src
ui
serialization
document_conversion.hpp
Generated by
1.17.0