OdbDesignLib
OdbDesign ODB++ Parsing Library
 
Loading...
Searching...
No Matches
Part.cpp
1#include "Part.h"
2#include <string>
3#include "part.pb.h"
4#include <memory>
5#include "../Text/Utf8Sanitizer.h"
6
7namespace Odb::Lib::ProductModel
8{
9 Part::Part(const std::string& name)
10 : m_name(name)
11 {
12 }
13
14 std::string Part::GetName() const
15 {
16 return m_name;
17 }
18
19 std::unique_ptr<Odb::Lib::Protobuf::ProductModel::Part> Odb::Lib::ProductModel::Part::to_protobuf() const
20 {
21 auto pPartMsg = std::make_unique<Odb::Lib::Protobuf::ProductModel::Part>();
22 pPartMsg->set_name(Odb::Lib::Text::ToUtf8(m_name));
23 return pPartMsg;
24 }
25
26 void Odb::Lib::ProductModel::Part::from_protobuf(const Odb::Lib::Protobuf::ProductModel::Part& message)
27 {
28 m_name = message.name();
29 }
30}