bool GDBDefinitions::parse(Context &ctx, JSDictionary const *d) { if (auto arch = d->value<JSString>("architecture")) { _architecture = arch->value(); } else { fprintf(stderr, "error: GDB definitions dictionary does not " "specify target GDB architecture\n"); return false; } if (auto feats = d->value<JSArray>("features")) { for (size_t n = 0; n < feats->count(); n++) { auto feat = feats->value<JSDictionary>(n); if (feat == nullptr) { fprintf(stderr, "error: GDB feature definition #%zu " "does not specify a dictionary\n", n); return false; } if (!parseFeature(ctx, n, feat)) return false; } } return true; }
bool parseKML(QDomElement& e, Layer* aLayer) { bool ret= false; QDomElement c = e.firstChildElement(); while(!c.isNull()) { ret = parseFeature(c, aLayer); if (!ret) ret = parseGeometry(c, aLayer); c = c.nextSiblingElement(); } return ret; }
bool parseContainer(QDomElement& e, Layer* aLayer) { if ((e.tagName() != "Document") && (e.tagName() != "Folder")) return false; bool ret= false; QDomElement c = e.firstChildElement(); while(!c.isNull()) { ret = parseFeature(c, aLayer); c = c.nextSiblingElement(); } return ret; }
static void parseFeatureClauses (tokenInfo *const token) { Assert (isKeyword (token, KEYWORD_feature)); do { if (isKeyword (token, KEYWORD_feature)) parseExport (token); if (! isKeyword (token, KEYWORD_feature) && ! isKeyword (token, KEYWORD_invariant) && ! isKeyword (token, KEYWORD_indexing)) { if (! parseFeature (token)) readToken (token); } } while (! isKeyword (token, KEYWORD_end) && ! isKeyword (token, KEYWORD_invariant) && ! isKeyword (token, KEYWORD_indexing)); }
bool Chain::parse (const ssi_char_t *filepath) { release (); if (filepath == 0 || filepath[0] == '\0') { ssi_wrn ("file is empty"); return false; } FilePath fp (filepath); ssi_char_t *filepath_with_ext = 0; if (strcmp (fp.getExtension (), SSI_FILE_TYPE_CHAIN) != 0) { filepath_with_ext = ssi_strcat (filepath, SSI_FILE_TYPE_CHAIN); } else { filepath_with_ext = ssi_strcpy (filepath); } if (!ssi_exists (filepath_with_ext)) { ssi_wrn ("file not found '%s", filepath_with_ext); return false; } ssi_msg (SSI_LOG_LEVEL_BASIC, "load '%s'", filepath_with_ext); TiXmlDocument doc; if (!doc.LoadFile (filepath_with_ext)) { ssi_wrn ("failed loading chain from file '%s'", filepath_with_ext); delete[] filepath_with_ext; return false; } TiXmlElement *body = doc.FirstChildElement(); if (!body || strcmp (body->Value (), "chain") != 0) { ssi_wrn ("tag <chain> missing"); delete[] filepath_with_ext; return false; } TiXmlElement *filter = body->FirstChildElement ("filter"); if (filter) { if (!parseFilter (filter)) { ssi_wrn ("failed parsing <filter> tag"); return false; } } TiXmlElement *feature = body->FirstChildElement ("feature"); if (feature) { if (!parseFeature (feature)) { ssi_wrn ("failed parsing <feature> tag"); return false; } } _parsed = feature || filter; if (!_parsed) { ssi_wrn ("parsing failed because no feature/filter were loaded"); } return _parsed; }