KiCad PCB EDA Suite
Loading...
Searching...
No Matches
library_table_parser.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 The KiCad Developers, see AUTHORS.txt for contributors.
5
* @author Jon Evans <
[email protected]
>
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 LIBRARY_TABLE_PARSER_H
22
#define LIBRARY_TABLE_PARSER_H
23
24
#include <filesystem>
25
#include <optional>
26
#include <string>
27
#include <vector>
28
29
#include <tl/expected.hpp>
30
#include <wx/wx.h>
31
#include <
libraries/library_table.h
>
32
33
struct
LIBRARY_TABLE_ROW_IR
34
{
35
std::string
nickname
;
36
std::string
uri
;
37
std::string
type
;
38
std::string
options
;
39
std::string
description
;
40
bool
disabled
=
false
;
41
bool
hidden
=
false
;
42
};
43
47
struct
LIBRARY_TABLE_IR
48
{
49
std::string
version
;
50
LIBRARY_TABLE_TYPE
type
;
51
std::vector<LIBRARY_TABLE_ROW_IR>
rows
;
52
};
53
54
struct
LIBRARY_PARSE_ERROR
55
{
56
wxString
description
;
57
size_t
line
= 0;
58
size_t
column
= 0;
59
};
60
61
class
KICOMMON_API
LIBRARY_TABLE_PARSER
62
{
63
public
:
64
LIBRARY_TABLE_PARSER
();
65
66
tl::expected<LIBRARY_TABLE_IR, LIBRARY_PARSE_ERROR>
Parse
(
const
std::filesystem::path& aPath );
67
68
tl::expected<LIBRARY_TABLE_IR, LIBRARY_PARSE_ERROR>
ParseBuffer
(
const
std::string& aBuffer );
69
70
private
:
71
72
};
73
74
#endif
//LIBRARY_TABLE_PARSER_H
LIBRARY_TABLE_PARSER::ParseBuffer
tl::expected< LIBRARY_TABLE_IR, LIBRARY_PARSE_ERROR > ParseBuffer(const std::string &aBuffer)
Definition
library_table_parser.cpp:209
LIBRARY_TABLE_PARSER::LIBRARY_TABLE_PARSER
LIBRARY_TABLE_PARSER()
Definition
library_table_parser.cpp:151
LIBRARY_TABLE_PARSER::Parse
tl::expected< LIBRARY_TABLE_IR, LIBRARY_PARSE_ERROR > Parse(const std::filesystem::path &aPath)
Definition
library_table_parser.cpp:156
KICOMMON_API
#define KICOMMON_API
Definition
kicommon.h:28
library_table.h
LIBRARY_TABLE_TYPE
LIBRARY_TABLE_TYPE
Definition
library_table.h:33
LIBRARY_PARSE_ERROR
Definition
library_table_parser.h:55
LIBRARY_PARSE_ERROR::description
wxString description
Definition
library_table_parser.h:56
LIBRARY_PARSE_ERROR::column
size_t column
Definition
library_table_parser.h:58
LIBRARY_PARSE_ERROR::line
size_t line
Definition
library_table_parser.h:57
LIBRARY_TABLE_IR
The intermediate representation that a library table is parsed into.
Definition
library_table_parser.h:48
LIBRARY_TABLE_IR::version
std::string version
Definition
library_table_parser.h:49
LIBRARY_TABLE_IR::rows
std::vector< LIBRARY_TABLE_ROW_IR > rows
Definition
library_table_parser.h:51
LIBRARY_TABLE_IR::type
LIBRARY_TABLE_TYPE type
Definition
library_table_parser.h:50
LIBRARY_TABLE_ROW_IR
Definition
library_table_parser.h:34
LIBRARY_TABLE_ROW_IR::hidden
bool hidden
Definition
library_table_parser.h:41
LIBRARY_TABLE_ROW_IR::nickname
std::string nickname
Definition
library_table_parser.h:35
LIBRARY_TABLE_ROW_IR::options
std::string options
Definition
library_table_parser.h:38
LIBRARY_TABLE_ROW_IR::uri
std::string uri
Definition
library_table_parser.h:36
LIBRARY_TABLE_ROW_IR::type
std::string type
Definition
library_table_parser.h:37
LIBRARY_TABLE_ROW_IR::description
std::string description
Definition
library_table_parser.h:39
LIBRARY_TABLE_ROW_IR::disabled
bool disabled
Definition
library_table_parser.h:40
src
include
libraries
library_table_parser.h
Generated on Sat Oct 18 2025 00:06:31 for KiCad PCB EDA Suite by
1.13.2