#pragma once #ifndef QWFASSOC_MANIFEST_H_ #define QWFASSOC_MANIFEST_H_ #include #include #include #include namespace qwfassoc { // Description of a single extension declared in the manifest. // // For a given extension (e.g. "jpg"), the manifest references one entry from // each of the `strs`, `icons` and `behaviors` tables by its token name. struct ManifestExt { std::string name; std::string icon; std::string behavior; }; // In-memory representation of a wfassoc manifest TOML file. // // This struct mirrors the Rust `Manifest` type defined in // `wfassoc-exec/src/manifest.rs`. All validation that requires the wfassoc // library itself (identifier regex, dangling references, etc.) is deferred to // `wfassocpp::Program` construction; this struct only performs TOML parsing. struct Manifest { std::string identifier; std::string path; std::string clsid; std::optional name; std::optional icon; std::optional behavior; std::map strs; std::map icons; std::map behaviors; std::map exts; // Parse a manifest TOML file from disk. // Throws std::runtime_error on any IO or TOML syntax error. static Manifest fromFile(const std::string& path); // Build a wfassocpp::Schema from this manifest. // Throws std::runtime_error (originating from wfassocpp::_Check) when the // wfassoc library rejects an operation, e.g. on duplicate keys. wfassocpp::Schema toSchema() const; }; } // namespace qwfassoc #endif // QWFASSOC_MANIFEST_H_