ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
resource_templates.hpp File Reference
#include "reusex/core/resource_keys.hpp"
#include <nlohmann/json.hpp>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for resource_templates.hpp:

Go to the source code of this file.

Classes

struct  reusex::core::TemplateMember
struct  reusex::core::ResolvedTemplate
struct  reusex::core::SeedTemplate
struct  reusex::core::CsvOptions
 A template's CSV export options (templates.csv). More...
struct  reusex::core::TemplateView
 One template as the API shows it: its row, parsed members and CSV options, and its resolution against the live key catalogue. More...
struct  reusex::core::TemplateInput
 A create or sparse edit; absent fields are left alone. More...

Namespaces

namespace  reusex
namespace  reusex::core
 Wire form of one stored report PDF version — the ReportPdfVersion schema in ruxd's API contract (docs/gui/openapi.yaml, in the ruxd repo).

Enumerations

enum class  reusex::core::MemberKind { reusex::core::category , reusex::core::key }

Functions

std::vector< TemplateMember > reusex::core::parse_members (const nlohmann::json &members)
 Parse [{"category": name} | {"key": id}, …].
std::vector< TemplateMember > reusex::core::read_members (std::string_view stored, std::string_view template_name)
 Stored members, tolerantly: unreadable JSON logs warn and reads as none.
nlohmann::json reusex::core::members_json (const std::vector< TemplateMember > &members)
ResolvedTemplate reusex::core::resolve_template (const std::vector< TemplateMember > &members, const std::vector< ResourceKey > &catalogue)
 Spec §5.2: a category member expands to every catalogue key in that category (catalogue order), a key member adds that key, duplicates keep their first position, and members that resolve to nothing go to missing.
std::vector< SeedTemplate > reusex::core::seed_templates ()
 "Materialepas (fuld)" (one category member per leksikon category) and "Hurtig genbrugsscreening" (the 11 sys: keys), in that order.
CsvOptions reusex::core::parse_csv_options (const nlohmann::json &csv)
CsvOptions reusex::core::read_csv_options (std::string_view stored, std::string_view template_name)
 Stored options, tolerantly: a bad field logs warn and uses its default.
nlohmann::json reusex::core::csv_options_json (const CsvOptions &options)
TemplateMember reusex::core::legacy_column_member (std::string_view column, const std::vector< ResourceKey > &catalogue)
std::string reusex::core::unique_name (std::string_view base, std::string_view tag, const std::vector< std::string > &taken)
 First of "<base> (<tag>)", "<base> (<tag> 2)", "<base> (<tag> 3)", … that is not in taken.
std::vector< TemplateView > reusex::core::template_views (const ProjectDB &db)
 Every template by id. Logs warn once per template with missing members.
TemplateView reusex::core::template_view (const ProjectDB &db, int64_t id)
TemplateView reusex::core::create_template (ProjectDB &db, const TemplateInput &input)
TemplateView reusex::core::update_template (ProjectDB &db, int64_t id, const TemplateInput &input)
void reusex::core::delete_template (ProjectDB &db, int64_t id)
TemplateView reusex::core::duplicate_template (ProjectDB &db, int64_t id)
 Copy as "<name> (kopi)", "<name> (kopi 2)", … (never a seed).
std::vector< TemplateView > reusex::core::restore_seed_templates (ProjectDB &db)
 Insert every seed whose tag no template carries ("Gendan standardskabeloner"); a seed whose name is taken gets " (standard)".

Variables

constexpr std::string_view reusex::core::kSeedMaterialepas = "materialepas"
constexpr std::string_view reusex::core::kSeedScreening = "screening"
constexpr std::string_view reusex::core::kLegacyKeyPrefix = "legacy:"
 Export-template columns (schema v21 config.columns) as members.