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