示例#1
0
std::string
XmlConfig::asString(const std::string &key) const {

	std::string res;
	
	XmlXPathContextHelper xctx(xmlXPathNewContext(doc_.get()));
	XmlUtils::throwUnless(nullptr != xctx.get());

	XmlXPathObjectHelper object(xmlXPathEvalExpression((const xmlChar*) key.c_str(), xctx.get()));
	XmlUtils::throwUnless(nullptr != object.get());
		
	if (nullptr != object->nodesetval && 0 != object->nodesetval->nodeNr) {
			
		xmlNodeSetPtr ns = object->nodesetval;
		XmlUtils::throwUnless(nullptr != ns->nodeTab[0]);
		const char *val = XmlUtils::value(ns->nodeTab[0]);
		if (nullptr != val) {
			res.assign(val);
		}
	} else {
		std::stringstream stream;
		stream << "nonexistent config param: " << key;
		throw std::runtime_error(stream.str());
	}
	resolveVariables(res);
	return res;
}
示例#2
0
QStringList QMakeFileVisitor::getValueList(const QList<QMake::ValueAST*>& list) const
{
    QStringList result;
    foreach (QMake::ValueAST* v, list) {
        result += resolveVariables(v->value);
    }