diff --git a/src/factory/PVDataCreateFactory.cpp b/src/factory/PVDataCreateFactory.cpp index 77a6f79..6826e62 100644 --- a/src/factory/PVDataCreateFactory.cpp +++ b/src/factory/PVDataCreateFactory.cpp @@ -144,8 +144,7 @@ PVString::PVString(ScalarConstPtr const & scalar) std::ostream& PVString::dumpValue(std::ostream& o) const { - // we escape, but do not quote, for scalar string - o<::dumpValue(std::ostream& o) const template<> std::ostream& PVValueArray::dumpValue(std::ostream& o, size_t index) const { - return o << '"' << escape(this->view().at(index)) << '"'; + return o << maybeQuote(this->view().at(index)); } template<> @@ -244,9 +243,9 @@ std::ostream& PVValueArray::dumpValue(std::ostream& o) const end(v.end()); o << '['; if(it!=end) { - o << '"' << escape(*it++) << '"'; + o << maybeQuote(*it++); for(; it!=end; ++it) - o << ", \"" << escape(*it) << '"'; + o << ", " << maybeQuote(*it); } return o << ']'; diff --git a/src/factory/printer.cpp b/src/factory/printer.cpp index 70e81c7..928fc4f 100644 --- a/src/factory/printer.cpp +++ b/src/factory/printer.cpp @@ -171,7 +171,7 @@ bool printEnumT(std::ostream& strm, const PVStructure& top, bool fromtop) if(I>=ch.size()) { strm<<" "; } else { - strm<<' '<getSubFieldT("value.index")->put(1); - testDiff(" (1) a two\n", print(input->stream()), "two"); + testDiff(" (1) \"a two\"\n", print(input->stream()), "two"); testDiff("epics:nt/NTEnum:1.0 \n" - " enum_t value (1) a two\n" + " enum_t value (1) \"a two\"\n" " int index 1\n" - " string[] choices [\"one\", \"a two\"]\n" + " string[] choices [one, \"a two\"]\n" " alarm_t alarm \n" " int severity 0\n" " int status 0\n" @@ -299,7 +299,7 @@ void testRaw() testDiff("omg \n" " string scalar \n" // bit 1 - " string[] scalarArray [\"hello\", \"world\\x7F\"]\n" + " string[] scalarArray [hello, \"world\\x7F\"]\n" " structure below\n" " int A 0\n" // bit 4 " union select\n" @@ -319,7 +319,7 @@ void testRaw() testDiff("omg \n" "\033[1m string scalar \n" - "\033[0m\033[1m string[] scalarArray [\"hello\", \"world\\x7F\"]\n" + "\033[0m\033[1m string[] scalarArray [hello, \"world\\x7F\"]\n" "\033[0m structure below\n" "\033[1m int A 0\n" "\033[0m union select\n" @@ -347,13 +347,20 @@ void testEscape() testEqual("hello\"\"world", std::string(SB()<