Re: Review: Misc Yaml Updates

Malcolm Humphreys <malcolmh...@...>

Looking at this quickly it would be a pretty small patch to add out << YAML::NewLines(3);

Something along the lines of:

struct _NewLines {
_NewLines(int value_): value(value_) {}
int value;

inline _NewLines NewLines(int value) {
return _NewLines(value);

-- emitter.h --
Emitter& Write(const _NewLines& lines);
inline Emitter& operator << (Emitter& emitter, const _NewLines& v) { return emitter.Write(v); }
-- emitter.h --

-- emmiter.cpp --
Emitter& Emitter::Write(const _NewLines& lines)
return *this;
for(unsigned int i=0; i< lines.value; ++i)
m_stream << "\n";
return *this;
-- emmiter.cpp --


On 21/10/2010, at 11:24 AM, Malcolm Humphreys wrote:

This looks all pretty good to me

A bunch of changes related to yaml serialization:

* ColorSpace transform a base Transform, instead of GroupTransform.
* GroupTransform Yaml serialization supports nesting
* Direction is now serialized for all yaml elements
- Can we call AddBaseTransformPropertiesToYAMLMap = EmitBaseTransformKeyValues
- Can we call ReadBaseTransformPropertiesFromYAMLMap = ReadBaseTransformKeyValues, and can the argument order be swaped to match the other >> operators ie. (TransformRcPtr & t, const YAML::Node & node) -> (const YAML::Node & node, TransformRcPtr &)

* Roles survive a yaml round trip
+1 I like this being a map, I'm not sure if order is important.

* Most transforms serialize in Flow form for better readability

Commits: js/master


I am not totally happy with the look of the Yaml output. Ideally, I'd
like to add blank lines after each colorspace definition (this is
valid yaml), but havent been able to figure out how do to so with
Yeah most of our yamls are hand written with big breaks between sections, so this hasn't really been an issue.

One possible way would be using YAML::Comment with some new line chars, but it would be much nicer to have something like out << YAML::NewLines(3) that you could use.

void MultiLineComment(YAML::Emitter& out, std::string& desiredOutput)
out << YAML::BeginSeq;
out << "item 1" << YAML::Comment("really really long\ncomment that couldn't possibly\nfit on one line");
out << "item 2";
out << YAML::EndSeq;
desiredOutput = "---\n- item 1 # really really long\n # comment that couldn't possibly\n # fit on one line\n- item 2";


Join to automatically receive all group messages.