SILICON
Toggle main menu visibility
Loading...
Searching...
No Matches
codeFilePresentation.cpp
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
#include "
codeFilePresentation.hpp
"
19
20
#include <array>
21
#include <ranges>
22
#include <stdexcept>
23
24
namespace
SILICON::ui
{
25
namespace
{
26
27
constexpr
std::array PRESENTATIONS{
28
CodeFilePresentation
{.type =
project::DocumentType::Verilog
,
29
.displayName =
"Verilog"
,
30
.syntax = &
VERILOG_CODE_SYNTAX
,
31
.architectureTabName =
nullptr
},
32
CodeFilePresentation
{.type =
project::DocumentType::Sisl
,
33
.displayName =
"SISL"
,
34
.syntax = &
SISL_CODE_SYNTAX
,
35
.architectureTabName =
"Instruction format"
}};
36
37
}
// namespace
38
39
std::span<const CodeFilePresentation>
codeFilePresentations
()
40
{
41
return
PRESENTATIONS;
42
}
43
44
const
CodeFilePresentation
&
codeFilePresentation
(
const
project::DocumentType
type)
45
{
46
const
auto
it = std::ranges::find(PRESENTATIONS, type, &
CodeFilePresentation::type
);
47
if
(it == PRESENTATIONS.end())
48
throw
std::invalid_argument(
"Unknown code-file presentation"
);
49
return
*it;
50
}
51
52
}
// namespace SILICON::ui
codeFilePresentation.hpp
SILICON::project::DocumentType
DocumentType
Definition
projectDocument.hpp:37
SILICON::project::DocumentType::Sisl
@ Sisl
Definition
projectDocument.hpp:37
SILICON::project::DocumentType::Verilog
@ Verilog
Definition
projectDocument.hpp:37
SILICON::ui
Definition
actionGroups.hpp:14
SILICON::ui::codeFilePresentation
const CodeFilePresentation & codeFilePresentation(const project::DocumentType type)
Definition
codeFilePresentation.cpp:44
SILICON::ui::codeFilePresentations
std::span< const CodeFilePresentation > codeFilePresentations()
Definition
codeFilePresentation.cpp:39
SILICON::ui::SISL_CODE_SYNTAX
const CodeSyntax SISL_CODE_SYNTAX
Definition
sisl.cpp:101
SILICON::ui::VERILOG_CODE_SYNTAX
const CodeSyntax VERILOG_CODE_SYNTAX
Definition
verilog.cpp:437
SILICON::ui::CodeFilePresentation
Definition
codeFilePresentation.hpp:29
SILICON::ui::CodeFilePresentation::type
SILICON::project::DocumentType type
Definition
codeFilePresentation.hpp:30
src
ui
documents
code
codeFilePresentation.cpp
Generated by
1.17.0