Line data Source code
1 : #include "Via.h"
2 : #include <memory>
3 : #include "via.pb.h"
4 : #include "enums.pb.h"
5 : #include "../enums.h"
6 : #include <string>
7 : #include "../Text/Utf8Sanitizer.h"
8 :
9 :
10 : namespace Odb::Lib::ProductModel
11 : {
12 0 : Via::Via()
13 0 : : m_name("")
14 0 : , m_side(BoardSide::Top)
15 : {
16 0 : }
17 :
18 0 : std::string Via::GetName() const
19 : {
20 0 : return m_name;
21 : }
22 :
23 0 : BoardSide Via::GetSide() const
24 : {
25 0 : return m_side;
26 : }
27 :
28 0 : std::unique_ptr<Odb::Lib::Protobuf::ProductModel::Via> Via::to_protobuf() const
29 : {
30 0 : auto pViaMsg = std::make_unique<Odb::Lib::Protobuf::ProductModel::Via>();
31 0 : pViaMsg->set_name(Odb::Lib::Text::ToUtf8(m_name));
32 0 : pViaMsg->set_boardside(static_cast<Odb::Lib::Protobuf::BoardSide>(m_side));
33 0 : return pViaMsg;
34 0 : }
35 :
36 0 : void Via::from_protobuf(const Odb::Lib::Protobuf::ProductModel::Via& message)
37 : {
38 0 : m_name = message.name();
39 0 : m_side = static_cast<BoardSide>(message.boardside());
40 0 : }
41 :
42 : } // namespace Odb::Lib::ProductModel
|