OdbDesignLib
OdbDesign ODB++ Parsing Library
MiscInfoFile.h
1 //
2 // Created by nmill on 10/13/2023.
3 //
4 
5 #include "../OdbFile.h"
6 #include <chrono>
7 #include "../../IProtoBuffable.h"
8 #include "../../ProtoBuf/miscinfofile.pb.h"
9 
10 #pragma once
11 
12 namespace Odb::Lib::FileModel::Design
13 {
14 
15  class MiscInfoFile : public OdbFile, public IProtoBuffable<Odb::Lib::Protobuf::MiscInfoFile>
16  {
17  public:
18  MiscInfoFile();
19  ~MiscInfoFile() = default;
20 
21  std::string GetProductModelName() const;
22  std::string GetJobName() const;
23  std::string GetOdbVersionMajor() const;
24  std::string GetOdbVersionMinor() const;
25  std::string GetOdbSource() const;
26  std::chrono::system_clock::time_point GetCreationDate() const;
27  std::chrono::system_clock::time_point GetSaveDate() const;
28  std::string GetSaveApp() const;
29  std::string GetSaveUser() const;
30  std::string GetUnits() const;
31  unsigned int GetMaxUniqueId() const;
32 
33  bool Parse(std::filesystem::path path) override;
34 
35  // Inherited via IProtoBuffable
36  std::unique_ptr<Odb::Lib::Protobuf::MiscInfoFile> to_protobuf() const override;
37  void from_protobuf(const Odb::Lib::Protobuf::MiscInfoFile& message) override;
38 
39  private:
40  std::string m_productModelName;
41  std::string m_jobName;
42  std::string m_odbVersionMajor;
43  std::string m_odbVersionMinor;
44  std::string m_odbSource;
45  std::chrono::system_clock::time_point m_creationDateDate; // "20161024.101454"
46  std::chrono::system_clock::time_point m_saveDate; // "20170810.132829"
47  std::string m_saveApp;
48  std::string m_saveUser;
49  std::string m_units;
50  unsigned int m_maxUniqueId;
51 
52  static inline bool attributeValueIsOptional(const std::string& attribute);
53 
54  constexpr inline static const char* OPTIONAL_ATTRIBUTES[] =
55  {
56  //"ODB_SOURCE", // not optional per spec pg. 80
57  "MAX_UID",
58  };
59  };
60 }