}
}
-void ConfigWriter::EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val, const Array::Ptr& imports)
+void ConfigWriter::EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val,
+ const Array::Ptr& imports, bool splitDot)
{
fp << "{";
BOOST_FOREACH(const Dictionary::Pair& kv, val) {
fp << "\n";
EmitIndent(fp, indentLevel);
-
- std::vector<String> tokens;
- boost::algorithm::split(tokens, kv.first, boost::is_any_of("."));
-
- EmitIdentifier(fp, tokens[0], true);
-
- for (std::vector<String>::size_type i = 1; i < tokens.size(); i++) {
- fp << "[";
- EmitString(fp, tokens[i]);
- fp << "]";
- }
-
+
+ if (splitDot) {
+ std::vector<String> tokens;
+ boost::algorithm::split(tokens, kv.first, boost::is_any_of("."));
+
+ EmitIdentifier(fp, tokens[0], true);
+
+ for (std::vector<String>::size_type i = 1; i < tokens.size(); i++) {
+ fp << "[";
+ EmitString(fp, tokens[i]);
+ fp << "]";
+ }
+ } else
+ EmitIdentifier(fp, kv.first, true);
+
fp << " = ";
EmitValue(fp, indentLevel + 1, kv.second);
}
fp << " ignore_on_error";
fp << " ";
- EmitScope(fp, 1, attrs, imports);
+ EmitScope(fp, 1, attrs, imports, true);
}
void ConfigWriter::EmitComment(std::ostream& fp, const String& text)
static void EmitEmpty(std::ostream& fp);
static void EmitArray(std::ostream& fp, int indentLevel, const Array::Ptr& val);
static void EmitArrayItems(std::ostream& fp, int indentLevel, const Array::Ptr& val);
- static void EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val, const Array::Ptr& imports = Array::Ptr());
+ static void EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val,
+ const Array::Ptr& imports = Array::Ptr(), bool splitDot = false);
static void EmitValue(std::ostream& fp, int indentLevel, const Value& val);
static void EmitRaw(std::ostream& fp, const String& val);
static void EmitIndent(std::ostream& fp, int indentLevel);