21#include "rawspeedconfig.h"
39using pugi::xml_document;
41using pugi::xml_parse_result;
50 if (xml_parse_result result =
51#
if defined(__unix__) || defined(__APPLE__)
52 doc.load_file(docname)
54 doc.load_file(pugi::as_wide(docname).c_str())
58 ThrowCME(
"XML Document \"%s\" could not be parsed successfully. Error was: "
60 docname, result.description(),
61 doc.child(
"node").attribute(
"attr").value());
64 for (xml_node camera : doc.child(
"Cameras").children(
"Camera")) {
65 const auto* cam =
addCamera(std::make_unique<Camera>(camera));
71 for (
auto i = 0UL; i < cam->aliases.size(); i++) {
72 addCamera(std::make_unique<Camera>(cam, i));
81 const std::string& mode) {
93 const std::string& model,
94 const std::string& mode)
const {
95 auto camera =
cameras.find(getId(make, model, mode));
96 return camera ==
cameras.end() ? nullptr : camera->second.get();
100 const std::string& model)
const {
101 auto id = getId(make, model,
"");
105 const auto& cid = i.first;
106 return tie(id.make, id.model) == tie(cid.make, cid.model);
112 return iter->second.get();
116 const std::string& model,
117 const std::string& mode)
const {
121const Camera* RAWSPEED_READONLY
124 return camera ==
chdkCameras.end() ? nullptr : camera->second;
132 auto id = getId(cam->make, cam->model, cam->mode);
136 "CameraMetaData: Duplicate entry found for camera: %s %s, Skipping!",
137 cam->make.c_str(), cam->model.c_str());
142 if (std::string::npos !=
cameras[
id]->mode.find(
"chdk")) {
143 auto filesize_hint =
cameras[id]->hints.get(
"filesize", std::string());
144 if (filesize_hint.empty()) {
146 "CameraMetaData: CHDK camera: %s %s, no \"filesize\" hint set!",
158 for (
const auto& [
id, cam] :
cameras) {
159 if (cam->make == make)
165 std::string_view model)
const {
166 for (
const auto& [
id, cam] :
cameras) {
167 if (cam->make == make && cam->model == model)
std::string trimSpaces(std::string_view str)
void writeLog(DEBUG_PRIO priority, const char *format,...)