void writeCppNs(xml::Element& node, const std::string& ns) { const std::string& realNs = (ns.substr(0, 2) == "::") ? ns.substr(2) : ns; std::string startNs; std::string endNs; std::string::size_type pos = 0; std::string::size_type prevPos = 0; while((pos = realNs.find("::", pos)) != std::string::npos) { startNs += "namespace " + realNs.substr(prevPos, pos - prevPos) + " {\n"; endNs += "}\n"; pos += 2; prevPos = pos; } node.createElement("startCppNs", startNs); node.createElement("endCppNs", endNs); }
void writeParam(xml::Element& elemParams, xml::Element& elemParam, const Param& param) { elemParam.createElement("name", param.name); elemParam.createElement("description", param.description); elemParam.createElement("details", param.details); xml::Element& elemOptions = elemParam.createElement("options"); for (StringMap::const_iterator itOption = param.options.begin(); itOption != param.options.end(); ++itOption) elemOptions.createElement(itOption->first, itOption->second); elemParam.createElement("dataType") << param.dataType; std::string value = elemParams.getValue(); if (!value.empty()) value += ", "; dataTypeToString(value, param.dataType, true); value += " " + param.name; elemParams.setValue(value); }