Exemple #1
0
int Patch::read(const string &file)
{
  jRoot = json_load_file(file.c_str(), 0, &jError);
  if (!jRoot) {
    gu_log("[Patch::read] unable to read patch file! Error on line %d: %s\n", jError.line, jError.text);
    return PATCH_UNREADABLE;
  }

  if (!checkObject(jRoot, "root element"))
    return PATCH_INVALID;

  init();

  /* TODO json_decref also when PATCH_INVALID */

  if (!readCommons(jRoot))  return setInvalid();
  if (!readColumns(jRoot))  return setInvalid();
  if (!readChannels(jRoot)) return setInvalid();
#ifdef WITH_VST
  if (!readPlugins(jRoot, &masterInPlugins, PATCH_KEY_MASTER_IN_PLUGINS))   return setInvalid();
  if (!readPlugins(jRoot, &masterOutPlugins, PATCH_KEY_MASTER_OUT_PLUGINS)) return setInvalid();
#endif

  json_decref(jRoot);

  sanitize();

  return PATCH_READ_OK;
}
void Fidelity::Engine::SimulationXmlReader::readFSX()
{
	while(!atEnd()) {
		readNext();

		if(isEndElement()) {
			break;
		}

		// Evaluate child tags
		if(isStartElement()) {
			// We expect these children for the root tag
			if (name() == "description") {
				readDescription();
			}
			else if (name() == "globals") {
				readGlobals();
			}
			else if (name() == "engine") {
				readEngine();
			}
			else if (name() == "plugins") {
				readPlugins();
			}
			else if (name() == "setup") {
				readSetup();
			}
			else {
				unknownElement();
			}
		}
	}
}
bool StandardServerCoreBuilder::loadPlugins() {
	
	shared_ptr<ComponentRegistry> component_registry = 
									ComponentRegistry::getSharedRegistry();
	
	readPlugins(pluginPath());
    return true;
}
Exemple #4
0
void XMLRuntime::read(const string& filename, FreeAX25::Runtime::Configuration& config) {
    XercesDOMParser parser;
    parser.setValidationScheme(XercesDOMParser::Val_Always);
    parser.setDoNamespaces(true);
    parser.setDoSchema(true);
    parser.setDoXInclude(true);
    parser.setHandleMultipleImports(true);
    parser.setValidationSchemaFullChecking(true);
    parser.setCreateEntityReferenceNodes(false);
    parser.setIncludeIgnorableWhitespace(false);

    DOMTreeErrorReporter errReporter;
    parser.setErrorHandler(&errReporter);

    parser.parse(filename.c_str());

    if (errReporter.getSawErrors())
    	throw exception();

    // Now read configuration from the DOM Tree:
    XERCES_CPP_NAMESPACE::DOMDocument* doc = parser.getDocument();
    assert(doc != nullptr);

    auto rootElement = doc->getDocumentElement();
    auto configName = rootElement->getAttribute(toX("name"));
    config.setId(fmX(configName));

    { // Get settings:
		auto nodeList = rootElement->getElementsByTagName(toX("Settings"));
		if (nodeList->getLength() > 0)
			readSettings(
					"",
					static_cast<DOMElement*>(nodeList->item(0)),
					config.settings);
    }

    { // Get plugins:
		auto nodeList = rootElement->getElementsByTagName(toX("Plugins"));
		if (nodeList->getLength() > 0)
			readPlugins(
					"",
					static_cast<DOMElement*>(nodeList->item(0)),
					config.plugins);
    }
}