SILICON
Loading...
Searching...
No Matches
projectFile.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <filesystem>
20#include <string>
21#include <string_view>
22#include <vector>
23
25
26namespace SILICON::project {
27
35inline constexpr std::string_view MIME_TYPE = "application/vnd.silicon.project+zip";
36
43inline constexpr int FORMAT_VERSION = 1;
44
60inline const std::string DEFAULT_CIRCUIT_PATH =
62
70 std::string siliconVersion;
72 std::string creationDate;
74 std::string lastModify;
75};
76
82 std::string name;
84 std::string description;
85};
86
99
109[[nodiscard]] ProjectFile readProjectFile(const std::filesystem::path& path);
110
119void writeProjectFile(const std::filesystem::path& path, const ProjectFile& projectFile);
120
124[[nodiscard]] std::string currentUtcTimestamp();
125
129[[nodiscard]] ProjectMetadata metadataForNewFile();
130
131} // namespace SILICON::project
std::string documentPathForSlug(const DocumentType type, const std::string_view slug)
std::string currentUtcTimestamp()
Returns the current UTC timestamp formatted as YYYY-MM-DDTHH\:MM\:SSZ.
constexpr int FORMAT_VERSION
Current version of the Silicon project archive schema.
constexpr std::string_view MIME_TYPE
MIME marker stored in Silicon project archives.
ProjectFile readProjectFile(const std::filesystem::path &path)
Reads and validates a Silicon .sil project archive.
void writeProjectFile(const std::filesystem::path &path, const ProjectFile &projectFile)
Writes a Silicon .sil project archive.
ProjectMetadata metadataForNewFile()
Creates default metadata for a new project file.
const std::string DEFAULT_CIRCUIT_PATH
Default path of the initial circuit JSON file.
In-memory representation of a .sil project archive.
std::vector< Document > documents
Authoritative ordered collection of project documents.
Project-level data stored in project.json.
std::string description
Optional human-readable project description.
std::string name
Human-readable project name.
Metadata stored in metadata.json.
int formatVersion
Project archive schema version.
std::string siliconVersion
Silicon application version that wrote the file.
std::string creationDate
UTC timestamp for the first save, formatted as YYYY-MM-DDTHH\:MM\:SSZ.
std::string lastModify
UTC timestamp for the latest save, formatted as YYYY-MM-DDTHH\:MM\:SSZ.