OdbDesign
OdbDesign ODB++ Parser - C++ library, gRPC/REST server, CLI, tests
 
Loading...
Searching...
No Matches
Part.cpp
Go to the documentation of this file.
1#include "Part.h"
2#include <string>
3#include "part.pb.h"
4#include <memory>
5#include "../Text/Utf8Sanitizer.h"
6
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}
Part(const std::string &name)
Definition Part.cpp:9
void from_protobuf(const Odb::Lib::Protobuf::ProductModel::Part &message) override
Definition Part.cpp:26
std::unique_ptr< Odb::Lib::Protobuf::ProductModel::Part > to_protobuf() const override
Definition Part.cpp:19
std::string GetName() const
Definition Part.cpp:14
std::string ToUtf8(std::string_view input)
Converts input to valid UTF-8.