equal
deleted
inserted
replaced
45 |
45 |
46 std::string escape(const relpipe::common::type::StringX& value) { |
46 std::string escape(const relpipe::common::type::StringX& value) { |
47 std::stringstream result; |
47 std::stringstream result; |
48 result.put(Q); |
48 result.put(Q); |
49 for (char ch : convertor.to_bytes(value)) { |
49 for (char ch : convertor.to_bytes(value)) { |
50 if (ch == Q) result.put(ESC).put(ch); |
50 if (ch == ESC) result.put(ESC).put(ch); |
|
51 else if (ch == Q) result.put(ESC).put(ch); |
|
52 else if (ch == '\n') result.put(ESC).put('n'); |
|
53 else if (ch == '\r') result.put(ESC).put('r'); |
51 else result.put(ch); |
54 else result.put(ch); |
52 } |
55 } |
53 result.put(Q); |
56 result.put(Q); |
54 return result.str(); |
57 return result.str(); |
55 } |
58 } |
87 } else { |
90 } else { |
88 output << indent(2) << " "; |
91 output << indent(2) << " "; |
89 } |
92 } |
90 |
93 |
91 output << escape(currentAttributes[currentAttributeIndex].getAttributeName()) << ": "; |
94 output << escape(currentAttributes[currentAttributeIndex].getAttributeName()) << ": "; |
92 output << escape(value) << std::endl; |
95 |
|
96 if (currentAttributes[currentAttributeIndex].getTypeId() == relpipe::reader::TypeId::INTEGER) output << convertor.to_bytes(value) << std::endl; |
|
97 else if (currentAttributes[currentAttributeIndex].getTypeId() == relpipe::reader::TypeId::BOOLEAN) output << convertor.to_bytes(value) << std::endl; |
|
98 else output << escape(value) << std::endl; |
93 |
99 |
94 currentAttributeIndex++; |
100 currentAttributeIndex++; |
95 } |
101 } |
96 |
102 |
97 void endOfPipe() { |
103 void endOfPipe() { |