OdbDesignLib
OdbDesign ODB++ Parsing Library
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 "../../ProtoBuf/standardfontsfile.pb.h"
9 
10 namespace Odb::Lib::FileModel::Design
11 {
12  class StandardFontsFile : public OdbFile, public IProtoBuffable<Odb::Lib::Protobuf::StandardFontsFile>
13  {
14  public:
15  StandardFontsFile() = default;
17 
18  bool Parse(std::filesystem::path path) override;
19 
20  // Inherited via IProtoBuffable
21  std::unique_ptr<Odb::Lib::Protobuf::StandardFontsFile> to_protobuf() const override;
22  void from_protobuf(const Odb::Lib::Protobuf::StandardFontsFile& message) override;
23 
24  struct CharacterBlock : public IProtoBuffable<Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock>
25  {
26  ~CharacterBlock();
27 
28  struct LineRecord : public IProtoBuffable<Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock::LineRecord>
29  {
30  float xStart;
31  float yStart;
32  float xEnd;
33  float yEnd;
34  Polarity polarity;
35  LineShape shape;
36  float width;
37 
38  std::unique_ptr<Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock::LineRecord> to_protobuf() const override;
39  void from_protobuf(const Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock::LineRecord& message) override;
40 
41  typedef std::vector<std::shared_ptr<LineRecord>> Vector;
42 
43  inline static constexpr const char* RECORD_TOKEN = "LINE";
44  };
45 
46  inline static constexpr const char* BEGIN_TOKEN = "CHAR";
47  inline static constexpr const char* END_TOKEN = "ECHAR";
48 
49  char character;
50  LineRecord::Vector m_lineRecords;
51 
52  std::unique_ptr<Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock> to_protobuf() const override;
53  void from_protobuf(const Odb::Lib::Protobuf::StandardFontsFile::CharacterBlock& message) override;
54 
55  typedef std::vector<std::shared_ptr<CharacterBlock>> Vector;
56 
57  };
58 
59  private:
60  float m_xSize;
61  float m_ySize;
62  float m_offset;
63 
64  CharacterBlock::Vector m_characterBlocks;
65  };
66 }