summaryrefslogtreecommitdiffstats
path: root/src/libs/client/Serializer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/client/Serializer.cpp')
-rw-r--r--src/libs/client/Serializer.cpp168
1 files changed, 0 insertions, 168 deletions
diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp
index 1374ab12..1b274635 100644
--- a/src/libs/client/Serializer.cpp
+++ b/src/libs/client/Serializer.cpp
@@ -367,174 +367,6 @@ Serializer::serialize_connection(SharedPtr<ConnectionModel> connection) throw (s
*/
}
-#if 0
-/** Load a patch into the engine (e.g. from a patch file).
- *
- * @param base_uri Base URI (e.g. URI of the file to load from).
- *
- * @param data_path Path of the patch relative to base_uri
- * (e.g. relative to file root patch).
- *
- * @param engine_path Path in the engine for the newly created patch
- * (i.e. 'destination' of the load).
- *
- * @param initial_data will be set last, so values passed there will override
- * any values loaded from the patch file (or values in the existing patch).
- *
- * @param merge If true, the loaded patch's contents will be loaded into a
- * currently existing patch. Errors may result if Nodes of conflicting names
- * (etc) exist - the loaded patch will take precendence (ie overwriting
- * existing values). If false and the patch at @a load_path already exists,
- * load is aborted and false is returned.
- *
- * @param poly Polyphony of new loaded patch if given, otherwise polyphony
- * will be loaded (unless saved polyphony isn't found, in which case it's 1).
- *
- * Returns whether or not patch was loaded.
- */
-bool
-Serializer::load_patch(bool merge,
- const string& data_base_uri,
- const Path& data_path,
- MetadataMap engine_data,
- optional<const Path&> engine_parent,
- optional<const string&> engine_name,
- optional<size_t> engine_poly)
-
-{
- cerr << "LOAD: " << data_base_uri << ", " << data_path << ", " << engine_parent << endl;
-#if 0
- cerr << "[Serializer] Loading patch " << filename << "" << endl;
-
- Path path = "/"; // path of the new patch
-
- const bool load_name = (name == "");
- const bool load_poly = (poly == 0);
-
- if (initial_data.find("filename") == initial_data.end())
- initial_data["filename"] = Atom(filename.c_str()); // FIXME: URL?
-
- xmlDocPtr doc = xmlParseFile(filename.c_str());
-
- if (!doc) {
- cerr << "Unable to parse patch file." << endl;
- return "";
- }
-
- xmlNodePtr cur = xmlDocGetRootElement(doc);
-
- if (!cur) {
- cerr << "Empty document." << endl;
- xmlFreeDoc(doc);
- return "";
- }
-
- if (xmlStrcmp(cur->name, (const xmlChar*) "patch")) {
- cerr << "File is not an Ingen patch file (root node != <patch>)" << endl;
- xmlFreeDoc(doc);
- return "";
- }
-
- xmlChar* key = NULL;
- cur = cur->xmlChildrenNode;
-
- // Load Patch attributes
- while (cur != NULL) {
- key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-
- if ((!xmlStrcmp(cur->name, (const xmlChar*)"name"))) {
- if (load_name) {
- assert(key != NULL);
- if (parent_path != "")
- path = Path(parent_path).base() + Path::nameify((char*)key);
- }
- } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"polyphony"))) {
- if (load_poly) {
- poly = atoi((char*)key);
- }
- } else if (xmlStrcmp(cur->name, (const xmlChar*)"connection")
- && xmlStrcmp(cur->name, (const xmlChar*)"node")
- && xmlStrcmp(cur->name, (const xmlChar*)"subpatch")
- && xmlStrcmp(cur->name, (const xmlChar*)"filename")
- && xmlStrcmp(cur->name, (const xmlChar*)"preset")) {
- // Don't know what this tag is, add it as metadata without overwriting
- // (so caller can set arbitrary parameters which will be preserved)
- if (key)
- if (initial_data.find((const char*)cur->name) == initial_data.end())
- initial_data[(const char*)cur->name] = (const char*)key;
- }
-
- xmlFree(key);
- key = NULL; // Avoid a (possible?) double free
-
- cur = cur->next;
- }
-
- if (poly == 0)
- poly = 1;
-
- // Create it, if we're not merging
- if (!existing)
- _engine->create_patch_with_data(path, poly, initial_data);
-
- // Load nodes
- cur = xmlDocGetRootElement(doc)->xmlChildrenNode;
- while (cur != NULL) {
- if ((!xmlStrcmp(cur->name, (const xmlChar*)"node")))
- load_node(path, doc, cur);
-
- cur = cur->next;
- }
-
- // Load subpatches
- cur = xmlDocGetRootElement(doc)->xmlChildrenNode;
- while (cur != NULL) {
- if ((!xmlStrcmp(cur->name, (const xmlChar*)"subpatch"))) {
- load_subpatch(path, doc, cur);
- }
- cur = cur->next;
- }
-
- // Load connections
- cur = xmlDocGetRootElement(doc)->xmlChildrenNode;
- while (cur != NULL) {
- if ((!xmlStrcmp(cur->name, (const xmlChar*)"connection"))) {
- load_connection(path, doc, cur);
- }
- cur = cur->next;
- }
-
-
- // Load presets (control values)
- cerr << "FIXME: load preset\n";
- /*cur = xmlDocGetRootElement(doc)->xmlChildrenNode;
- while (cur != NULL) {
- if ((!xmlStrcmp(cur->name, (const xmlChar*)"preset"))) {
- load_preset(pm, doc, cur);
- assert(preset_model != NULL);
- if (preset_model->name() == "default")
- _engine->set_preset(pm->path(), preset_model);
- }
- cur = cur->next;
- }
- */
-
- xmlFreeDoc(doc);
- xmlCleanupParser();
-
- // Done above.. late enough?
- //_engine->set_metadata_map(path, initial_data);
-
- if (!existing)
- _engine->enable_patch(path);
-
- _load_path_translations.clear();
-
- return path;
-#endif
- return "/FIXME";
-}
-#endif
} // namespace Client
} // namespace Ingen