ConfigWizard refactoring

This commit is contained in:
Vojtech Kral 2019-01-30 15:22:17 +01:00
parent f0cee79170
commit b0f54e5709
9 changed files with 1065 additions and 818 deletions

View file

@ -54,13 +54,16 @@ public:
std::string id;
std::string name;
PrinterTechnology technology;
std::string family;
std::vector<PrinterVariant> variants;
PrinterVariant* variant(const std::string &name) {
for (auto &v : this->variants)
if (v.name == name)
return &v;
return nullptr;
}
const PrinterVariant* variant(const std::string &name) const { return const_cast<PrinterModel*>(this)->variant(name); }
};
std::vector<PrinterModel> models;
@ -72,6 +75,7 @@ public:
static VendorProfile from_ini(const boost::property_tree::ptree &tree, const boost::filesystem::path &path, bool load_all=true);
size_t num_variants() const { size_t n = 0; for (auto &model : models) n += model.variants.size(); return n; }
std::vector<std::string> families() const;
bool operator< (const VendorProfile &rhs) const { return this->id < rhs.id; }
bool operator==(const VendorProfile &rhs) const { return this->id == rhs.id; }