OdbDesignLib
OdbDesign ODB++ Parsing Library
SymbolsDirectory.h
1 #pragma once
2 
3 #include "../../odbdesign_export.h"
4 #include "FeaturesFile.h"
5 #include "AttrListFile.h"
6 #include <vector>
7 #include <map>
8 #include <string>
9 #include <memory>
10 #include <filesystem>
11 #include "../../IProtoBuffable.h"
12 #include "../../ProtoBuf/symbolsdirectory.pb.h"
13 #include "../ISaveable.h"
14 
15 namespace Odb::Lib::FileModel::Design
16 {
17  class ODBDESIGN_EXPORT SymbolsDirectory : public IProtoBuffable<Odb::Lib::Protobuf::SymbolsDirectory>, public ISaveable
18  {
19  public:
20  SymbolsDirectory(const std::filesystem::path& path);
21 
22  typedef std::vector<std::shared_ptr<SymbolsDirectory>> Vector;
23  typedef std::map<std::string, std::shared_ptr<SymbolsDirectory>> StringMap;
24 
25  bool Parse();
26  // Inherited via ISaveable
27  bool Save(const std::filesystem::path& directory) override;
28 
29  std::string GetName() const;
30  std::filesystem::path GetPath() const;
31 
32  const FeaturesFile& GetFeaturesFile() const;
33  const AttrListFile& GetAttrListFile() const;
34 
35  // Inherited via IProtoBuffable
36  std::unique_ptr<Odb::Lib::Protobuf::SymbolsDirectory> to_protobuf() const override;
37  void from_protobuf(const Odb::Lib::Protobuf::SymbolsDirectory& message) override;
38 
39  private:
40  std::string m_name;
41  std::filesystem::path m_path;
42 
43  FeaturesFile m_featuresFile;
44  AttrListFile m_attrListFile;
45 
46  bool ParseFeaturesFile(const std::filesystem::path& directory);
47  bool ParseAttrListFile(const std::filesystem::path& directory);
48 
49  };
50 }