3 #include "../../odbdesign_export.h"
5 #include "StepDirectory.h"
8 #include "MiscInfoFile.h"
9 #include "MatrixFile.h"
10 #include "StandardFontsFile.h"
12 #include "../../IProtoBuffable.h"
13 #include "../../ProtoBuf/filearchive.pb.h"
14 #include "SymbolsDirectory.h"
15 #include "AttrListFile.h"
16 #include "../ISaveable.h"
20 namespace Odb::Lib::FileModel::Design
29 std::string GetRootDir()
const;
30 std::string GetProductName()
const;
31 std::string GetFilename()
const;
32 std::string GetFilePath()
const;
34 const StepDirectory::StringMap& GetStepsByName()
const;
35 const SymbolsDirectory::StringMap& GetSymbolsDirectoriesByName()
const;
41 std::shared_ptr<StepDirectory> GetStepDirectory(
const std::string& stepName =
"")
const;
47 bool ParseFileModel();
48 bool SaveFileModel(
const std::filesystem::path& directory);
49 bool SaveFileModel(
const std::filesystem::path& directory,
const std::string& archiveName);
53 std::unique_ptr<Odb::Lib::Protobuf::FileArchive> to_protobuf()
const override;
54 void from_protobuf(
const Odb::Lib::Protobuf::FileArchive& message)
override;
56 typedef std::vector<std::shared_ptr<FileArchive>> Vector;
57 typedef std::map<std::string, std::shared_ptr<FileArchive>> StringMap;
60 std::string m_rootDir;
61 std::string m_productName;
62 std::string m_filename;
63 std::string m_filePath;
70 StepDirectory::StringMap m_stepsByName;
71 SymbolsDirectory::StringMap m_symbolsDirectoriesByName;
73 bool ParseDesignDirectory(
const std::filesystem::path& path);
74 bool ParseStepDirectories(
const std::filesystem::path& path);
75 bool ParseMiscInfoFile(
const std::filesystem::path& path);
76 bool ParseMatrixFile(
const std::filesystem::path& path);
77 bool ParseStandardFontsFile(
const std::filesystem::path& path);
78 bool ParseSymbolsDirectories(
const std::filesystem::path& path);
79 bool ParseMiscAttrListFile(
const std::filesystem::path& path);
81 bool Save(
const std::filesystem::path& directory);
83 bool ExtractDesignArchive(
const std::filesystem::path& path, std::filesystem::path& extractedPath);
85 static std::string findRootDir(
const std::filesystem::path& extractedPath);
86 static bool pathContainsTopLevelDesignDirs(
const std::filesystem::path& path);
88 static inline constexpr
const char* TOPLEVEL_DESIGN_DIR_NAMES[] =