nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ald...@apache.org
Subject [03/13] nifi-minifi-cpp git commit: MINIFICPP-263: Move merge content to an extension. Also remove circular dependencies
Date Thu, 26 Oct 2017 01:21:06 GMT
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitter.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitter.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitter.cpp
new file mode 100644
index 0000000..ebeb059
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitter.cpp
@@ -0,0 +1,911 @@
+#include <sstream>
+
+#include "emitterutils.h"
+#include "indentation.h"  // IWYU pragma: keep
+#include "yaml-cpp/emitter.h"
+#include "yaml-cpp/emitterdef.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/exceptions.h"  // IWYU pragma: keep
+
+namespace YAML {
+class Binary;
+struct _Null;
+
+Emitter::Emitter() : m_pState(new EmitterState) {}
+
+Emitter::Emitter(std::ostream& stream)
+    : m_pState(new EmitterState), m_stream(stream) {}
+
+Emitter::~Emitter() {}
+
+const char* Emitter::c_str() const { return m_stream.str(); }
+
+std::size_t Emitter::size() const { return m_stream.pos(); }
+
+// state checking
+bool Emitter::good() const { return m_pState->good(); }
+
+const std::string Emitter::GetLastError() const {
+  return m_pState->GetLastError();
+}
+
+// global setters
+bool Emitter::SetOutputCharset(EMITTER_MANIP value) {
+  return m_pState->SetOutputCharset(value, FmtScope::Global);
+}
+
+bool Emitter::SetStringFormat(EMITTER_MANIP value) {
+  return m_pState->SetStringFormat(value, FmtScope::Global);
+}
+
+bool Emitter::SetBoolFormat(EMITTER_MANIP value) {
+  bool ok = false;
+  if (m_pState->SetBoolFormat(value, FmtScope::Global))
+    ok = true;
+  if (m_pState->SetBoolCaseFormat(value, FmtScope::Global))
+    ok = true;
+  if (m_pState->SetBoolLengthFormat(value, FmtScope::Global))
+    ok = true;
+  return ok;
+}
+
+bool Emitter::SetIntBase(EMITTER_MANIP value) {
+  return m_pState->SetIntFormat(value, FmtScope::Global);
+}
+
+bool Emitter::SetSeqFormat(EMITTER_MANIP value) {
+  return m_pState->SetFlowType(GroupType::Seq, value, FmtScope::Global);
+}
+
+bool Emitter::SetMapFormat(EMITTER_MANIP value) {
+  bool ok = false;
+  if (m_pState->SetFlowType(GroupType::Map, value, FmtScope::Global))
+    ok = true;
+  if (m_pState->SetMapKeyFormat(value, FmtScope::Global))
+    ok = true;
+  return ok;
+}
+
+bool Emitter::SetIndent(std::size_t n) {
+  return m_pState->SetIndent(n, FmtScope::Global);
+}
+
+bool Emitter::SetPreCommentIndent(std::size_t n) {
+  return m_pState->SetPreCommentIndent(n, FmtScope::Global);
+}
+
+bool Emitter::SetPostCommentIndent(std::size_t n) {
+  return m_pState->SetPostCommentIndent(n, FmtScope::Global);
+}
+
+bool Emitter::SetFloatPrecision(std::size_t n) {
+  return m_pState->SetFloatPrecision(n, FmtScope::Global);
+}
+
+bool Emitter::SetDoublePrecision(std::size_t n) {
+  return m_pState->SetDoublePrecision(n, FmtScope::Global);
+}
+
+// SetLocalValue
+// . Either start/end a group, or set a modifier locally
+Emitter& Emitter::SetLocalValue(EMITTER_MANIP value) {
+  if (!good())
+    return *this;
+
+  switch (value) {
+    case BeginDoc:
+      EmitBeginDoc();
+      break;
+    case EndDoc:
+      EmitEndDoc();
+      break;
+    case BeginSeq:
+      EmitBeginSeq();
+      break;
+    case EndSeq:
+      EmitEndSeq();
+      break;
+    case BeginMap:
+      EmitBeginMap();
+      break;
+    case EndMap:
+      EmitEndMap();
+      break;
+    case Key:
+    case Value:
+      // deprecated (these can be deduced by the parity of nodes in a map)
+      break;
+    case TagByKind:
+      EmitKindTag();
+      break;
+    case Newline:
+      EmitNewline();
+      break;
+    default:
+      m_pState->SetLocalValue(value);
+      break;
+  }
+  return *this;
+}
+
+Emitter& Emitter::SetLocalIndent(const _Indent& indent) {
+  m_pState->SetIndent(indent.value, FmtScope::Local);
+  return *this;
+}
+
+Emitter& Emitter::SetLocalPrecision(const _Precision& precision) {
+  if (precision.floatPrecision >= 0)
+    m_pState->SetFloatPrecision(precision.floatPrecision, FmtScope::Local);
+  if (precision.doublePrecision >= 0)
+    m_pState->SetDoublePrecision(precision.doublePrecision, FmtScope::Local);
+  return *this;
+}
+
+// EmitBeginDoc
+void Emitter::EmitBeginDoc() {
+  if (!good())
+    return;
+
+  if (m_pState->CurGroupType() != GroupType::NoType) {
+    m_pState->SetError("Unexpected begin document");
+    return;
+  }
+
+  if (m_pState->HasAnchor() || m_pState->HasTag()) {
+    m_pState->SetError("Unexpected begin document");
+    return;
+  }
+
+  if (m_stream.col() > 0)
+    m_stream << "\n";
+  m_stream << "---\n";
+
+  m_pState->StartedDoc();
+}
+
+// EmitEndDoc
+void Emitter::EmitEndDoc() {
+  if (!good())
+    return;
+
+  if (m_pState->CurGroupType() != GroupType::NoType) {
+    m_pState->SetError("Unexpected begin document");
+    return;
+  }
+
+  if (m_pState->HasAnchor() || m_pState->HasTag()) {
+    m_pState->SetError("Unexpected begin document");
+    return;
+  }
+
+  if (m_stream.col() > 0)
+    m_stream << "\n";
+  m_stream << "...\n";
+}
+
+// EmitBeginSeq
+void Emitter::EmitBeginSeq() {
+  if (!good())
+    return;
+
+  PrepareNode(m_pState->NextGroupType(GroupType::Seq));
+
+  m_pState->StartedGroup(GroupType::Seq);
+}
+
+// EmitEndSeq
+void Emitter::EmitEndSeq() {
+  if (!good())
+    return;
+
+  if (m_pState->CurGroupChildCount() == 0)
+    m_pState->ForceFlow();
+
+  if (m_pState->CurGroupFlowType() == FlowType::Flow) {
+    if (m_stream.comment())
+      m_stream << "\n";
+    m_stream << IndentTo(m_pState->CurIndent());
+    if (m_pState->CurGroupChildCount() == 0)
+      m_stream << "[";
+    m_stream << "]";
+  }
+
+  m_pState->EndedGroup(GroupType::Seq);
+}
+
+// EmitBeginMap
+void Emitter::EmitBeginMap() {
+  if (!good())
+    return;
+
+  PrepareNode(m_pState->NextGroupType(GroupType::Map));
+
+  m_pState->StartedGroup(GroupType::Map);
+}
+
+// EmitEndMap
+void Emitter::EmitEndMap() {
+  if (!good())
+    return;
+
+  if (m_pState->CurGroupChildCount() == 0)
+    m_pState->ForceFlow();
+
+  if (m_pState->CurGroupFlowType() == FlowType::Flow) {
+    if (m_stream.comment())
+      m_stream << "\n";
+    m_stream << IndentTo(m_pState->CurIndent());
+    if (m_pState->CurGroupChildCount() == 0)
+      m_stream << "{";
+    m_stream << "}";
+  }
+
+  m_pState->EndedGroup(GroupType::Map);
+}
+
+// EmitNewline
+void Emitter::EmitNewline() {
+  if (!good())
+    return;
+
+  PrepareNode(EmitterNodeType::NoType);
+  m_stream << "\n";
+  m_pState->SetNonContent();
+}
+
+bool Emitter::CanEmitNewline() const { return true; }
+
+// Put the stream in a state so we can simply write the next node
+// E.g., if we're in a sequence, write the "- "
+void Emitter::PrepareNode(EmitterNodeType::value child) {
+  switch (m_pState->CurGroupNodeType()) {
+    case EmitterNodeType::NoType:
+      PrepareTopNode(child);
+      break;
+    case EmitterNodeType::FlowSeq:
+      FlowSeqPrepareNode(child);
+      break;
+    case EmitterNodeType::BlockSeq:
+      BlockSeqPrepareNode(child);
+      break;
+    case EmitterNodeType::FlowMap:
+      FlowMapPrepareNode(child);
+      break;
+    case EmitterNodeType::BlockMap:
+      BlockMapPrepareNode(child);
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+      assert(false);
+      break;
+  }
+}
+
+void Emitter::PrepareTopNode(EmitterNodeType::value child) {
+  if (child == EmitterNodeType::NoType)
+    return;
+
+  if (m_pState->CurGroupChildCount() > 0 && m_stream.col() > 0) {
+    if (child != EmitterNodeType::NoType)
+      EmitBeginDoc();
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      // TODO: if we were writing null, and
+      // we wanted it blank, we wouldn't want a space
+      SpaceOrIndentTo(m_pState->HasBegunContent(), 0);
+      break;
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      if (m_pState->HasBegunNode())
+        m_stream << "\n";
+      break;
+  }
+}
+
+void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child) {
+  const std::size_t lastIndent = m_pState->LastIndent();
+
+  if (!m_pState->HasBegunNode()) {
+    if (m_stream.comment())
+      m_stream << "\n";
+    m_stream << IndentTo(lastIndent);
+    if (m_pState->CurGroupChildCount() == 0)
+      m_stream << "[";
+    else
+      m_stream << ",";
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      SpaceOrIndentTo(
+          m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+          lastIndent);
+      break;
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      assert(false);
+      break;
+  }
+}
+
+void Emitter::BlockSeqPrepareNode(EmitterNodeType::value child) {
+  const std::size_t curIndent = m_pState->CurIndent();
+  const std::size_t nextIndent = curIndent + m_pState->CurGroupIndent();
+
+  if (child == EmitterNodeType::NoType)
+    return;
+
+  if (!m_pState->HasBegunContent()) {
+    if (m_pState->CurGroupChildCount() > 0 || m_stream.comment()) {
+      m_stream << "\n";
+    }
+    m_stream << IndentTo(curIndent);
+    m_stream << "-";
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      SpaceOrIndentTo(m_pState->HasBegunContent(), nextIndent);
+      break;
+    case EmitterNodeType::BlockSeq:
+      m_stream << "\n";
+      break;
+    case EmitterNodeType::BlockMap:
+      if (m_pState->HasBegunContent() || m_stream.comment())
+        m_stream << "\n";
+      break;
+  }
+}
+
+void Emitter::FlowMapPrepareNode(EmitterNodeType::value child) {
+  if (m_pState->CurGroupChildCount() % 2 == 0) {
+    if (m_pState->GetMapKeyFormat() == LongKey)
+      m_pState->SetLongKey();
+
+    if (m_pState->CurGroupLongKey())
+      FlowMapPrepareLongKey(child);
+    else
+      FlowMapPrepareSimpleKey(child);
+  } else {
+    if (m_pState->CurGroupLongKey())
+      FlowMapPrepareLongKeyValue(child);
+    else
+      FlowMapPrepareSimpleKeyValue(child);
+  }
+}
+
+void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child) {
+  const std::size_t lastIndent = m_pState->LastIndent();
+
+  if (!m_pState->HasBegunNode()) {
+    if (m_stream.comment())
+      m_stream << "\n";
+    m_stream << IndentTo(lastIndent);
+    if (m_pState->CurGroupChildCount() == 0)
+      m_stream << "{ ?";
+    else
+      m_stream << ", ?";
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      SpaceOrIndentTo(
+          m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+          lastIndent);
+      break;
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      assert(false);
+      break;
+  }
+}
+
+void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child) {
+  const std::size_t lastIndent = m_pState->LastIndent();
+
+  if (!m_pState->HasBegunNode()) {
+    if (m_stream.comment())
+      m_stream << "\n";
+    m_stream << IndentTo(lastIndent);
+    m_stream << ":";
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      SpaceOrIndentTo(
+          m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+          lastIndent);
+      break;
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      assert(false);
+      break;
+  }
+}
+
+void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child) {
+  const std::size_t lastIndent = m_pState->LastIndent();
+
+  if (!m_pState->HasBegunNode()) {
+    if (m_stream.comment())
+      m_stream << "\n";
+    m_stream << IndentTo(lastIndent);
+    if (m_pState->CurGroupChildCount() == 0)
+      m_stream << "{";
+    else
+      m_stream << ",";
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      SpaceOrIndentTo(
+          m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+          lastIndent);
+      break;
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      assert(false);
+      break;
+  }
+}
+
+void Emitter::FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
+  const std::size_t lastIndent = m_pState->LastIndent();
+
+  if (!m_pState->HasBegunNode()) {
+    if (m_stream.comment())
+      m_stream << "\n";
+    m_stream << IndentTo(lastIndent);
+    m_stream << ":";
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      SpaceOrIndentTo(
+          m_pState->HasBegunContent() || m_pState->CurGroupChildCount() > 0,
+          lastIndent);
+      break;
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      assert(false);
+      break;
+  }
+}
+
+void Emitter::BlockMapPrepareNode(EmitterNodeType::value child) {
+  if (m_pState->CurGroupChildCount() % 2 == 0) {
+    if (m_pState->GetMapKeyFormat() == LongKey)
+      m_pState->SetLongKey();
+    if (child == EmitterNodeType::BlockSeq ||
+        child == EmitterNodeType::BlockMap)
+      m_pState->SetLongKey();
+
+    if (m_pState->CurGroupLongKey())
+      BlockMapPrepareLongKey(child);
+    else
+      BlockMapPrepareSimpleKey(child);
+  } else {
+    if (m_pState->CurGroupLongKey())
+      BlockMapPrepareLongKeyValue(child);
+    else
+      BlockMapPrepareSimpleKeyValue(child);
+  }
+}
+
+void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
+  const std::size_t curIndent = m_pState->CurIndent();
+  const std::size_t childCount = m_pState->CurGroupChildCount();
+
+  if (child == EmitterNodeType::NoType)
+    return;
+
+  if (!m_pState->HasBegunContent()) {
+    if (childCount > 0) {
+      m_stream << "\n";
+    }
+    if (m_stream.comment()) {
+      m_stream << "\n";
+    }
+    m_stream << IndentTo(curIndent);
+    m_stream << "?";
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      SpaceOrIndentTo(true, curIndent + 1);
+      break;
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      break;
+  }
+}
+
+void Emitter::BlockMapPrepareLongKeyValue(EmitterNodeType::value child) {
+  const std::size_t curIndent = m_pState->CurIndent();
+
+  if (child == EmitterNodeType::NoType)
+    return;
+
+  if (!m_pState->HasBegunContent()) {
+    m_stream << "\n";
+    m_stream << IndentTo(curIndent);
+    m_stream << ":";
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      SpaceOrIndentTo(true, curIndent + 1);
+      break;
+  }
+}
+
+void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) {
+  const std::size_t curIndent = m_pState->CurIndent();
+  const std::size_t childCount = m_pState->CurGroupChildCount();
+
+  if (child == EmitterNodeType::NoType)
+    return;
+
+  if (!m_pState->HasBegunNode()) {
+    if (childCount > 0) {
+      m_stream << "\n";
+    }
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      SpaceOrIndentTo(m_pState->HasBegunContent(), curIndent);
+      break;
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      break;
+  }
+}
+
+void Emitter::BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
+  const std::size_t curIndent = m_pState->CurIndent();
+  const std::size_t nextIndent = curIndent + m_pState->CurGroupIndent();
+
+  if (!m_pState->HasBegunNode()) {
+    m_stream << ":";
+  }
+
+  switch (child) {
+    case EmitterNodeType::NoType:
+      break;
+    case EmitterNodeType::Property:
+    case EmitterNodeType::Scalar:
+    case EmitterNodeType::FlowSeq:
+    case EmitterNodeType::FlowMap:
+      SpaceOrIndentTo(true, nextIndent);
+      break;
+    case EmitterNodeType::BlockSeq:
+    case EmitterNodeType::BlockMap:
+      m_stream << "\n";
+      break;
+  }
+}
+
+// SpaceOrIndentTo
+// . Prepares for some more content by proper spacing
+void Emitter::SpaceOrIndentTo(bool requireSpace, std::size_t indent) {
+  if (m_stream.comment())
+    m_stream << "\n";
+  if (m_stream.col() > 0 && requireSpace)
+    m_stream << " ";
+  m_stream << IndentTo(indent);
+}
+
+void Emitter::PrepareIntegralStream(std::stringstream& stream) const {
+
+  switch (m_pState->GetIntFormat()) {
+    case Dec:
+      stream << std::dec;
+      break;
+    case Hex:
+      stream << "0x";
+      stream << std::hex;
+      break;
+    case Oct:
+      stream << "0";
+      stream << std::oct;
+      break;
+    default:
+      assert(false);
+  }
+}
+
+void Emitter::StartedScalar() { m_pState->StartedScalar(); }
+
+// *******************************************************************************************
+// overloads of Write
+
+Emitter& Emitter::Write(const std::string& str) {
+  if (!good())
+    return *this;
+
+  const bool escapeNonAscii = m_pState->GetOutputCharset() == EscapeNonAscii;
+  const StringFormat::value strFormat =
+      Utils::ComputeStringFormat(str, m_pState->GetStringFormat(),
+                                 m_pState->CurGroupFlowType(), escapeNonAscii);
+
+  if (strFormat == StringFormat::Literal)
+    m_pState->SetMapKeyFormat(YAML::LongKey, FmtScope::Local);
+
+  PrepareNode(EmitterNodeType::Scalar);
+
+  switch (strFormat) {
+    case StringFormat::Plain:
+      m_stream << str;
+      break;
+    case StringFormat::SingleQuoted:
+      Utils::WriteSingleQuotedString(m_stream, str);
+      break;
+    case StringFormat::DoubleQuoted:
+      Utils::WriteDoubleQuotedString(m_stream, str, escapeNonAscii);
+      break;
+    case StringFormat::Literal:
+      Utils::WriteLiteralString(m_stream, str,
+                                m_pState->CurIndent() + m_pState->GetIndent());
+      break;
+  }
+
+  StartedScalar();
+
+  return *this;
+}
+
+std::size_t Emitter::GetFloatPrecision() const {
+  return m_pState->GetFloatPrecision();
+}
+
+std::size_t Emitter::GetDoublePrecision() const {
+  return m_pState->GetDoublePrecision();
+}
+
+const char* Emitter::ComputeFullBoolName(bool b) const {
+  const EMITTER_MANIP mainFmt = (m_pState->GetBoolLengthFormat() == ShortBool
+                                     ? YesNoBool
+                                     : m_pState->GetBoolFormat());
+  const EMITTER_MANIP caseFmt = m_pState->GetBoolCaseFormat();
+  switch (mainFmt) {
+    case YesNoBool:
+      switch (caseFmt) {
+        case UpperCase:
+          return b ? "YES" : "NO";
+        case CamelCase:
+          return b ? "Yes" : "No";
+        case LowerCase:
+          return b ? "yes" : "no";
+        default:
+          break;
+      }
+      break;
+    case OnOffBool:
+      switch (caseFmt) {
+        case UpperCase:
+          return b ? "ON" : "OFF";
+        case CamelCase:
+          return b ? "On" : "Off";
+        case LowerCase:
+          return b ? "on" : "off";
+        default:
+          break;
+      }
+      break;
+    case TrueFalseBool:
+      switch (caseFmt) {
+        case UpperCase:
+          return b ? "TRUE" : "FALSE";
+        case CamelCase:
+          return b ? "True" : "False";
+        case LowerCase:
+          return b ? "true" : "false";
+        default:
+          break;
+      }
+      break;
+    default:
+      break;
+  }
+  return b ? "y" : "n";  // should never get here, but it can't hurt to give
+                         // these answers
+}
+
+Emitter& Emitter::Write(bool b) {
+  if (!good())
+    return *this;
+
+  PrepareNode(EmitterNodeType::Scalar);
+
+  const char* name = ComputeFullBoolName(b);
+  if (m_pState->GetBoolLengthFormat() == ShortBool)
+    m_stream << name[0];
+  else
+    m_stream << name;
+
+  StartedScalar();
+
+  return *this;
+}
+
+Emitter& Emitter::Write(char ch) {
+  if (!good())
+    return *this;
+
+  PrepareNode(EmitterNodeType::Scalar);
+  Utils::WriteChar(m_stream, ch);
+  StartedScalar();
+
+  return *this;
+}
+
+Emitter& Emitter::Write(const _Alias& alias) {
+  if (!good())
+    return *this;
+
+  if (m_pState->HasAnchor() || m_pState->HasTag()) {
+    m_pState->SetError(ErrorMsg::INVALID_ALIAS);
+    return *this;
+  }
+
+  PrepareNode(EmitterNodeType::Scalar);
+
+  if (!Utils::WriteAlias(m_stream, alias.content)) {
+    m_pState->SetError(ErrorMsg::INVALID_ALIAS);
+    return *this;
+  }
+
+  StartedScalar();
+
+  return *this;
+}
+
+Emitter& Emitter::Write(const _Anchor& anchor) {
+  if (!good())
+    return *this;
+
+  if (m_pState->HasAnchor()) {
+    m_pState->SetError(ErrorMsg::INVALID_ANCHOR);
+    return *this;
+  }
+
+  PrepareNode(EmitterNodeType::Property);
+
+  if (!Utils::WriteAnchor(m_stream, anchor.content)) {
+    m_pState->SetError(ErrorMsg::INVALID_ANCHOR);
+    return *this;
+  }
+
+  m_pState->SetAnchor();
+
+  return *this;
+}
+
+Emitter& Emitter::Write(const _Tag& tag) {
+  if (!good())
+    return *this;
+
+  if (m_pState->HasTag()) {
+    m_pState->SetError(ErrorMsg::INVALID_TAG);
+    return *this;
+  }
+
+  PrepareNode(EmitterNodeType::Property);
+
+  bool success = false;
+  if (tag.type == _Tag::Type::Verbatim)
+    success = Utils::WriteTag(m_stream, tag.content, true);
+  else if (tag.type == _Tag::Type::PrimaryHandle)
+    success = Utils::WriteTag(m_stream, tag.content, false);
+  else
+    success = Utils::WriteTagWithPrefix(m_stream, tag.prefix, tag.content);
+
+  if (!success) {
+    m_pState->SetError(ErrorMsg::INVALID_TAG);
+    return *this;
+  }
+
+  m_pState->SetTag();
+
+  return *this;
+}
+
+void Emitter::EmitKindTag() { Write(LocalTag("")); }
+
+Emitter& Emitter::Write(const _Comment& comment) {
+  if (!good())
+    return *this;
+
+  PrepareNode(EmitterNodeType::NoType);
+
+  if (m_stream.col() > 0)
+    m_stream << Indentation(m_pState->GetPreCommentIndent());
+  Utils::WriteComment(m_stream, comment.content,
+                      m_pState->GetPostCommentIndent());
+
+  m_pState->SetNonContent();
+
+  return *this;
+}
+
+Emitter& Emitter::Write(const _Null& /*null*/) {
+  if (!good())
+    return *this;
+
+  PrepareNode(EmitterNodeType::Scalar);
+
+  m_stream << "~";
+
+  StartedScalar();
+
+  return *this;
+}
+
+Emitter& Emitter::Write(const Binary& binary) {
+  Write(SecondaryTag("binary"));
+
+  if (!good())
+    return *this;
+
+  PrepareNode(EmitterNodeType::Scalar);
+  Utils::WriteBinary(m_stream, binary);
+  StartedScalar();
+
+  return *this;
+}
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterstate.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterstate.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterstate.cpp
new file mode 100644
index 0000000..3542aaf
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterstate.cpp
@@ -0,0 +1,365 @@
+#include <limits>
+
+#include "emitterstate.h"
+#include "yaml-cpp/exceptions.h"  // IWYU pragma: keep
+
+namespace YAML {
+EmitterState::EmitterState()
+    : m_isGood(true),
+      m_curIndent(0),
+      m_hasAnchor(false),
+      m_hasTag(false),
+      m_hasNonContent(false),
+      m_docCount(0) {
+  // set default global manipulators
+  m_charset.set(EmitNonAscii);
+  m_strFmt.set(Auto);
+  m_boolFmt.set(TrueFalseBool);
+  m_boolLengthFmt.set(LongBool);
+  m_boolCaseFmt.set(LowerCase);
+  m_intFmt.set(Dec);
+  m_indent.set(2);
+  m_preCommentIndent.set(2);
+  m_postCommentIndent.set(1);
+  m_seqFmt.set(Block);
+  m_mapFmt.set(Block);
+  m_mapKeyFmt.set(Auto);
+  m_floatPrecision.set(std::numeric_limits<float>::digits10 + 1);
+  m_doublePrecision.set(std::numeric_limits<double>::digits10 + 1);
+}
+
+EmitterState::~EmitterState() {}
+
+// SetLocalValue
+// . We blindly tries to set all possible formatters to this value
+// . Only the ones that make sense will be accepted
+void EmitterState::SetLocalValue(EMITTER_MANIP value) {
+  SetOutputCharset(value, FmtScope::Local);
+  SetStringFormat(value, FmtScope::Local);
+  SetBoolFormat(value, FmtScope::Local);
+  SetBoolCaseFormat(value, FmtScope::Local);
+  SetBoolLengthFormat(value, FmtScope::Local);
+  SetIntFormat(value, FmtScope::Local);
+  SetFlowType(GroupType::Seq, value, FmtScope::Local);
+  SetFlowType(GroupType::Map, value, FmtScope::Local);
+  SetMapKeyFormat(value, FmtScope::Local);
+}
+
+void EmitterState::SetAnchor() { m_hasAnchor = true; }
+
+void EmitterState::SetTag() { m_hasTag = true; }
+
+void EmitterState::SetNonContent() { m_hasNonContent = true; }
+
+void EmitterState::SetLongKey() {
+  assert(!m_groups.empty());
+  if (m_groups.empty()) {
+    return;
+  }
+
+  assert(m_groups.back()->type == GroupType::Map);
+  m_groups.back()->longKey = true;
+}
+
+void EmitterState::ForceFlow() {
+  assert(!m_groups.empty());
+  if (m_groups.empty()) {
+    return;
+  }
+
+  m_groups.back()->flowType = FlowType::Flow;
+}
+
+void EmitterState::StartedNode() {
+  if (m_groups.empty()) {
+    m_docCount++;
+  } else {
+    m_groups.back()->childCount++;
+    if (m_groups.back()->childCount % 2 == 0) {
+      m_groups.back()->longKey = false;
+    }
+  }
+
+  m_hasAnchor = false;
+  m_hasTag = false;
+  m_hasNonContent = false;
+}
+
+EmitterNodeType::value EmitterState::NextGroupType(
+    GroupType::value type) const {
+  if (type == GroupType::Seq) {
+    if (GetFlowType(type) == Block)
+      return EmitterNodeType::BlockSeq;
+    else
+      return EmitterNodeType::FlowSeq;
+  } else {
+    if (GetFlowType(type) == Block)
+      return EmitterNodeType::BlockMap;
+    else
+      return EmitterNodeType::FlowMap;
+  }
+
+  // can't happen
+  assert(false);
+  return EmitterNodeType::NoType;
+}
+
+void EmitterState::StartedDoc() {
+  m_hasAnchor = false;
+  m_hasTag = false;
+  m_hasNonContent = false;
+}
+
+void EmitterState::EndedDoc() {
+  m_hasAnchor = false;
+  m_hasTag = false;
+  m_hasNonContent = false;
+}
+
+void EmitterState::StartedScalar() {
+  StartedNode();
+  ClearModifiedSettings();
+}
+
+void EmitterState::StartedGroup(GroupType::value type) {
+  StartedNode();
+
+  const std::size_t lastGroupIndent =
+      (m_groups.empty() ? 0 : m_groups.back()->indent);
+  m_curIndent += lastGroupIndent;
+
+  // TODO: Create move constructors for settings types to simplify transfer
+  std::unique_ptr<Group> pGroup(new Group(type));
+
+  // transfer settings (which last until this group is done)
+  //
+  // NB: if pGroup->modifiedSettings == m_modifiedSettings,
+  // m_modifiedSettings is not changed!
+  pGroup->modifiedSettings = std::move(m_modifiedSettings);
+
+  // set up group
+  if (GetFlowType(type) == Block) {
+    pGroup->flowType = FlowType::Block;
+  } else {
+    pGroup->flowType = FlowType::Flow;
+  }
+  pGroup->indent = GetIndent();
+
+  m_groups.push_back(std::move(pGroup));
+}
+
+void EmitterState::EndedGroup(GroupType::value type) {
+  if (m_groups.empty()) {
+    if (type == GroupType::Seq) {
+      return SetError(ErrorMsg::UNEXPECTED_END_SEQ);
+    } else {
+      return SetError(ErrorMsg::UNEXPECTED_END_MAP);
+    }
+  }
+
+  // get rid of the current group
+  {
+    std::unique_ptr<Group> pFinishedGroup = std::move(m_groups.back());
+    m_groups.pop_back();
+    if (pFinishedGroup->type != type) {
+      return SetError(ErrorMsg::UNMATCHED_GROUP_TAG);
+    }
+  }
+
+  // reset old settings
+  std::size_t lastIndent = (m_groups.empty() ? 0 : m_groups.back()->indent);
+  assert(m_curIndent >= lastIndent);
+  m_curIndent -= lastIndent;
+
+  // some global settings that we changed may have been overridden
+  // by a local setting we just popped, so we need to restore them
+  m_globalModifiedSettings.restore();
+
+  ClearModifiedSettings();
+}
+
+EmitterNodeType::value EmitterState::CurGroupNodeType() const {
+  if (m_groups.empty()) {
+    return EmitterNodeType::NoType;
+  }
+
+  return m_groups.back()->NodeType();
+}
+
+GroupType::value EmitterState::CurGroupType() const {
+  return m_groups.empty() ? GroupType::NoType : m_groups.back()->type;
+}
+
+FlowType::value EmitterState::CurGroupFlowType() const {
+  return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType;
+}
+
+std::size_t EmitterState::CurGroupIndent() const {
+  return m_groups.empty() ? 0 : m_groups.back()->indent;
+}
+
+std::size_t EmitterState::CurGroupChildCount() const {
+  return m_groups.empty() ? m_docCount : m_groups.back()->childCount;
+}
+
+bool EmitterState::CurGroupLongKey() const {
+  return m_groups.empty() ? false : m_groups.back()->longKey;
+}
+
+std::size_t EmitterState::LastIndent() const {
+  if (m_groups.size() <= 1) {
+    return 0;
+  }
+
+  return m_curIndent - m_groups[m_groups.size() - 2]->indent;
+}
+
+void EmitterState::ClearModifiedSettings() { m_modifiedSettings.clear(); }
+
+bool EmitterState::SetOutputCharset(EMITTER_MANIP value,
+                                    FmtScope::value scope) {
+  switch (value) {
+    case EmitNonAscii:
+    case EscapeNonAscii:
+      _Set(m_charset, value, scope);
+      return true;
+    default:
+      return false;
+  }
+}
+
+bool EmitterState::SetStringFormat(EMITTER_MANIP value, FmtScope::value scope) {
+  switch (value) {
+    case Auto:
+    case SingleQuoted:
+    case DoubleQuoted:
+    case Literal:
+      _Set(m_strFmt, value, scope);
+      return true;
+    default:
+      return false;
+  }
+}
+
+bool EmitterState::SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope) {
+  switch (value) {
+    case OnOffBool:
+    case TrueFalseBool:
+    case YesNoBool:
+      _Set(m_boolFmt, value, scope);
+      return true;
+    default:
+      return false;
+  }
+}
+
+bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value,
+                                       FmtScope::value scope) {
+  switch (value) {
+    case LongBool:
+    case ShortBool:
+      _Set(m_boolLengthFmt, value, scope);
+      return true;
+    default:
+      return false;
+  }
+}
+
+bool EmitterState::SetBoolCaseFormat(EMITTER_MANIP value,
+                                     FmtScope::value scope) {
+  switch (value) {
+    case UpperCase:
+    case LowerCase:
+    case CamelCase:
+      _Set(m_boolCaseFmt, value, scope);
+      return true;
+    default:
+      return false;
+  }
+}
+
+bool EmitterState::SetIntFormat(EMITTER_MANIP value, FmtScope::value scope) {
+  switch (value) {
+    case Dec:
+    case Hex:
+    case Oct:
+      _Set(m_intFmt, value, scope);
+      return true;
+    default:
+      return false;
+  }
+}
+
+bool EmitterState::SetIndent(std::size_t value, FmtScope::value scope) {
+  if (value <= 1)
+    return false;
+
+  _Set(m_indent, value, scope);
+  return true;
+}
+
+bool EmitterState::SetPreCommentIndent(std::size_t value,
+                                       FmtScope::value scope) {
+  if (value == 0)
+    return false;
+
+  _Set(m_preCommentIndent, value, scope);
+  return true;
+}
+
+bool EmitterState::SetPostCommentIndent(std::size_t value,
+                                        FmtScope::value scope) {
+  if (value == 0)
+    return false;
+
+  _Set(m_postCommentIndent, value, scope);
+  return true;
+}
+
+bool EmitterState::SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
+                               FmtScope::value scope) {
+  switch (value) {
+    case Block:
+    case Flow:
+      _Set(groupType == GroupType::Seq ? m_seqFmt : m_mapFmt, value, scope);
+      return true;
+    default:
+      return false;
+  }
+}
+
+EMITTER_MANIP EmitterState::GetFlowType(GroupType::value groupType) const {
+  // force flow style if we're currently in a flow
+  if (CurGroupFlowType() == FlowType::Flow)
+    return Flow;
+
+  // otherwise, go with what's asked of us
+  return (groupType == GroupType::Seq ? m_seqFmt.get() : m_mapFmt.get());
+}
+
+bool EmitterState::SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope) {
+  switch (value) {
+    case Auto:
+    case LongKey:
+      _Set(m_mapKeyFmt, value, scope);
+      return true;
+    default:
+      return false;
+  }
+}
+
+bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) {
+  if (value > std::numeric_limits<float>::digits10 + 1)
+    return false;
+  _Set(m_floatPrecision, value, scope);
+  return true;
+}
+
+bool EmitterState::SetDoublePrecision(std::size_t value,
+                                      FmtScope::value scope) {
+  if (value > std::numeric_limits<double>::digits10 + 1)
+    return false;
+  _Set(m_doublePrecision, value, scope);
+  return true;
+}
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterstate.h
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterstate.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterstate.h
new file mode 100644
index 0000000..0937f00
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterstate.h
@@ -0,0 +1,203 @@
+#ifndef EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) ||                                            \
+    (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+     (__GNUC__ >= 4))  // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include "setting.h"
+#include "yaml-cpp/emitterdef.h"
+#include "yaml-cpp/emittermanip.h"
+
+#include <cassert>
+#include <memory>
+#include <stack>
+#include <stdexcept>
+#include <vector>
+
+namespace YAML {
+struct FmtScope {
+  enum value { Local, Global };
+};
+struct GroupType {
+  enum value { NoType, Seq, Map };
+};
+struct FlowType {
+  enum value { NoType, Flow, Block };
+};
+
+class EmitterState {
+ public:
+  EmitterState();
+  ~EmitterState();
+
+  // basic state checking
+  bool good() const { return m_isGood; }
+  const std::string GetLastError() const { return m_lastError; }
+  void SetError(const std::string& error) {
+    m_isGood = false;
+    m_lastError = error;
+  }
+
+  // node handling
+  void SetAnchor();
+  void SetTag();
+  void SetNonContent();
+  void SetLongKey();
+  void ForceFlow();
+  void StartedDoc();
+  void EndedDoc();
+  void StartedScalar();
+  void StartedGroup(GroupType::value type);
+  void EndedGroup(GroupType::value type);
+
+  EmitterNodeType::value NextGroupType(GroupType::value type) const;
+  EmitterNodeType::value CurGroupNodeType() const;
+
+  GroupType::value CurGroupType() const;
+  FlowType::value CurGroupFlowType() const;
+  std::size_t CurGroupIndent() const;
+  std::size_t CurGroupChildCount() const;
+  bool CurGroupLongKey() const;
+
+  std::size_t LastIndent() const;
+  std::size_t CurIndent() const { return m_curIndent; }
+  bool HasAnchor() const { return m_hasAnchor; }
+  bool HasTag() const { return m_hasTag; }
+  bool HasBegunNode() const {
+    return m_hasAnchor || m_hasTag || m_hasNonContent;
+  }
+  bool HasBegunContent() const { return m_hasAnchor || m_hasTag; }
+
+  void ClearModifiedSettings();
+
+  // formatters
+  void SetLocalValue(EMITTER_MANIP value);
+
+  bool SetOutputCharset(EMITTER_MANIP value, FmtScope::value scope);
+  EMITTER_MANIP GetOutputCharset() const { return m_charset.get(); }
+
+  bool SetStringFormat(EMITTER_MANIP value, FmtScope::value scope);
+  EMITTER_MANIP GetStringFormat() const { return m_strFmt.get(); }
+
+  bool SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope);
+  EMITTER_MANIP GetBoolFormat() const { return m_boolFmt.get(); }
+
+  bool SetBoolLengthFormat(EMITTER_MANIP value, FmtScope::value scope);
+  EMITTER_MANIP GetBoolLengthFormat() const { return m_boolLengthFmt.get(); }
+
+  bool SetBoolCaseFormat(EMITTER_MANIP value, FmtScope::value scope);
+  EMITTER_MANIP GetBoolCaseFormat() const { return m_boolCaseFmt.get(); }
+
+  bool SetIntFormat(EMITTER_MANIP value, FmtScope::value scope);
+  EMITTER_MANIP GetIntFormat() const { return m_intFmt.get(); }
+
+  bool SetIndent(std::size_t value, FmtScope::value scope);
+  std::size_t GetIndent() const { return m_indent.get(); }
+
+  bool SetPreCommentIndent(std::size_t value, FmtScope::value scope);
+  std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); }
+  bool SetPostCommentIndent(std::size_t value, FmtScope::value scope);
+  std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); }
+
+  bool SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
+                   FmtScope::value scope);
+  EMITTER_MANIP GetFlowType(GroupType::value groupType) const;
+
+  bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope);
+  EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); }
+
+  bool SetFloatPrecision(std::size_t value, FmtScope::value scope);
+  std::size_t GetFloatPrecision() const { return m_floatPrecision.get(); }
+  bool SetDoublePrecision(std::size_t value, FmtScope::value scope);
+  std::size_t GetDoublePrecision() const { return m_doublePrecision.get(); }
+
+ private:
+  template <typename T>
+  void _Set(Setting<T>& fmt, T value, FmtScope::value scope);
+
+  void StartedNode();
+
+ private:
+  // basic state ok?
+  bool m_isGood;
+  std::string m_lastError;
+
+  // other state
+  Setting<EMITTER_MANIP> m_charset;
+  Setting<EMITTER_MANIP> m_strFmt;
+  Setting<EMITTER_MANIP> m_boolFmt;
+  Setting<EMITTER_MANIP> m_boolLengthFmt;
+  Setting<EMITTER_MANIP> m_boolCaseFmt;
+  Setting<EMITTER_MANIP> m_intFmt;
+  Setting<std::size_t> m_indent;
+  Setting<std::size_t> m_preCommentIndent, m_postCommentIndent;
+  Setting<EMITTER_MANIP> m_seqFmt;
+  Setting<EMITTER_MANIP> m_mapFmt;
+  Setting<EMITTER_MANIP> m_mapKeyFmt;
+  Setting<std::size_t> m_floatPrecision;
+  Setting<std::size_t> m_doublePrecision;
+
+  SettingChanges m_modifiedSettings;
+  SettingChanges m_globalModifiedSettings;
+
+  struct Group {
+    explicit Group(GroupType::value type_)
+        : type(type_), indent(0), childCount(0), longKey(false) {}
+
+    GroupType::value type;
+    FlowType::value flowType;
+    std::size_t indent;
+    std::size_t childCount;
+    bool longKey;
+
+    SettingChanges modifiedSettings;
+
+    EmitterNodeType::value NodeType() const {
+      if (type == GroupType::Seq) {
+        if (flowType == FlowType::Flow)
+          return EmitterNodeType::FlowSeq;
+        else
+          return EmitterNodeType::BlockSeq;
+      } else {
+        if (flowType == FlowType::Flow)
+          return EmitterNodeType::FlowMap;
+        else
+          return EmitterNodeType::BlockMap;
+      }
+
+      // can't get here
+      assert(false);
+      return EmitterNodeType::NoType;
+    }
+  };
+
+  std::vector<std::unique_ptr<Group>> m_groups;
+  std::size_t m_curIndent;
+  bool m_hasAnchor;
+  bool m_hasTag;
+  bool m_hasNonContent;
+  std::size_t m_docCount;
+};
+
+template <typename T>
+void EmitterState::_Set(Setting<T>& fmt, T value, FmtScope::value scope) {
+  switch (scope) {
+    case FmtScope::Local:
+      m_modifiedSettings.push(fmt.set(value));
+      break;
+    case FmtScope::Global:
+      fmt.set(value);
+      m_globalModifiedSettings.push(
+          fmt.set(value));  // this pushes an identity set, so when we restore,
+      // it restores to the value here, and not the previous one
+      break;
+    default:
+      assert(false);
+  }
+}
+}
+
+#endif  // EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterutils.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterutils.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterutils.cpp
new file mode 100644
index 0000000..147738a
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterutils.cpp
@@ -0,0 +1,483 @@
+#include <iomanip>
+#include <sstream>
+
+#include "emitterutils.h"
+#include "exp.h"
+#include "indentation.h"
+#include "regex_yaml.h"
+#include "regeximpl.h"
+#include "stringsource.h"
+#include "yaml-cpp/binary.h"  // IWYU pragma: keep
+#include "yaml-cpp/ostream_wrapper.h"
+#include "yaml-cpp/null.h"
+
+namespace YAML {
+namespace Utils {
+namespace {
+enum { REPLACEMENT_CHARACTER = 0xFFFD };
+
+bool IsAnchorChar(int ch) {  // test for ns-anchor-char
+  switch (ch) {
+    case ',':
+    case '[':
+    case ']':
+    case '{':
+    case '}':  // c-flow-indicator
+    case ' ':
+    case '\t':    // s-white
+    case 0xFEFF:  // c-byte-order-mark
+    case 0xA:
+    case 0xD:  // b-char
+      return false;
+    case 0x85:
+      return true;
+  }
+
+  if (ch < 0x20) {
+    return false;
+  }
+
+  if (ch < 0x7E) {
+    return true;
+  }
+
+  if (ch < 0xA0) {
+    return false;
+  }
+  if (ch >= 0xD800 && ch <= 0xDFFF) {
+    return false;
+  }
+  if ((ch & 0xFFFE) == 0xFFFE) {
+    return false;
+  }
+  if ((ch >= 0xFDD0) && (ch <= 0xFDEF)) {
+    return false;
+  }
+  if (ch > 0x10FFFF) {
+    return false;
+  }
+
+  return true;
+}
+
+int Utf8BytesIndicated(char ch) {
+  int byteVal = static_cast<unsigned char>(ch);
+  switch (byteVal >> 4) {
+    case 0:
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+    case 5:
+    case 6:
+    case 7:
+      return 1;
+    case 12:
+    case 13:
+      return 2;
+    case 14:
+      return 3;
+    case 15:
+      return 4;
+    default:
+      return -1;
+  }
+}
+
+bool IsTrailingByte(char ch) { return (ch & 0xC0) == 0x80; }
+
+bool GetNextCodePointAndAdvance(int& codePoint,
+                                std::string::const_iterator& first,
+                                std::string::const_iterator last) {
+  if (first == last)
+    return false;
+
+  int nBytes = Utf8BytesIndicated(*first);
+  if (nBytes < 1) {
+    // Bad lead byte
+    ++first;
+    codePoint = REPLACEMENT_CHARACTER;
+    return true;
+  }
+
+  if (nBytes == 1) {
+    codePoint = *first++;
+    return true;
+  }
+
+  // Gather bits from trailing bytes
+  codePoint = static_cast<unsigned char>(*first) & ~(0xFF << (7 - nBytes));
+  ++first;
+  --nBytes;
+  for (; nBytes > 0; ++first, --nBytes) {
+    if ((first == last) || !IsTrailingByte(*first)) {
+      codePoint = REPLACEMENT_CHARACTER;
+      break;
+    }
+    codePoint <<= 6;
+    codePoint |= *first & 0x3F;
+  }
+
+  // Check for illegal code points
+  if (codePoint > 0x10FFFF)
+    codePoint = REPLACEMENT_CHARACTER;
+  else if (codePoint >= 0xD800 && codePoint <= 0xDFFF)
+    codePoint = REPLACEMENT_CHARACTER;
+  else if ((codePoint & 0xFFFE) == 0xFFFE)
+    codePoint = REPLACEMENT_CHARACTER;
+  else if (codePoint >= 0xFDD0 && codePoint <= 0xFDEF)
+    codePoint = REPLACEMENT_CHARACTER;
+  return true;
+}
+
+void WriteCodePoint(ostream_wrapper& out, int codePoint) {
+  if (codePoint < 0 || codePoint > 0x10FFFF) {
+    codePoint = REPLACEMENT_CHARACTER;
+  }
+  if (codePoint < 0x7F) {
+    out << static_cast<char>(codePoint);
+  } else if (codePoint < 0x7FF) {
+    out << static_cast<char>(0xC0 | (codePoint >> 6))
+        << static_cast<char>(0x80 | (codePoint & 0x3F));
+  } else if (codePoint < 0xFFFF) {
+    out << static_cast<char>(0xE0 | (codePoint >> 12))
+        << static_cast<char>(0x80 | ((codePoint >> 6) & 0x3F))
+        << static_cast<char>(0x80 | (codePoint & 0x3F));
+  } else {
+    out << static_cast<char>(0xF0 | (codePoint >> 18))
+        << static_cast<char>(0x80 | ((codePoint >> 12) & 0x3F))
+        << static_cast<char>(0x80 | ((codePoint >> 6) & 0x3F))
+        << static_cast<char>(0x80 | (codePoint & 0x3F));
+  }
+}
+
+bool IsValidPlainScalar(const std::string& str, FlowType::value flowType,
+                        bool allowOnlyAscii) {
+  // check against null
+  if (IsNullString(str)) {
+    return false;
+  }
+
+  // check the start
+  const RegEx& start = (flowType == FlowType::Flow ? Exp::PlainScalarInFlow()
+                                                   : Exp::PlainScalar());
+  if (!start.Matches(str)) {
+    return false;
+  }
+
+  // and check the end for plain whitespace (which can't be faithfully kept in a
+  // plain scalar)
+  if (!str.empty() && *str.rbegin() == ' ') {
+    return false;
+  }
+
+  // then check until something is disallowed
+  static const RegEx& disallowed_flow =
+      Exp::EndScalarInFlow() || (Exp::BlankOrBreak() + Exp::Comment()) ||
+      Exp::NotPrintable() || Exp::Utf8_ByteOrderMark() || Exp::Break() ||
+      Exp::Tab();
+  static const RegEx& disallowed_block =
+      Exp::EndScalar() || (Exp::BlankOrBreak() + Exp::Comment()) ||
+      Exp::NotPrintable() || Exp::Utf8_ByteOrderMark() || Exp::Break() ||
+      Exp::Tab();
+  const RegEx& disallowed =
+      flowType == FlowType::Flow ? disallowed_flow : disallowed_block;
+
+  StringCharSource buffer(str.c_str(), str.size());
+  while (buffer) {
+    if (disallowed.Matches(buffer)) {
+      return false;
+    }
+    if (allowOnlyAscii && (0x80 <= static_cast<unsigned char>(buffer[0]))) {
+      return false;
+    }
+    ++buffer;
+  }
+
+  return true;
+}
+
+bool IsValidSingleQuotedScalar(const std::string& str, bool escapeNonAscii) {
+  // TODO: check for non-printable characters?
+  for (std::size_t i = 0; i < str.size(); i++) {
+    if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(str[i]))) {
+      return false;
+    }
+    if (str[i] == '\n') {
+      return false;
+    }
+  }
+  return true;
+}
+
+bool IsValidLiteralScalar(const std::string& str, FlowType::value flowType,
+                          bool escapeNonAscii) {
+  if (flowType == FlowType::Flow) {
+    return false;
+  }
+
+  // TODO: check for non-printable characters?
+  for (std::size_t i = 0; i < str.size(); i++) {
+    if (escapeNonAscii && (0x80 <= static_cast<unsigned char>(str[i]))) {
+      return false;
+    }
+  }
+  return true;
+}
+
+void WriteDoubleQuoteEscapeSequence(ostream_wrapper& out, int codePoint) {
+  static const char hexDigits[] = "0123456789abcdef";
+
+  out << "\\";
+  int digits = 8;
+  if (codePoint < 0xFF) {
+    out << "x";
+    digits = 2;
+  } else if (codePoint < 0xFFFF) {
+    out << "u";
+    digits = 4;
+  } else {
+    out << "U";
+    digits = 8;
+  }
+
+  // Write digits into the escape sequence
+  for (; digits > 0; --digits)
+    out << hexDigits[(codePoint >> (4 * (digits - 1))) & 0xF];
+}
+
+bool WriteAliasName(ostream_wrapper& out, const std::string& str) {
+  int codePoint;
+  for (std::string::const_iterator i = str.begin();
+       GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+    if (!IsAnchorChar(codePoint)) {
+      return false;
+    }
+
+    WriteCodePoint(out, codePoint);
+  }
+  return true;
+}
+}
+
+StringFormat::value ComputeStringFormat(const std::string& str,
+                                        EMITTER_MANIP strFormat,
+                                        FlowType::value flowType,
+                                        bool escapeNonAscii) {
+  switch (strFormat) {
+    case Auto:
+      if (IsValidPlainScalar(str, flowType, escapeNonAscii)) {
+        return StringFormat::Plain;
+      }
+      return StringFormat::DoubleQuoted;
+    case SingleQuoted:
+      if (IsValidSingleQuotedScalar(str, escapeNonAscii)) {
+        return StringFormat::SingleQuoted;
+      }
+      return StringFormat::DoubleQuoted;
+    case DoubleQuoted:
+      return StringFormat::DoubleQuoted;
+    case Literal:
+      if (IsValidLiteralScalar(str, flowType, escapeNonAscii)) {
+        return StringFormat::Literal;
+      }
+      return StringFormat::DoubleQuoted;
+    default:
+      break;
+  }
+
+  return StringFormat::DoubleQuoted;
+}
+
+bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str) {
+  out << "'";
+  int codePoint;
+  for (std::string::const_iterator i = str.begin();
+       GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+    if (codePoint == '\n') {
+      return false;  // We can't handle a new line and the attendant indentation
+                     // yet
+    }
+
+    if (codePoint == '\'') {
+      out << "''";
+    } else {
+      WriteCodePoint(out, codePoint);
+    }
+  }
+  out << "'";
+  return true;
+}
+
+bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
+                             bool escapeNonAscii) {
+  out << "\"";
+  int codePoint;
+  for (std::string::const_iterator i = str.begin();
+       GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+    switch (codePoint) {
+      case '\"':
+        out << "\\\"";
+        break;
+      case '\\':
+        out << "\\\\";
+        break;
+      case '\n':
+        out << "\\n";
+        break;
+      case '\t':
+        out << "\\t";
+        break;
+      case '\r':
+        out << "\\r";
+        break;
+      case '\b':
+        out << "\\b";
+        break;
+      default:
+        if (codePoint < 0x20 ||
+            (codePoint >= 0x80 &&
+             codePoint <= 0xA0)) {  // Control characters and non-breaking space
+          WriteDoubleQuoteEscapeSequence(out, codePoint);
+        } else if (codePoint == 0xFEFF) {  // Byte order marks (ZWNS) should be
+                                           // escaped (YAML 1.2, sec. 5.2)
+          WriteDoubleQuoteEscapeSequence(out, codePoint);
+        } else if (escapeNonAscii && codePoint > 0x7E) {
+          WriteDoubleQuoteEscapeSequence(out, codePoint);
+        } else {
+          WriteCodePoint(out, codePoint);
+        }
+    }
+  }
+  out << "\"";
+  return true;
+}
+
+bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
+                        std::size_t indent) {
+  out << "|\n";
+  out << IndentTo(indent);
+  int codePoint;
+  for (std::string::const_iterator i = str.begin();
+       GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+    if (codePoint == '\n') {
+      out << "\n" << IndentTo(indent);
+    } else {
+      WriteCodePoint(out, codePoint);
+    }
+  }
+  return true;
+}
+
+bool WriteChar(ostream_wrapper& out, char ch) {
+  if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')) {
+    out << ch;
+  } else if (ch == '\"') {
+    out << "\"\\\"\"";
+  } else if (ch == '\t') {
+    out << "\"\\t\"";
+  } else if (ch == '\n') {
+    out << "\"\\n\"";
+  } else if (ch == '\b') {
+    out << "\"\\b\"";
+  } else if (ch == '\\') {
+    out << "\"\\\\\"";
+  } else if ((0x20 <= ch && ch <= 0x7e) || ch == ' ') {
+    out << "\"" << ch << "\"";
+  } else {
+    out << "\"";
+    WriteDoubleQuoteEscapeSequence(out, ch);
+    out << "\"";
+  }
+  return true;
+}
+
+bool WriteComment(ostream_wrapper& out, const std::string& str,
+                  std::size_t postCommentIndent) {
+  const std::size_t curIndent = out.col();
+  out << "#" << Indentation(postCommentIndent);
+  out.set_comment();
+  int codePoint;
+  for (std::string::const_iterator i = str.begin();
+       GetNextCodePointAndAdvance(codePoint, i, str.end());) {
+    if (codePoint == '\n') {
+      out << "\n" << IndentTo(curIndent) << "#"
+          << Indentation(postCommentIndent);
+      out.set_comment();
+    } else {
+      WriteCodePoint(out, codePoint);
+    }
+  }
+  return true;
+}
+
+bool WriteAlias(ostream_wrapper& out, const std::string& str) {
+  out << "*";
+  return WriteAliasName(out, str);
+}
+
+bool WriteAnchor(ostream_wrapper& out, const std::string& str) {
+  out << "&";
+  return WriteAliasName(out, str);
+}
+
+bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim) {
+  out << (verbatim ? "!<" : "!");
+  StringCharSource buffer(str.c_str(), str.size());
+  const RegEx& reValid = verbatim ? Exp::URI() : Exp::Tag();
+  while (buffer) {
+    int n = reValid.Match(buffer);
+    if (n <= 0) {
+      return false;
+    }
+
+    while (--n >= 0) {
+      out << buffer[0];
+      ++buffer;
+    }
+  }
+  if (verbatim) {
+    out << ">";
+  }
+  return true;
+}
+
+bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
+                        const std::string& tag) {
+  out << "!";
+  StringCharSource prefixBuffer(prefix.c_str(), prefix.size());
+  while (prefixBuffer) {
+    int n = Exp::URI().Match(prefixBuffer);
+    if (n <= 0) {
+      return false;
+    }
+
+    while (--n >= 0) {
+      out << prefixBuffer[0];
+      ++prefixBuffer;
+    }
+  }
+
+  out << "!";
+  StringCharSource tagBuffer(tag.c_str(), tag.size());
+  while (tagBuffer) {
+    int n = Exp::Tag().Match(tagBuffer);
+    if (n <= 0) {
+      return false;
+    }
+
+    while (--n >= 0) {
+      out << tagBuffer[0];
+      ++tagBuffer;
+    }
+  }
+  return true;
+}
+
+bool WriteBinary(ostream_wrapper& out, const Binary& binary) {
+  WriteDoubleQuotedString(out, EncodeBase64(binary.data(), binary.size()),
+                          false);
+  return true;
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterutils.h
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterutils.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterutils.h
new file mode 100644
index 0000000..6cc7319
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitterutils.h
@@ -0,0 +1,50 @@
+#ifndef EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) ||                                            \
+    (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+     (__GNUC__ >= 4))  // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <string>
+
+#include "emitterstate.h"
+#include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/ostream_wrapper.h"
+
+namespace YAML {
+class ostream_wrapper;
+}  // namespace YAML
+
+namespace YAML {
+class Binary;
+
+struct StringFormat {
+  enum value { Plain, SingleQuoted, DoubleQuoted, Literal };
+};
+
+namespace Utils {
+StringFormat::value ComputeStringFormat(const std::string& str,
+                                        EMITTER_MANIP strFormat,
+                                        FlowType::value flowType,
+                                        bool escapeNonAscii);
+
+bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str);
+bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
+                             bool escapeNonAscii);
+bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
+                        std::size_t indent);
+bool WriteChar(ostream_wrapper& out, char ch);
+bool WriteComment(ostream_wrapper& out, const std::string& str,
+                  std::size_t postCommentIndent);
+bool WriteAlias(ostream_wrapper& out, const std::string& str);
+bool WriteAnchor(ostream_wrapper& out, const std::string& str);
+bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim);
+bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
+                        const std::string& tag);
+bool WriteBinary(ostream_wrapper& out, const Binary& binary);
+}
+}
+
+#endif  // EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exceptions.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exceptions.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exceptions.cpp
new file mode 100644
index 0000000..9b6d891
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exceptions.cpp
@@ -0,0 +1,31 @@
+#include "yaml-cpp/exceptions.h"
+
+// This is here for compatibility with older versions of Visual Studio
+// which don't support noexcept
+#ifdef _MSC_VER
+    #define YAML_CPP_NOEXCEPT _NOEXCEPT
+#else
+    #define YAML_CPP_NOEXCEPT noexcept
+#endif
+
+namespace YAML {
+
+// These destructors are defined out-of-line so the vtable is only emitted once.
+Exception::~Exception() YAML_CPP_NOEXCEPT {}
+ParserException::~ParserException() YAML_CPP_NOEXCEPT {}
+RepresentationException::~RepresentationException() YAML_CPP_NOEXCEPT {}
+InvalidScalar::~InvalidScalar() YAML_CPP_NOEXCEPT {}
+KeyNotFound::~KeyNotFound() YAML_CPP_NOEXCEPT {}
+InvalidNode::~InvalidNode() YAML_CPP_NOEXCEPT {}
+BadConversion::~BadConversion() YAML_CPP_NOEXCEPT {}
+BadDereference::~BadDereference() YAML_CPP_NOEXCEPT {}
+BadSubscript::~BadSubscript() YAML_CPP_NOEXCEPT {}
+BadPushback::~BadPushback() YAML_CPP_NOEXCEPT {}
+BadInsert::~BadInsert() YAML_CPP_NOEXCEPT {}
+EmitterException::~EmitterException() YAML_CPP_NOEXCEPT {}
+BadFile::~BadFile() YAML_CPP_NOEXCEPT {}
+}
+
+#undef YAML_CPP_NOEXCEPT
+
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exp.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exp.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exp.cpp
new file mode 100644
index 0000000..695440a
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exp.cpp
@@ -0,0 +1,136 @@
+#include <sstream>
+
+#include "exp.h"
+#include "stream.h"
+#include "yaml-cpp/exceptions.h"  // IWYU pragma: keep
+
+namespace YAML {
+struct Mark;
+}  // namespace YAML
+
+namespace YAML {
+namespace Exp {
+unsigned ParseHex(const std::string& str, const Mark& mark) {
+  unsigned value = 0;
+  for (std::size_t i = 0; i < str.size(); i++) {
+    char ch = str[i];
+    int digit = 0;
+    if ('a' <= ch && ch <= 'f')
+      digit = ch - 'a' + 10;
+    else if ('A' <= ch && ch <= 'F')
+      digit = ch - 'A' + 10;
+    else if ('0' <= ch && ch <= '9')
+      digit = ch - '0';
+    else
+      throw ParserException(mark, ErrorMsg::INVALID_HEX);
+
+    value = (value << 4) + digit;
+  }
+
+  return value;
+}
+
+std::string Str(unsigned ch) { return std::string(1, static_cast<char>(ch)); }
+
+// Escape
+// . Translates the next 'codeLength' characters into a hex number and returns
+// the result.
+// . Throws if it's not actually hex.
+std::string Escape(Stream& in, int codeLength) {
+  // grab string
+  std::string str;
+  for (int i = 0; i < codeLength; i++)
+    str += in.get();
+
+  // get the value
+  unsigned value = ParseHex(str, in.mark());
+
+  // legal unicode?
+  if ((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF) {
+    std::stringstream msg;
+    msg << ErrorMsg::INVALID_UNICODE << value;
+    throw ParserException(in.mark(), msg.str());
+  }
+
+  // now break it up into chars
+  if (value <= 0x7F)
+    return Str(value);
+  else if (value <= 0x7FF)
+    return Str(0xC0 + (value >> 6)) + Str(0x80 + (value & 0x3F));
+  else if (value <= 0xFFFF)
+    return Str(0xE0 + (value >> 12)) + Str(0x80 + ((value >> 6) & 0x3F)) +
+           Str(0x80 + (value & 0x3F));
+  else
+    return Str(0xF0 + (value >> 18)) + Str(0x80 + ((value >> 12) & 0x3F)) +
+           Str(0x80 + ((value >> 6) & 0x3F)) + Str(0x80 + (value & 0x3F));
+}
+
+// Escape
+// . Escapes the sequence starting 'in' (it must begin with a '\' or single
+// quote)
+//   and returns the result.
+// . Throws if it's an unknown escape character.
+std::string Escape(Stream& in) {
+  // eat slash
+  char escape = in.get();
+
+  // switch on escape character
+  char ch = in.get();
+
+  // first do single quote, since it's easier
+  if (escape == '\'' && ch == '\'')
+    return "\'";
+
+  // now do the slash (we're not gonna check if it's a slash - you better pass
+  // one!)
+  switch (ch) {
+    case '0':
+      return std::string(1, '\x00');
+    case 'a':
+      return "\x07";
+    case 'b':
+      return "\x08";
+    case 't':
+    case '\t':
+      return "\x09";
+    case 'n':
+      return "\x0A";
+    case 'v':
+      return "\x0B";
+    case 'f':
+      return "\x0C";
+    case 'r':
+      return "\x0D";
+    case 'e':
+      return "\x1B";
+    case ' ':
+      return "\x20";
+    case '\"':
+      return "\"";
+    case '\'':
+      return "\'";
+    case '\\':
+      return "\\";
+    case '/':
+      return "/";
+    case 'N':
+      return "\x85";
+    case '_':
+      return "\xA0";
+    case 'L':
+      return "\xE2\x80\xA8";  // LS (#x2028)
+    case 'P':
+      return "\xE2\x80\xA9";  // PS (#x2029)
+    case 'x':
+      return Escape(in, 2);
+    case 'u':
+      return Escape(in, 4);
+    case 'U':
+      return Escape(in, 8);
+  }
+
+  std::stringstream msg;
+  throw ParserException(in.mark(), std::string(ErrorMsg::INVALID_ESCAPE) + ch);
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exp.h
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exp.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exp.h
new file mode 100644
index 0000000..50b0220
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/exp.h
@@ -0,0 +1,222 @@
+#ifndef EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) ||                                            \
+    (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+     (__GNUC__ >= 4))  // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <ios>
+#include <string>
+
+#include "regex_yaml.h"
+#include "stream.h"
+
+namespace YAML {
+////////////////////////////////////////////////////////////////////////////////
+// Here we store a bunch of expressions for matching different parts of the
+// file.
+
+namespace Exp {
+// misc
+inline const RegEx& Empty() {
+  static const RegEx e;
+  return e;
+}
+inline const RegEx& Space() {
+  static const RegEx e = RegEx(' ');
+  return e;
+}
+inline const RegEx& Tab() {
+  static const RegEx e = RegEx('\t');
+  return e;
+}
+inline const RegEx& Blank() {
+  static const RegEx e = Space() || Tab();
+  return e;
+}
+inline const RegEx& Break() {
+  static const RegEx e = RegEx('\n') || RegEx("\r\n");
+  return e;
+}
+inline const RegEx& BlankOrBreak() {
+  static const RegEx e = Blank() || Break();
+  return e;
+}
+inline const RegEx& Digit() {
+  static const RegEx e = RegEx('0', '9');
+  return e;
+}
+inline const RegEx& Alpha() {
+  static const RegEx e = RegEx('a', 'z') || RegEx('A', 'Z');
+  return e;
+}
+inline const RegEx& AlphaNumeric() {
+  static const RegEx e = Alpha() || Digit();
+  return e;
+}
+inline const RegEx& Word() {
+  static const RegEx e = AlphaNumeric() || RegEx('-');
+  return e;
+}
+inline const RegEx& Hex() {
+  static const RegEx e = Digit() || RegEx('A', 'F') || RegEx('a', 'f');
+  return e;
+}
+// Valid Unicode code points that are not part of c-printable (YAML 1.2, sec.
+// 5.1)
+inline const RegEx& NotPrintable() {
+  static const RegEx e =
+      RegEx(0) ||
+      RegEx("\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x7F", REGEX_OR) ||
+      RegEx(0x0E, 0x1F) ||
+      (RegEx('\xC2') + (RegEx('\x80', '\x84') || RegEx('\x86', '\x9F')));
+  return e;
+}
+inline const RegEx& Utf8_ByteOrderMark() {
+  static const RegEx e = RegEx("\xEF\xBB\xBF");
+  return e;
+}
+
+// actual tags
+
+inline const RegEx& DocStart() {
+  static const RegEx e = RegEx("---") + (BlankOrBreak() || RegEx());
+  return e;
+}
+inline const RegEx& DocEnd() {
+  static const RegEx e = RegEx("...") + (BlankOrBreak() || RegEx());
+  return e;
+}
+inline const RegEx& DocIndicator() {
+  static const RegEx e = DocStart() || DocEnd();
+  return e;
+}
+inline const RegEx& BlockEntry() {
+  static const RegEx e = RegEx('-') + (BlankOrBreak() || RegEx());
+  return e;
+}
+inline const RegEx& Key() {
+  static const RegEx e = RegEx('?') + BlankOrBreak();
+  return e;
+}
+inline const RegEx& KeyInFlow() {
+  static const RegEx e = RegEx('?') + BlankOrBreak();
+  return e;
+}
+inline const RegEx& Value() {
+  static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx());
+  return e;
+}
+inline const RegEx& ValueInFlow() {
+  static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx(",}", REGEX_OR));
+  return e;
+}
+inline const RegEx& ValueInJSONFlow() {
+  static const RegEx e = RegEx(':');
+  return e;
+}
+inline const RegEx Comment() {
+  static const RegEx e = RegEx('#');
+  return e;
+}
+inline const RegEx& Anchor() {
+  static const RegEx e = !(RegEx("[]{},", REGEX_OR) || BlankOrBreak());
+  return e;
+}
+inline const RegEx& AnchorEnd() {
+  static const RegEx e = RegEx("?:,]}%@`", REGEX_OR) || BlankOrBreak();
+  return e;
+}
+inline const RegEx& URI() {
+  static const RegEx e = Word() || RegEx("#;/?:@&=+$,_.!~*'()[]", REGEX_OR) ||
+                         (RegEx('%') + Hex() + Hex());
+  return e;
+}
+inline const RegEx& Tag() {
+  static const RegEx e = Word() || RegEx("#;/?:@&=+$_.~*'", REGEX_OR) ||
+                         (RegEx('%') + Hex() + Hex());
+  return e;
+}
+
+// Plain scalar rules:
+// . Cannot start with a blank.
+// . Can never start with any of , [ ] { } # & * ! | > \' \" % @ `
+// . In the block context - ? : must be not be followed with a space.
+// . In the flow context ? is illegal and : and - must not be followed with a
+// space.
+inline const RegEx& PlainScalar() {
+  static const RegEx e =
+      !(BlankOrBreak() || RegEx(",[]{}#&*!|>\'\"%@`", REGEX_OR) ||
+        (RegEx("-?:", REGEX_OR) + (BlankOrBreak() || RegEx())));
+  return e;
+}
+inline const RegEx& PlainScalarInFlow() {
+  static const RegEx e =
+      !(BlankOrBreak() || RegEx("?,[]{}#&*!|>\'\"%@`", REGEX_OR) ||
+        (RegEx("-:", REGEX_OR) + Blank()));
+  return e;
+}
+inline const RegEx& EndScalar() {
+  static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx());
+  return e;
+}
+inline const RegEx& EndScalarInFlow() {
+  static const RegEx e =
+      (RegEx(':') + (BlankOrBreak() || RegEx() || RegEx(",]}", REGEX_OR))) ||
+      RegEx(",?[]{}", REGEX_OR);
+  return e;
+}
+
+inline const RegEx& ScanScalarEndInFlow() {
+  static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment()));
+  return e;
+}
+
+inline const RegEx& ScanScalarEnd() {
+  static const RegEx e = EndScalar() || (BlankOrBreak() + Comment());
+  return e;
+}
+inline const RegEx& EscSingleQuote() {
+  static const RegEx e = RegEx("\'\'");
+  return e;
+}
+inline const RegEx& EscBreak() {
+  static const RegEx e = RegEx('\\') + Break();
+  return e;
+}
+
+inline const RegEx& ChompIndicator() {
+  static const RegEx e = RegEx("+-", REGEX_OR);
+  return e;
+}
+inline const RegEx& Chomp() {
+  static const RegEx e = (ChompIndicator() + Digit()) ||
+                         (Digit() + ChompIndicator()) || ChompIndicator() ||
+                         Digit();
+  return e;
+}
+
+// and some functions
+std::string Escape(Stream& in);
+}
+
+namespace Keys {
+const char Directive = '%';
+const char FlowSeqStart = '[';
+const char FlowSeqEnd = ']';
+const char FlowMapStart = '{';
+const char FlowMapEnd = '}';
+const char FlowEntry = ',';
+const char Alias = '*';
+const char Anchor = '&';
+const char Tag = '!';
+const char LiteralScalar = '|';
+const char FoldedScalar = '>';
+const char VerbatimTagStart = '<';
+const char VerbatimTagEnd = '>';
+}
+}
+
+#endif  // EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/indentation.h
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/indentation.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/indentation.h
new file mode 100644
index 0000000..1a2ccae
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/indentation.h
@@ -0,0 +1,41 @@
+#ifndef INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) ||                                            \
+    (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+     (__GNUC__ >= 4))  // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <iostream>
+#include <cstddef>
+
+#include "yaml-cpp/ostream_wrapper.h"
+
+namespace YAML {
+struct Indentation {
+  Indentation(std::size_t n_) : n(n_) {}
+  std::size_t n;
+};
+
+inline ostream_wrapper& operator<<(ostream_wrapper& out,
+                                   const Indentation& indent) {
+  for (std::size_t i = 0; i < indent.n; i++)
+    out << ' ';
+  return out;
+}
+
+struct IndentTo {
+  IndentTo(std::size_t n_) : n(n_) {}
+  std::size_t n;
+};
+
+inline ostream_wrapper& operator<<(ostream_wrapper& out,
+                                   const IndentTo& indent) {
+  while (out.col() < indent.n)
+    out << ' ';
+  return out;
+}
+}
+
+#endif  // INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/memory.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/memory.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/memory.cpp
new file mode 100644
index 0000000..e5f8a9d
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/memory.cpp
@@ -0,0 +1,26 @@
+#include "yaml-cpp/node/detail/memory.h"
+#include "yaml-cpp/node/detail/node.h"  // IWYU pragma: keep
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+
+void memory_holder::merge(memory_holder& rhs) {
+  if (m_pMemory == rhs.m_pMemory)
+    return;
+
+  m_pMemory->merge(*rhs.m_pMemory);
+  rhs.m_pMemory = m_pMemory;
+}
+
+node& memory::create_node() {
+  shared_node pNode(new node);
+  m_nodes.insert(pNode);
+  return *pNode;
+}
+
+void memory::merge(const memory& rhs) {
+  m_nodes.insert(rhs.m_nodes.begin(), rhs.m_nodes.end());
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/node.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/node.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/node.cpp
new file mode 100644
index 0000000..2088e13
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/node.cpp
@@ -0,0 +1,12 @@
+#include "yaml-cpp/node/node.h"
+#include "nodebuilder.h"
+#include "nodeevents.h"
+
+namespace YAML {
+Node Clone(const Node& node) {
+  NodeEvents events(node);
+  NodeBuilder builder;
+  events.Emit(builder);
+  return builder.Root();
+}
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/node_data.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/node_data.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/node_data.cpp
new file mode 100644
index 0000000..77cd465
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/node_data.cpp
@@ -0,0 +1,300 @@
+#include <assert.h>
+#include <iterator>
+#include <sstream>
+
+#include "yaml-cpp/exceptions.h"
+#include "yaml-cpp/node/detail/memory.h"
+#include "yaml-cpp/node/detail/node.h"  // IWYU pragma: keep
+#include "yaml-cpp/node/detail/node_data.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+namespace detail {
+
+std::string node_data::empty_scalar;
+
+node_data::node_data()
+    : m_isDefined(false),
+      m_mark(Mark::null_mark()),
+      m_type(NodeType::Null),
+      m_style(EmitterStyle::Default),
+      m_seqSize(0) {}
+
+void node_data::mark_defined() {
+  if (m_type == NodeType::Undefined)
+    m_type = NodeType::Null;
+  m_isDefined = true;
+}
+
+void node_data::set_mark(const Mark& mark) { m_mark = mark; }
+
+void node_data::set_type(NodeType::value type) {
+  if (type == NodeType::Undefined) {
+    m_type = type;
+    m_isDefined = false;
+    return;
+  }
+
+  m_isDefined = true;
+  if (type == m_type)
+    return;
+
+  m_type = type;
+
+  switch (m_type) {
+    case NodeType::Null:
+      break;
+    case NodeType::Scalar:
+      m_scalar.clear();
+      break;
+    case NodeType::Sequence:
+      reset_sequence();
+      break;
+    case NodeType::Map:
+      reset_map();
+      break;
+    case NodeType::Undefined:
+      assert(false);
+      break;
+  }
+}
+
+void node_data::set_tag(const std::string& tag) { m_tag = tag; }
+
+void node_data::set_style(EmitterStyle::value style) { m_style = style; }
+
+void node_data::set_null() {
+  m_isDefined = true;
+  m_type = NodeType::Null;
+}
+
+void node_data::set_scalar(const std::string& scalar) {
+  m_isDefined = true;
+  m_type = NodeType::Scalar;
+  m_scalar = scalar;
+}
+
+// size/iterator
+std::size_t node_data::size() const {
+  if (!m_isDefined)
+    return 0;
+
+  switch (m_type) {
+    case NodeType::Sequence:
+      compute_seq_size();
+      return m_seqSize;
+    case NodeType::Map:
+      compute_map_size();
+      return m_map.size() - m_undefinedPairs.size();
+    default:
+      return 0;
+  }
+  return 0;
+}
+
+void node_data::compute_seq_size() const {
+  while (m_seqSize < m_sequence.size() && m_sequence[m_seqSize]->is_defined())
+    m_seqSize++;
+}
+
+void node_data::compute_map_size() const {
+  kv_pairs::iterator it = m_undefinedPairs.begin();
+  while (it != m_undefinedPairs.end()) {
+    kv_pairs::iterator jt = std::next(it);
+    if (it->first->is_defined() && it->second->is_defined())
+      m_undefinedPairs.erase(it);
+    it = jt;
+  }
+}
+
+const_node_iterator node_data::begin() const {
+  if (!m_isDefined)
+    return const_node_iterator();
+
+  switch (m_type) {
+    case NodeType::Sequence:
+      return const_node_iterator(m_sequence.begin());
+    case NodeType::Map:
+      return const_node_iterator(m_map.begin(), m_map.end());
+    default:
+      return const_node_iterator();
+  }
+}
+
+node_iterator node_data::begin() {
+  if (!m_isDefined)
+    return node_iterator();
+
+  switch (m_type) {
+    case NodeType::Sequence:
+      return node_iterator(m_sequence.begin());
+    case NodeType::Map:
+      return node_iterator(m_map.begin(), m_map.end());
+    default:
+      return node_iterator();
+  }
+}
+
+const_node_iterator node_data::end() const {
+  if (!m_isDefined)
+    return const_node_iterator();
+
+  switch (m_type) {
+    case NodeType::Sequence:
+      return const_node_iterator(m_sequence.end());
+    case NodeType::Map:
+      return const_node_iterator(m_map.end(), m_map.end());
+    default:
+      return const_node_iterator();
+  }
+}
+
+node_iterator node_data::end() {
+  if (!m_isDefined)
+    return node_iterator();
+
+  switch (m_type) {
+    case NodeType::Sequence:
+      return node_iterator(m_sequence.end());
+    case NodeType::Map:
+      return node_iterator(m_map.end(), m_map.end());
+    default:
+      return node_iterator();
+  }
+}
+
+// sequence
+void node_data::push_back(node& node, shared_memory_holder /* pMemory */) {
+  if (m_type == NodeType::Undefined || m_type == NodeType::Null) {
+    m_type = NodeType::Sequence;
+    reset_sequence();
+  }
+
+  if (m_type != NodeType::Sequence)
+    throw BadPushback();
+
+  m_sequence.push_back(&node);
+}
+
+void node_data::insert(node& key, node& value, shared_memory_holder pMemory) {
+  switch (m_type) {
+    case NodeType::Map:
+      break;
+    case NodeType::Undefined:
+    case NodeType::Null:
+    case NodeType::Sequence:
+      convert_to_map(pMemory);
+      break;
+    case NodeType::Scalar:
+      throw BadSubscript();
+  }
+
+  insert_map_pair(key, value);
+}
+
+// indexing
+node* node_data::get(node& key, shared_memory_holder /* pMemory */) const {
+  if (m_type != NodeType::Map) {
+    return NULL;
+  }
+
+  for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+    if (it->first->is(key))
+      return it->second;
+  }
+
+  return NULL;
+}
+
+node& node_data::get(node& key, shared_memory_holder pMemory) {
+  switch (m_type) {
+    case NodeType::Map:
+      break;
+    case NodeType::Undefined:
+    case NodeType::Null:
+    case NodeType::Sequence:
+      convert_to_map(pMemory);
+      break;
+    case NodeType::Scalar:
+      throw BadSubscript();
+  }
+
+  for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
+    if (it->first->is(key))
+      return *it->second;
+  }
+
+  node& value = pMemory->create_node();
+  insert_map_pair(key, value);
+  return value;
+}
+
+bool node_data::remove(node& key, shared_memory_holder /* pMemory */) {
+  if (m_type != NodeType::Map)
+    return false;
+
+  for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) {
+    if (it->first->is(key)) {
+      m_map.erase(it);
+      return true;
+    }
+  }
+
+  return false;
+}
+
+void node_data::reset_sequence() {
+  m_sequence.clear();
+  m_seqSize = 0;
+}
+
+void node_data::reset_map() {
+  m_map.clear();
+  m_undefinedPairs.clear();
+}
+
+void node_data::insert_map_pair(node& key, node& value) {
+  m_map.emplace_back(&key, &value);
+
+  if (!key.is_defined() || !value.is_defined())
+    m_undefinedPairs.emplace_back(&key, &value);
+}
+
+void node_data::convert_to_map(shared_memory_holder pMemory) {
+  switch (m_type) {
+    case NodeType::Undefined:
+    case NodeType::Null:
+      reset_map();
+      m_type = NodeType::Map;
+      break;
+    case NodeType::Sequence:
+      convert_sequence_to_map(pMemory);
+      break;
+    case NodeType::Map:
+      break;
+    case NodeType::Scalar:
+      assert(false);
+      break;
+  }
+}
+
+void node_data::convert_sequence_to_map(shared_memory_holder pMemory) {
+  assert(m_type == NodeType::Sequence);
+
+  reset_map();
+  for (std::size_t i = 0; i < m_sequence.size(); i++) {
+    std::stringstream stream;
+    stream << i;
+
+    node& key = pMemory->create_node();
+    key.set_scalar(stream.str());
+    insert_map_pair(key, *m_sequence[i]);
+  }
+
+  reset_sequence();
+  m_type = NodeType::Map;
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodebuilder.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodebuilder.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodebuilder.cpp
new file mode 100644
index 0000000..093d2ef
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodebuilder.cpp
@@ -0,0 +1,130 @@
+#include <assert.h>
+#include <cassert>
+
+#include "nodebuilder.h"
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/node/impl.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+struct Mark;
+
+NodeBuilder::NodeBuilder()
+    : m_pMemory(new detail::memory_holder), m_pRoot(0), m_mapDepth(0) {
+  m_anchors.push_back(0);  // since the anchors start at 1
+}
+
+NodeBuilder::~NodeBuilder() {}
+
+Node NodeBuilder::Root() {
+  if (!m_pRoot)
+    return Node();
+
+  return Node(*m_pRoot, m_pMemory);
+}
+
+void NodeBuilder::OnDocumentStart(const Mark&) {}
+
+void NodeBuilder::OnDocumentEnd() {}
+
+void NodeBuilder::OnNull(const Mark& mark, anchor_t anchor) {
+  detail::node& node = Push(mark, anchor);
+  node.set_null();
+  Pop();
+}
+
+void NodeBuilder::OnAlias(const Mark& /* mark */, anchor_t anchor) {
+  detail::node& node = *m_anchors[anchor];
+  Push(node);
+  Pop();
+}
+
+void NodeBuilder::OnScalar(const Mark& mark, const std::string& tag,
+                           anchor_t anchor, const std::string& value) {
+  detail::node& node = Push(mark, anchor);
+  node.set_scalar(value);
+  node.set_tag(tag);
+  Pop();
+}
+
+void NodeBuilder::OnSequenceStart(const Mark& mark, const std::string& tag,
+                                  anchor_t anchor, EmitterStyle::value style) {
+  detail::node& node = Push(mark, anchor);
+  node.set_tag(tag);
+  node.set_type(NodeType::Sequence);
+  node.set_style(style);
+}
+
+void NodeBuilder::OnSequenceEnd() { Pop(); }
+
+void NodeBuilder::OnMapStart(const Mark& mark, const std::string& tag,
+                             anchor_t anchor, EmitterStyle::value style) {
+  detail::node& node = Push(mark, anchor);
+  node.set_type(NodeType::Map);
+  node.set_tag(tag);
+  node.set_style(style);
+  m_mapDepth++;
+}
+
+void NodeBuilder::OnMapEnd() {
+  assert(m_mapDepth > 0);
+  m_mapDepth--;
+  Pop();
+}
+
+detail::node& NodeBuilder::Push(const Mark& mark, anchor_t anchor) {
+  detail::node& node = m_pMemory->create_node();
+  node.set_mark(mark);
+  RegisterAnchor(anchor, node);
+  Push(node);
+  return node;
+}
+
+void NodeBuilder::Push(detail::node& node) {
+  const bool needsKey =
+      (!m_stack.empty() && m_stack.back()->type() == NodeType::Map &&
+       m_keys.size() < m_mapDepth);
+
+  m_stack.push_back(&node);
+  if (needsKey)
+    m_keys.push_back(PushedKey(&node, false));
+}
+
+void NodeBuilder::Pop() {
+  assert(!m_stack.empty());
+  if (m_stack.size() == 1) {
+    m_pRoot = m_stack[0];
+    m_stack.pop_back();
+    return;
+  }
+
+  detail::node& node = *m_stack.back();
+  m_stack.pop_back();
+
+  detail::node& collection = *m_stack.back();
+
+  if (collection.type() == NodeType::Sequence) {
+    collection.push_back(node, m_pMemory);
+  } else if (collection.type() == NodeType::Map) {
+    assert(!m_keys.empty());
+    PushedKey& key = m_keys.back();
+    if (key.second) {
+      collection.insert(*key.first, node, m_pMemory);
+      m_keys.pop_back();
+    } else {
+      key.second = true;
+    }
+  } else {
+    assert(false);
+    m_stack.clear();
+  }
+}
+
+void NodeBuilder::RegisterAnchor(anchor_t anchor, detail::node& node) {
+  if (anchor) {
+    assert(anchor == m_anchors.size());
+    m_anchors.push_back(&node);
+  }
+}
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodebuilder.h
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodebuilder.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodebuilder.h
new file mode 100644
index 0000000..a6a47f0
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodebuilder.h
@@ -0,0 +1,70 @@
+#ifndef NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) ||                                            \
+    (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+     (__GNUC__ >= 4))  // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <vector>
+
+#include "yaml-cpp/anchor.h"
+#include "yaml-cpp/emitterstyle.h"
+#include "yaml-cpp/eventhandler.h"
+#include "yaml-cpp/node/ptr.h"
+
+namespace YAML {
+namespace detail {
+class node;
+}  // namespace detail
+struct Mark;
+}  // namespace YAML
+
+namespace YAML {
+class Node;
+
+class NodeBuilder : public EventHandler {
+ public:
+  NodeBuilder();
+  virtual ~NodeBuilder();
+
+  Node Root();
+
+  virtual void OnDocumentStart(const Mark& mark);
+  virtual void OnDocumentEnd();
+
+  virtual void OnNull(const Mark& mark, anchor_t anchor);
+  virtual void OnAlias(const Mark& mark, anchor_t anchor);
+  virtual void OnScalar(const Mark& mark, const std::string& tag,
+                        anchor_t anchor, const std::string& value);
+
+  virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
+                               anchor_t anchor, EmitterStyle::value style);
+  virtual void OnSequenceEnd();
+
+  virtual void OnMapStart(const Mark& mark, const std::string& tag,
+                          anchor_t anchor, EmitterStyle::value style);
+  virtual void OnMapEnd();
+
+ private:
+  detail::node& Push(const Mark& mark, anchor_t anchor);
+  void Push(detail::node& node);
+  void Pop();
+  void RegisterAnchor(anchor_t anchor, detail::node& node);
+
+ private:
+  detail::shared_memory_holder m_pMemory;
+  detail::node* m_pRoot;
+
+  typedef std::vector<detail::node*> Nodes;
+  Nodes m_stack;
+  Nodes m_anchors;
+
+  typedef std::pair<detail::node*, bool> PushedKey;
+  std::vector<PushedKey> m_keys;
+  std::size_t m_mapDepth;
+};
+}
+
+#endif  // NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodeevents.cpp
----------------------------------------------------------------------
diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodeevents.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodeevents.cpp
new file mode 100644
index 0000000..82261fe
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/nodeevents.cpp
@@ -0,0 +1,101 @@
+#include "nodeevents.h"
+#include "yaml-cpp/eventhandler.h"
+#include "yaml-cpp/mark.h"
+#include "yaml-cpp/node/detail/node.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
+#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/node/type.h"
+
+namespace YAML {
+void NodeEvents::AliasManager::RegisterReference(const detail::node& node) {
+  m_anchorByIdentity.insert(std::make_pair(node.ref(), _CreateNewAnchor()));
+}
+
+anchor_t NodeEvents::AliasManager::LookupAnchor(
+    const detail::node& node) const {
+  AnchorByIdentity::const_iterator it = m_anchorByIdentity.find(node.ref());
+  if (it == m_anchorByIdentity.end())
+    return 0;
+  return it->second;
+}
+
+NodeEvents::NodeEvents(const Node& node)
+    : m_pMemory(node.m_pMemory), m_root(node.m_pNode) {
+  if (m_root)
+    Setup(*m_root);
+}
+
+void NodeEvents::Setup(const detail::node& node) {
+  int& refCount = m_refCount[node.ref()];
+  refCount++;
+  if (refCount > 1)
+    return;
+
+  if (node.type() == NodeType::Sequence) {
+    for (detail::const_node_iterator it = node.begin(); it != node.end(); ++it)
+      Setup(**it);
+  } else if (node.type() == NodeType::Map) {
+    for (detail::const_node_iterator it = node.begin(); it != node.end();
+         ++it) {
+      Setup(*it->first);
+      Setup(*it->second);
+    }
+  }
+}
+
+void NodeEvents::Emit(EventHandler& handler) {
+  AliasManager am;
+
+  handler.OnDocumentStart(Mark());
+  if (m_root)
+    Emit(*m_root, handler, am);
+  handler.OnDocumentEnd();
+}
+
+void NodeEvents::Emit(const detail::node& node, EventHandler& handler,
+                      AliasManager& am) const {
+  anchor_t anchor = NullAnchor;
+  if (IsAliased(node)) {
+    anchor = am.LookupAnchor(node);
+    if (anchor) {
+      handler.OnAlias(Mark(), anchor);
+      return;
+    }
+
+    am.RegisterReference(node);
+    anchor = am.LookupAnchor(node);
+  }
+
+  switch (node.type()) {
+    case NodeType::Undefined:
+      break;
+    case NodeType::Null:
+      handler.OnNull(Mark(), anchor);
+      break;
+    case NodeType::Scalar:
+      handler.OnScalar(Mark(), node.tag(), anchor, node.scalar());
+      break;
+    case NodeType::Sequence:
+      handler.OnSequenceStart(Mark(), node.tag(), anchor, node.style());
+      for (detail::const_node_iterator it = node.begin(); it != node.end();
+           ++it)
+        Emit(**it, handler, am);
+      handler.OnSequenceEnd();
+      break;
+    case NodeType::Map:
+      handler.OnMapStart(Mark(), node.tag(), anchor, node.style());
+      for (detail::const_node_iterator it = node.begin(); it != node.end();
+           ++it) {
+        Emit(*it->first, handler, am);
+        Emit(*it->second, handler, am);
+      }
+      handler.OnMapEnd();
+      break;
+  }
+}
+
+bool NodeEvents::IsAliased(const detail::node& node) const {
+  RefCount::const_iterator it = m_refCount.find(node.ref());
+  return it != m_refCount.end() && it->second > 1;
+}
+}


Mime
View raw message