1 #include "SymbolName.h"
2 #include "SymbolName.h"
4 namespace Odb::Lib::FileModel::Design
12 SymbolName::SymbolName()
14 , m_unitType(UnitType::None)
18 std::string SymbolName::GetName()
const
23 UnitType SymbolName::GetUnitType()
const
28 bool SymbolName::Parse(
const std::filesystem::path& path,
const std::string& line,
int lineNumber)
30 std::stringstream lineStream(line);
34 if (!std::getline(lineStream, token,
' '))
36 throw_parse_error(path, line, token, lineNumber);
39 if (std::getline(lineStream, token,
' '))
45 throw_parse_error(path, line, token, lineNumber);
48 if (std::getline(lineStream, token,
' '))
53 m_unitType = UnitType::Metric;
56 m_unitType = UnitType::Imperial;
64 std::unique_ptr<Odb::Lib::Protobuf::SymbolName> SymbolName::to_protobuf()
const
66 auto message = std::make_unique<Odb::Lib::Protobuf::SymbolName>();
67 message->set_name(m_name);
68 message->set_unittype(
static_cast<Odb::Lib::Protobuf::UnitType
>(m_unitType));
72 void SymbolName::from_protobuf(
const Odb::Lib::Protobuf::SymbolName& message)
74 m_name = message.name();
75 m_unitType =
static_cast<UnitType
>(message.unittype());