OdbDesignLib
OdbDesign ODB++ Parsing Library
 
Loading...
Searching...
No Matches
StandardFontsFile.h
1#pragma once
2
3#include "../OdbFile.h"
4#include "../../odbdesign_export.h"
5#include "../../enums.h"
6#include <vector>
7#include "../../IProtoBuffable.h"
8#include "standardfontsfile.pb.h"
9#include "../IStreamSaveable.h"
10
11namespace Odb::Lib::FileModel::Design
12{
13 class ODBDESIGN_EXPORT StandardFontsFile : public OdbFile, public IProtoBuffable<Odb::Lib::Protobuf::StandardFontsFile>, public IStreamSaveable
14 {
15 public:
16 StandardFontsFile() = default;
18
19 bool Parse(std::filesystem::path path) override;
20 // Inherited via IStreamSaveable
21 bool Save(std::ostream& os) override;
22
23 // Inherited via IProtoBuffable
24 std::unique_ptr<Odb::Lib::Protobuf::StandardFontsFile> to_protobuf() const override;
25 void from_protobuf(const Odb::Lib::Protobuf::StandardFontsFile& message) override;
26
27 struct CharacterBlock : public IProtoBuffable<Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock>
28 {
30
31 struct LineRecord : public IProtoBuffable<Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock::LineRecord>
32 {
33 double xStart;
34 double yStart;
35 double xEnd;
36 double yEnd;
37 Polarity polarity;
38 LineShape shape;
39 double width;
40
41 std::unique_ptr<Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock::LineRecord> to_protobuf() const override;
42 void from_protobuf(const Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock::LineRecord& message) override;
43
44 typedef std::vector<std::shared_ptr<LineRecord>> Vector;
45
46 inline static constexpr const char* RECORD_TOKEN = "LINE";
47 };
48
49 inline static constexpr const char* BEGIN_TOKEN = "CHAR";
50 inline static constexpr const char* END_TOKEN = "ECHAR";
51
52 char character;
53 LineRecord::Vector m_lineRecords;
54
55 std::unique_ptr<Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock> to_protobuf() const override;
56 void from_protobuf(const Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock& message) override;
57
58 typedef std::vector<std::shared_ptr<CharacterBlock>> Vector;
59
60 };
61
62 private:
63 double m_xSize;
64 double m_ySize;
65 double m_offset;
66
67 CharacterBlock::Vector m_characterBlocks;
68 };
69}
70