Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3A9EE200D37 for ; Thu, 26 Oct 2017 03:21:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 39318160BDA; Thu, 26 Oct 2017 01:21:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AE918160BF3 for ; Thu, 26 Oct 2017 03:21:06 +0200 (CEST) Received: (qmail 93491 invoked by uid 500); 26 Oct 2017 01:21:05 -0000 Mailing-List: contact commits-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nifi.apache.org Delivered-To: mailing list commits@nifi.apache.org Received: (qmail 93333 invoked by uid 99); 26 Oct 2017 01:21:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Oct 2017 01:21:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 385A8DFC49; Thu, 26 Oct 2017 01:21:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aldrin@apache.org To: commits@nifi.apache.org Date: Thu, 26 Oct 2017 01:21:07 -0000 Message-Id: <916667a18999497d858cb203b519f243@git.apache.org> In-Reply-To: <03628d8375f54e55992f7be57df0ebfd@git.apache.org> References: <03628d8375f54e55992f7be57df0ebfd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/13] nifi-minifi-cpp git commit: MINIFICPP-263: Move merge content to an extension. Also remove circular dependencies archived-at: Thu, 26 Oct 2017 01:21:09 -0000 http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node.h new file mode 100644 index 0000000..8a776f6 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node.h @@ -0,0 +1,169 @@ +#ifndef NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_DETAIL_NODE_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 "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/type.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/detail/node_ref.h" +#include + +namespace YAML { +namespace detail { +class node { + public: + node() : m_pRef(new node_ref) {} + node(const node&) = delete; + node& operator=(const node&) = delete; + + bool is(const node& rhs) const { return m_pRef == rhs.m_pRef; } + const node_ref* ref() const { return m_pRef.get(); } + + bool is_defined() const { return m_pRef->is_defined(); } + const Mark& mark() const { return m_pRef->mark(); } + NodeType::value type() const { return m_pRef->type(); } + + const std::string& scalar() const { return m_pRef->scalar(); } + const std::string& tag() const { return m_pRef->tag(); } + EmitterStyle::value style() const { return m_pRef->style(); } + + template + bool equals(const T& rhs, shared_memory_holder pMemory); + bool equals(const char* rhs, shared_memory_holder pMemory); + + void mark_defined() { + if (is_defined()) + return; + + m_pRef->mark_defined(); + for (nodes::iterator it = m_dependencies.begin(); + it != m_dependencies.end(); ++it) + (*it)->mark_defined(); + m_dependencies.clear(); + } + + void add_dependency(node& rhs) { + if (is_defined()) + rhs.mark_defined(); + else + m_dependencies.insert(&rhs); + } + + void set_ref(const node& rhs) { + if (rhs.is_defined()) + mark_defined(); + m_pRef = rhs.m_pRef; + } + void set_data(const node& rhs) { + if (rhs.is_defined()) + mark_defined(); + m_pRef->set_data(*rhs.m_pRef); + } + + void set_mark(const Mark& mark) { m_pRef->set_mark(mark); } + + void set_type(NodeType::value type) { + if (type != NodeType::Undefined) + mark_defined(); + m_pRef->set_type(type); + } + void set_null() { + mark_defined(); + m_pRef->set_null(); + } + void set_scalar(const std::string& scalar) { + mark_defined(); + m_pRef->set_scalar(scalar); + } + void set_tag(const std::string& tag) { + mark_defined(); + m_pRef->set_tag(tag); + } + + // style + void set_style(EmitterStyle::value style) { + mark_defined(); + m_pRef->set_style(style); + } + + // size/iterator + std::size_t size() const { return m_pRef->size(); } + + const_node_iterator begin() const { + return static_cast(*m_pRef).begin(); + } + node_iterator begin() { return m_pRef->begin(); } + + const_node_iterator end() const { + return static_cast(*m_pRef).end(); + } + node_iterator end() { return m_pRef->end(); } + + // sequence + void push_back(node& input, shared_memory_holder pMemory) { + m_pRef->push_back(input, pMemory); + input.add_dependency(*this); + } + void insert(node& key, node& value, shared_memory_holder pMemory) { + m_pRef->insert(key, value, pMemory); + key.add_dependency(*this); + value.add_dependency(*this); + } + + // indexing + template + node* get(const Key& key, shared_memory_holder pMemory) const { + // NOTE: this returns a non-const node so that the top-level Node can wrap + // it, and returns a pointer so that it can be NULL (if there is no such + // key). + return static_cast(*m_pRef).get(key, pMemory); + } + template + node& get(const Key& key, shared_memory_holder pMemory) { + node& value = m_pRef->get(key, pMemory); + value.add_dependency(*this); + return value; + } + template + bool remove(const Key& key, shared_memory_holder pMemory) { + return m_pRef->remove(key, pMemory); + } + + node* get(node& key, shared_memory_holder pMemory) const { + // NOTE: this returns a non-const node so that the top-level Node can wrap + // it, and returns a pointer so that it can be NULL (if there is no such + // key). + return static_cast(*m_pRef).get(key, pMemory); + } + node& get(node& key, shared_memory_holder pMemory) { + node& value = m_pRef->get(key, pMemory); + key.add_dependency(*this); + value.add_dependency(*this); + return value; + } + bool remove(node& key, shared_memory_holder pMemory) { + return m_pRef->remove(key, pMemory); + } + + // map + template + void force_insert(const Key& key, const Value& value, + shared_memory_holder pMemory) { + m_pRef->force_insert(key, value, pMemory); + } + + private: + shared_node_ref m_pRef; + typedef std::set nodes; + nodes m_dependencies; +}; +} +} + +#endif // NODE_DETAIL_NODE_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/include/yaml-cpp/node/detail/node_data.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node_data.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node_data.h new file mode 100644 index 0000000..50bcd74 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node_data.h @@ -0,0 +1,127 @@ +#ifndef VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_DETAIL_NODE_DATA_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 +#include +#include +#include +#include + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/detail/node_iterator.h" +#include "yaml-cpp/node/iterator.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/type.h" + +namespace YAML { +namespace detail { +class node; +} // namespace detail +} // namespace YAML + +namespace YAML { +namespace detail { +class YAML_CPP_API node_data { + public: + node_data(); + node_data(const node_data&) = delete; + node_data& operator=(const node_data&) = delete; + + void mark_defined(); + void set_mark(const Mark& mark); + void set_type(NodeType::value type); + void set_tag(const std::string& tag); + void set_null(); + void set_scalar(const std::string& scalar); + void set_style(EmitterStyle::value style); + + bool is_defined() const { return m_isDefined; } + const Mark& mark() const { return m_mark; } + NodeType::value type() const { + return m_isDefined ? m_type : NodeType::Undefined; + } + const std::string& scalar() const { return m_scalar; } + const std::string& tag() const { return m_tag; } + EmitterStyle::value style() const { return m_style; } + + // size/iterator + std::size_t size() const; + + const_node_iterator begin() const; + node_iterator begin(); + + const_node_iterator end() const; + node_iterator end(); + + // sequence + void push_back(node& node, shared_memory_holder pMemory); + void insert(node& key, node& value, shared_memory_holder pMemory); + + // indexing + template + node* get(const Key& key, shared_memory_holder pMemory) const; + template + node& get(const Key& key, shared_memory_holder pMemory); + template + bool remove(const Key& key, shared_memory_holder pMemory); + + node* get(node& key, shared_memory_holder pMemory) const; + node& get(node& key, shared_memory_holder pMemory); + bool remove(node& key, shared_memory_holder pMemory); + + // map + template + void force_insert(const Key& key, const Value& value, + shared_memory_holder pMemory); + + public: + static std::string empty_scalar; + + private: + void compute_seq_size() const; + void compute_map_size() const; + + void reset_sequence(); + void reset_map(); + + void insert_map_pair(node& key, node& value); + void convert_to_map(shared_memory_holder pMemory); + void convert_sequence_to_map(shared_memory_holder pMemory); + + template + static node& convert_to_node(const T& rhs, shared_memory_holder pMemory); + + private: + bool m_isDefined; + Mark m_mark; + NodeType::value m_type; + std::string m_tag; + EmitterStyle::value m_style; + + // scalar + std::string m_scalar; + + // sequence + typedef std::vector node_seq; + node_seq m_sequence; + + mutable std::size_t m_seqSize; + + // map + typedef std::vector> node_map; + node_map m_map; + + typedef std::pair kv_pair; + typedef std::list kv_pairs; + mutable kv_pairs m_undefinedPairs; +}; +} +} + +#endif // VALUE_DETAIL_NODE_DATA_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/include/yaml-cpp/node/detail/node_iterator.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node_iterator.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node_iterator.h new file mode 100644 index 0000000..4337df4 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node_iterator.h @@ -0,0 +1,180 @@ +#ifndef VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_DETAIL_NODE_ITERATOR_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 "yaml-cpp/dll.h" +#include "yaml-cpp/node/ptr.h" +#include +#include +#include +#include +#include +#include + +namespace YAML { +namespace detail { +struct iterator_type { + enum value { None, Sequence, Map }; +}; + +template +struct node_iterator_value : public std::pair { + typedef std::pair kv; + + node_iterator_value() : kv(), pNode(0) {} + explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {} + explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(0) {} + + V& operator*() const { return *pNode; } + V& operator->() const { return *pNode; } + + V* pNode; +}; + +typedef std::vector node_seq; +typedef std::vector> node_map; + +template +struct node_iterator_type { + typedef node_seq::iterator seq; + typedef node_map::iterator map; +}; + +template +struct node_iterator_type { + typedef node_seq::const_iterator seq; + typedef node_map::const_iterator map; +}; + +template +class node_iterator_base + : public std::iterator, + std::ptrdiff_t, node_iterator_value*, + node_iterator_value> { + private: + struct enabler {}; + + struct proxy { + explicit proxy(const node_iterator_value& x) : m_ref(x) {} + node_iterator_value* operator->() { return std::addressof(m_ref); } + operator node_iterator_value*() { return std::addressof(m_ref); } + + node_iterator_value m_ref; + }; + + public: + typedef typename node_iterator_type::seq SeqIter; + typedef typename node_iterator_type::map MapIter; + typedef node_iterator_value value_type; + + node_iterator_base() + : m_type(iterator_type::None), m_seqIt(), m_mapIt(), m_mapEnd() {} + explicit node_iterator_base(SeqIter seqIt) + : m_type(iterator_type::Sequence), + m_seqIt(seqIt), + m_mapIt(), + m_mapEnd() {} + explicit node_iterator_base(MapIter mapIt, MapIter mapEnd) + : m_type(iterator_type::Map), + m_seqIt(), + m_mapIt(mapIt), + m_mapEnd(mapEnd) { + m_mapIt = increment_until_defined(m_mapIt); + } + + template + node_iterator_base(const node_iterator_base& rhs, + typename std::enable_if::value, + enabler>::type = enabler()) + : m_type(rhs.m_type), + m_seqIt(rhs.m_seqIt), + m_mapIt(rhs.m_mapIt), + m_mapEnd(rhs.m_mapEnd) {} + + template + friend class node_iterator_base; + + template + bool operator==(const node_iterator_base& rhs) const { + if (m_type != rhs.m_type) + return false; + + switch (m_type) { + case iterator_type::None: + return true; + case iterator_type::Sequence: + return m_seqIt == rhs.m_seqIt; + case iterator_type::Map: + return m_mapIt == rhs.m_mapIt; + } + return true; + } + + template + bool operator!=(const node_iterator_base& rhs) const { + return !(*this == rhs); + } + + node_iterator_base& operator++() { + switch (m_type) { + case iterator_type::None: + break; + case iterator_type::Sequence: + ++m_seqIt; + break; + case iterator_type::Map: + ++m_mapIt; + m_mapIt = increment_until_defined(m_mapIt); + break; + } + return *this; + } + + node_iterator_base operator++(int) { + node_iterator_base iterator_pre(*this); + ++(*this); + return iterator_pre; + } + + value_type operator*() const { + switch (m_type) { + case iterator_type::None: + return value_type(); + case iterator_type::Sequence: + return value_type(**m_seqIt); + case iterator_type::Map: + return value_type(*m_mapIt->first, *m_mapIt->second); + } + return value_type(); + } + + proxy operator->() const { return proxy(**this); } + + MapIter increment_until_defined(MapIter it) { + while (it != m_mapEnd && !is_defined(it)) + ++it; + return it; + } + + bool is_defined(MapIter it) const { + return it->first->is_defined() && it->second->is_defined(); + } + + private: + typename iterator_type::value m_type; + + SeqIter m_seqIt; + MapIter m_mapIt, m_mapEnd; +}; + +typedef node_iterator_base node_iterator; +typedef node_iterator_base const_node_iterator; +} +} + +#endif // VALUE_DETAIL_NODE_ITERATOR_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/include/yaml-cpp/node/detail/node_ref.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node_ref.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node_ref.h new file mode 100644 index 0000000..d8a94f8 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/detail/node_ref.h @@ -0,0 +1,98 @@ +#ifndef VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_DETAIL_NODE_REF_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 "yaml-cpp/dll.h" +#include "yaml-cpp/node/type.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/detail/node_data.h" + +namespace YAML { +namespace detail { +class node_ref { + public: + node_ref() : m_pData(new node_data) {} + node_ref(const node_ref&) = delete; + node_ref& operator=(const node_ref&) = delete; + + bool is_defined() const { return m_pData->is_defined(); } + const Mark& mark() const { return m_pData->mark(); } + NodeType::value type() const { return m_pData->type(); } + const std::string& scalar() const { return m_pData->scalar(); } + const std::string& tag() const { return m_pData->tag(); } + EmitterStyle::value style() const { return m_pData->style(); } + + void mark_defined() { m_pData->mark_defined(); } + void set_data(const node_ref& rhs) { m_pData = rhs.m_pData; } + + void set_mark(const Mark& mark) { m_pData->set_mark(mark); } + void set_type(NodeType::value type) { m_pData->set_type(type); } + void set_tag(const std::string& tag) { m_pData->set_tag(tag); } + void set_null() { m_pData->set_null(); } + void set_scalar(const std::string& scalar) { m_pData->set_scalar(scalar); } + void set_style(EmitterStyle::value style) { m_pData->set_style(style); } + + // size/iterator + std::size_t size() const { return m_pData->size(); } + + const_node_iterator begin() const { + return static_cast(*m_pData).begin(); + } + node_iterator begin() { return m_pData->begin(); } + + const_node_iterator end() const { + return static_cast(*m_pData).end(); + } + node_iterator end() { return m_pData->end(); } + + // sequence + void push_back(node& node, shared_memory_holder pMemory) { + m_pData->push_back(node, pMemory); + } + void insert(node& key, node& value, shared_memory_holder pMemory) { + m_pData->insert(key, value, pMemory); + } + + // indexing + template + node* get(const Key& key, shared_memory_holder pMemory) const { + return static_cast(*m_pData).get(key, pMemory); + } + template + node& get(const Key& key, shared_memory_holder pMemory) { + return m_pData->get(key, pMemory); + } + template + bool remove(const Key& key, shared_memory_holder pMemory) { + return m_pData->remove(key, pMemory); + } + + node* get(node& key, shared_memory_holder pMemory) const { + return static_cast(*m_pData).get(key, pMemory); + } + node& get(node& key, shared_memory_holder pMemory) { + return m_pData->get(key, pMemory); + } + bool remove(node& key, shared_memory_holder pMemory) { + return m_pData->remove(key, pMemory); + } + + // map + template + void force_insert(const Key& key, const Value& value, + shared_memory_holder pMemory) { + m_pData->force_insert(key, value, pMemory); + } + + private: + shared_node_data m_pData; +}; +} +} + +#endif // VALUE_DETAIL_NODE_REF_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/include/yaml-cpp/node/emit.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/emit.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/emit.h new file mode 100644 index 0000000..032268c --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/emit.h @@ -0,0 +1,32 @@ +#ifndef NODE_EMIT_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_EMIT_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 +#include + +#include "yaml-cpp/dll.h" + +namespace YAML { +class Emitter; +class Node; + +/** + * Emits the node to the given {@link Emitter}. If there is an error in writing, + * {@link Emitter#good} will return false. + */ +YAML_CPP_API Emitter& operator<<(Emitter& out, const Node& node); + +/** Emits the node to the given output stream. */ +YAML_CPP_API std::ostream& operator<<(std::ostream& out, const Node& node); + +/** Converts the node to a YAML string. */ +YAML_CPP_API std::string Dump(const Node& node); +} // namespace YAML + +#endif // NODE_EMIT_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/include/yaml-cpp/node/impl.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/impl.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/impl.h new file mode 100644 index 0000000..20c487a --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/impl.h @@ -0,0 +1,448 @@ +#ifndef NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_IMPL_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 "yaml-cpp/node/node.h" +#include "yaml-cpp/node/iterator.h" +#include "yaml-cpp/node/detail/memory.h" +#include "yaml-cpp/node/detail/node.h" +#include "yaml-cpp/exceptions.h" +#include + +namespace YAML { +inline Node::Node() : m_isValid(true), m_pNode(NULL) {} + +inline Node::Node(NodeType::value type) + : m_isValid(true), + m_pMemory(new detail::memory_holder), + m_pNode(&m_pMemory->create_node()) { + m_pNode->set_type(type); +} + +template +inline Node::Node(const T& rhs) + : m_isValid(true), + m_pMemory(new detail::memory_holder), + m_pNode(&m_pMemory->create_node()) { + Assign(rhs); +} + +inline Node::Node(const detail::iterator_value& rhs) + : m_isValid(rhs.m_isValid), + m_pMemory(rhs.m_pMemory), + m_pNode(rhs.m_pNode) {} + +inline Node::Node(const Node& rhs) + : m_isValid(rhs.m_isValid), + m_pMemory(rhs.m_pMemory), + m_pNode(rhs.m_pNode) {} + +inline Node::Node(Zombie) : m_isValid(false), m_pNode(NULL) {} + +inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory) + : m_isValid(true), m_pMemory(pMemory), m_pNode(&node) {} + +inline Node::~Node() {} + +inline void Node::EnsureNodeExists() const { + if (!m_isValid) + throw InvalidNode(); + if (!m_pNode) { + m_pMemory.reset(new detail::memory_holder); + m_pNode = &m_pMemory->create_node(); + m_pNode->set_null(); + } +} + +inline bool Node::IsDefined() const { + if (!m_isValid) { + return false; + } + return m_pNode ? m_pNode->is_defined() : true; +} + +inline Mark Node::Mark() const { + if (!m_isValid) { + throw InvalidNode(); + } + return m_pNode ? m_pNode->mark() : Mark::null_mark(); +} + +inline NodeType::value Node::Type() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->type() : NodeType::Null; +} + +// access + +// template helpers +template +struct as_if { + explicit as_if(const Node& node_) : node(node_) {} + const Node& node; + + T operator()(const S& fallback) const { + if (!node.m_pNode) + return fallback; + + T t; + if (convert::decode(node, t)) + return t; + return fallback; + } +}; + +template +struct as_if { + explicit as_if(const Node& node_) : node(node_) {} + const Node& node; + + std::string operator()(const S& fallback) const { + if (node.Type() != NodeType::Scalar) + return fallback; + return node.Scalar(); + } +}; + +template +struct as_if { + explicit as_if(const Node& node_) : node(node_) {} + const Node& node; + + T operator()() const { + if (!node.m_pNode) + throw TypedBadConversion(node.Mark()); + + T t; + if (convert::decode(node, t)) + return t; + throw TypedBadConversion(node.Mark()); + } +}; + +template <> +struct as_if { + explicit as_if(const Node& node_) : node(node_) {} + const Node& node; + + std::string operator()() const { + if (node.Type() != NodeType::Scalar) + throw TypedBadConversion(node.Mark()); + return node.Scalar(); + } +}; + +// access functions +template +inline T Node::as() const { + if (!m_isValid) + throw InvalidNode(); + return as_if(*this)(); +} + +template +inline T Node::as(const S& fallback) const { + if (!m_isValid) + return fallback; + return as_if(*this)(fallback); +} + +inline const std::string& Node::Scalar() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar; +} + +inline const std::string& Node::Tag() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar; +} + +inline void Node::SetTag(const std::string& tag) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_tag(tag); +} + +inline EmitterStyle::value Node::Style() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->style() : EmitterStyle::Default; +} + +inline void Node::SetStyle(EmitterStyle::value style) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_style(style); +} + +// assignment +inline bool Node::is(const Node& rhs) const { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + if (!m_pNode || !rhs.m_pNode) + return false; + return m_pNode->is(*rhs.m_pNode); +} + +template +inline Node& Node::operator=(const T& rhs) { + if (!m_isValid) + throw InvalidNode(); + Assign(rhs); + return *this; +} + +inline void Node::reset(const YAML::Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + m_pMemory = rhs.m_pMemory; + m_pNode = rhs.m_pNode; +} + +template +inline void Node::Assign(const T& rhs) { + if (!m_isValid) + throw InvalidNode(); + AssignData(convert::encode(rhs)); +} + +template <> +inline void Node::Assign(const std::string& rhs) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_scalar(rhs); +} + +inline void Node::Assign(const char* rhs) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_scalar(rhs); +} + +inline void Node::Assign(char* rhs) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->set_scalar(rhs); +} + +inline Node& Node::operator=(const Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + if (is(rhs)) + return *this; + AssignNode(rhs); + return *this; +} + +inline void Node::AssignData(const Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + rhs.EnsureNodeExists(); + + m_pNode->set_data(*rhs.m_pNode); + m_pMemory->merge(*rhs.m_pMemory); +} + +inline void Node::AssignNode(const Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + rhs.EnsureNodeExists(); + + if (!m_pNode) { + m_pNode = rhs.m_pNode; + m_pMemory = rhs.m_pMemory; + return; + } + + m_pNode->set_ref(*rhs.m_pNode); + m_pMemory->merge(*rhs.m_pMemory); + m_pNode = rhs.m_pNode; +} + +// size/iterator +inline std::size_t Node::size() const { + if (!m_isValid) + throw InvalidNode(); + return m_pNode ? m_pNode->size() : 0; +} + +inline const_iterator Node::begin() const { + if (!m_isValid) + return const_iterator(); + return m_pNode ? const_iterator(m_pNode->begin(), m_pMemory) + : const_iterator(); +} + +inline iterator Node::begin() { + if (!m_isValid) + return iterator(); + return m_pNode ? iterator(m_pNode->begin(), m_pMemory) : iterator(); +} + +inline const_iterator Node::end() const { + if (!m_isValid) + return const_iterator(); + return m_pNode ? const_iterator(m_pNode->end(), m_pMemory) : const_iterator(); +} + +inline iterator Node::end() { + if (!m_isValid) + return iterator(); + return m_pNode ? iterator(m_pNode->end(), m_pMemory) : iterator(); +} + +// sequence +template +inline void Node::push_back(const T& rhs) { + if (!m_isValid) + throw InvalidNode(); + push_back(Node(rhs)); +} + +inline void Node::push_back(const Node& rhs) { + if (!m_isValid || !rhs.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + rhs.EnsureNodeExists(); + + m_pNode->push_back(*rhs.m_pNode, m_pMemory); + m_pMemory->merge(*rhs.m_pMemory); +} + +// helpers for indexing +namespace detail { +template +struct to_value_t { + explicit to_value_t(const T& t_) : t(t_) {} + const T& t; + typedef const T& return_type; + + const T& operator()() const { return t; } +}; + +template <> +struct to_value_t { + explicit to_value_t(const char* t_) : t(t_) {} + const char* t; + typedef std::string return_type; + + const std::string operator()() const { return t; } +}; + +template <> +struct to_value_t { + explicit to_value_t(char* t_) : t(t_) {} + const char* t; + typedef std::string return_type; + + const std::string operator()() const { return t; } +}; + +template +struct to_value_t { + explicit to_value_t(const char* t_) : t(t_) {} + const char* t; + typedef std::string return_type; + + const std::string operator()() const { return t; } +}; + +// converts C-strings to std::strings so they can be copied +template +inline typename to_value_t::return_type to_value(const T& t) { + return to_value_t(t)(); +} +} + +// indexing +template +inline const Node Node::operator[](const Key& key) const { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + detail::node* value = static_cast(*m_pNode) + .get(detail::to_value(key), m_pMemory); + if (!value) { + return Node(ZombieNode); + } + return Node(*value, m_pMemory); +} + +template +inline Node Node::operator[](const Key& key) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory); + return Node(value, m_pMemory); +} + +template +inline bool Node::remove(const Key& key) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + return m_pNode->remove(detail::to_value(key), m_pMemory); +} + +inline const Node Node::operator[](const Node& key) const { + if (!m_isValid || !key.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + key.EnsureNodeExists(); + m_pMemory->merge(*key.m_pMemory); + detail::node* value = + static_cast(*m_pNode).get(*key.m_pNode, m_pMemory); + if (!value) { + return Node(ZombieNode); + } + return Node(*value, m_pMemory); +} + +inline Node Node::operator[](const Node& key) { + if (!m_isValid || !key.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + key.EnsureNodeExists(); + m_pMemory->merge(*key.m_pMemory); + detail::node& value = m_pNode->get(*key.m_pNode, m_pMemory); + return Node(value, m_pMemory); +} + +inline bool Node::remove(const Node& key) { + if (!m_isValid || !key.m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + key.EnsureNodeExists(); + return m_pNode->remove(*key.m_pNode, m_pMemory); +} + +// map +template +inline void Node::force_insert(const Key& key, const Value& value) { + if (!m_isValid) + throw InvalidNode(); + EnsureNodeExists(); + m_pNode->force_insert(detail::to_value(key), detail::to_value(value), + m_pMemory); +} + +// free functions +inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); } +} + +#endif // NODE_IMPL_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/include/yaml-cpp/node/iterator.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/iterator.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/iterator.h new file mode 100644 index 0000000..366a9c8 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/iterator.h @@ -0,0 +1,31 @@ +#ifndef VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_ITERATOR_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 "yaml-cpp/dll.h" +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/detail/iterator_fwd.h" +#include "yaml-cpp/node/detail/iterator.h" +#include +#include +#include + +namespace YAML { +namespace detail { +struct iterator_value : public Node, std::pair { + iterator_value() {} + explicit iterator_value(const Node& rhs) + : Node(rhs), + std::pair(Node(Node::ZombieNode), Node(Node::ZombieNode)) {} + explicit iterator_value(const Node& key, const Node& value) + : Node(Node::ZombieNode), std::pair(key, value) {} +}; +} +} + +#endif // VALUE_ITERATOR_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/include/yaml-cpp/node/node.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/node.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/node.h new file mode 100644 index 0000000..1ded7d2 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/node.h @@ -0,0 +1,145 @@ +#ifndef NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NODE_NODE_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 + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/mark.h" +#include "yaml-cpp/node/detail/bool_type.h" +#include "yaml-cpp/node/detail/iterator_fwd.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/type.h" + +namespace YAML { +namespace detail { +class node; +class node_data; +struct iterator_value; +} // namespace detail +} // namespace YAML + +namespace YAML { +class YAML_CPP_API Node { + public: + friend class NodeBuilder; + friend class NodeEvents; + friend struct detail::iterator_value; + friend class detail::node; + friend class detail::node_data; + template + friend class detail::iterator_base; + template + friend struct as_if; + + typedef YAML::iterator iterator; + typedef YAML::const_iterator const_iterator; + + Node(); + explicit Node(NodeType::value type); + template + explicit Node(const T& rhs); + explicit Node(const detail::iterator_value& rhs); + Node(const Node& rhs); + ~Node(); + + YAML::Mark Mark() const; + NodeType::value Type() const; + bool IsDefined() const; + bool IsNull() const { return Type() == NodeType::Null; } + bool IsScalar() const { return Type() == NodeType::Scalar; } + bool IsSequence() const { return Type() == NodeType::Sequence; } + bool IsMap() const { return Type() == NodeType::Map; } + + // bool conversions + YAML_CPP_OPERATOR_BOOL() + bool operator!() const { return !IsDefined(); } + + // access + template + T as() const; + template + T as(const S& fallback) const; + const std::string& Scalar() const; + + const std::string& Tag() const; + void SetTag(const std::string& tag); + + // style + // WARNING: This API might change in future releases. + EmitterStyle::value Style() const; + void SetStyle(EmitterStyle::value style); + + // assignment + bool is(const Node& rhs) const; + template + Node& operator=(const T& rhs); + Node& operator=(const Node& rhs); + void reset(const Node& rhs = Node()); + + // size/iterator + std::size_t size() const; + + const_iterator begin() const; + iterator begin(); + + const_iterator end() const; + iterator end(); + + // sequence + template + void push_back(const T& rhs); + void push_back(const Node& rhs); + + // indexing + template + const Node operator[](const Key& key) const; + template + Node operator[](const Key& key); + template + bool remove(const Key& key); + + const Node operator[](const Node& key) const; + Node operator[](const Node& key); + bool remove(const Node& key); + + // map + template + void force_insert(const Key& key, const Value& value); + + private: + enum Zombie { ZombieNode }; + explicit Node(Zombie); + explicit Node(detail::node& node, detail::shared_memory_holder pMemory); + + void EnsureNodeExists() const; + + template + void Assign(const T& rhs); + void Assign(const char* rhs); + void Assign(char* rhs); + + void AssignData(const Node& rhs); + void AssignNode(const Node& rhs); + + private: + bool m_isValid; + mutable detail::shared_memory_holder m_pMemory; + mutable detail::node* m_pNode; +}; + +YAML_CPP_API bool operator==(const Node& lhs, const Node& rhs); + +YAML_CPP_API Node Clone(const Node& node); + +template +struct convert; +} + +#endif // NODE_NODE_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/include/yaml-cpp/node/parse.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/parse.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/parse.h new file mode 100644 index 0000000..7745fd7 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/parse.h @@ -0,0 +1,78 @@ +#ifndef VALUE_PARSE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_PARSE_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 +#include +#include + +#include "yaml-cpp/dll.h" + +namespace YAML { +class Node; + +/** + * Loads the input string as a single YAML document. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API Node Load(const std::string& input); + +/** + * Loads the input string as a single YAML document. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API Node Load(const char* input); + +/** + * Loads the input stream as a single YAML document. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API Node Load(std::istream& input); + +/** + * Loads the input file as a single YAML document. + * + * @throws {@link ParserException} if it is malformed. + * @throws {@link BadFile} if the file cannot be loaded. + */ +YAML_CPP_API Node LoadFile(const std::string& filename); + +/** + * Loads the input string as a list of YAML documents. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API std::vector LoadAll(const std::string& input); + +/** + * Loads the input string as a list of YAML documents. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API std::vector LoadAll(const char* input); + +/** + * Loads the input stream as a list of YAML documents. + * + * @throws {@link ParserException} if it is malformed. + */ +YAML_CPP_API std::vector LoadAll(std::istream& input); + +/** + * Loads the input file as a list of YAML documents. + * + * @throws {@link ParserException} if it is malformed. + * @throws {@link BadFile} if the file cannot be loaded. + */ +YAML_CPP_API std::vector LoadAllFromFile(const std::string& filename); +} // namespace YAML + +#endif // VALUE_PARSE_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/include/yaml-cpp/node/ptr.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/ptr.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/ptr.h new file mode 100644 index 0000000..ce085dd --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/ptr.h @@ -0,0 +1,29 @@ +#ifndef VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_PTR_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 "yaml-cpp/dll.h" +#include + +namespace YAML { +namespace detail { +class node; +class node_ref; +class node_data; +class memory; +class memory_holder; + +typedef std::shared_ptr shared_node; +typedef std::shared_ptr shared_node_ref; +typedef std::shared_ptr shared_node_data; +typedef std::shared_ptr shared_memory_holder; +typedef std::shared_ptr shared_memory; +} +} + +#endif // VALUE_PTR_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/include/yaml-cpp/node/type.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/type.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/type.h new file mode 100644 index 0000000..9d55ca9 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/node/type.h @@ -0,0 +1,16 @@ +#ifndef VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define VALUE_TYPE_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 + +namespace YAML { +struct NodeType { + enum value { Undefined, Null, Scalar, Sequence, Map }; +}; +} + +#endif // VALUE_TYPE_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/include/yaml-cpp/noncopyable.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/noncopyable.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/noncopyable.h new file mode 100644 index 0000000..a261040 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/noncopyable.h @@ -0,0 +1,25 @@ +#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NONCOPYABLE_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 "yaml-cpp/dll.h" + +namespace YAML { +// this is basically boost::noncopyable +class YAML_CPP_API noncopyable { + protected: + noncopyable() {} + ~noncopyable() {} + + private: + noncopyable(const noncopyable&); + const noncopyable& operator=(const noncopyable&); +}; +} + +#endif // NONCOPYABLE_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/include/yaml-cpp/null.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/null.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/null.h new file mode 100644 index 0000000..b9521d4 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/null.h @@ -0,0 +1,26 @@ +#ifndef NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define NULL_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 "yaml-cpp/dll.h" +#include + +namespace YAML { +class Node; + +struct YAML_CPP_API _Null {}; +inline bool operator==(const _Null&, const _Null&) { return true; } +inline bool operator!=(const _Null&, const _Null&) { return false; } + +YAML_CPP_API bool IsNull(const Node& node); // old API only +YAML_CPP_API bool IsNullString(const std::string& str); + +extern YAML_CPP_API _Null Null; +} + +#endif // NULL_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/include/yaml-cpp/ostream_wrapper.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/ostream_wrapper.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/ostream_wrapper.h new file mode 100644 index 0000000..09d45f3 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/ostream_wrapper.h @@ -0,0 +1,72 @@ +#ifndef OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define OSTREAM_WRAPPER_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 +#include + +#include "yaml-cpp/dll.h" + +namespace YAML { +class YAML_CPP_API ostream_wrapper { + public: + ostream_wrapper(); + explicit ostream_wrapper(std::ostream& stream); + ~ostream_wrapper(); + + void write(const std::string& str); + void write(const char* str, std::size_t size); + + void set_comment() { m_comment = true; } + + const char* str() const { + if (m_pStream) { + return 0; + } else { + m_buffer[m_pos] = '\0'; + return &m_buffer[0]; + } + } + + std::size_t row() const { return m_row; } + std::size_t col() const { return m_col; } + std::size_t pos() const { return m_pos; } + bool comment() const { return m_comment; } + + private: + void update_pos(char ch); + + private: + mutable std::vector m_buffer; + std::ostream* const m_pStream; + + std::size_t m_pos; + std::size_t m_row, m_col; + bool m_comment; +}; + +template +inline ostream_wrapper& operator<<(ostream_wrapper& stream, + const char(&str)[N]) { + stream.write(str, N - 1); + return stream; +} + +inline ostream_wrapper& operator<<(ostream_wrapper& stream, + const std::string& str) { + stream.write(str); + return stream; +} + +inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) { + stream.write(&ch, 1); + return stream; +} +} + +#endif // OSTREAM_WRAPPER_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/include/yaml-cpp/parser.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/parser.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/parser.h new file mode 100644 index 0000000..ceac22d --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/parser.h @@ -0,0 +1,86 @@ +#ifndef PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define PARSER_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 +#include + +#include "yaml-cpp/dll.h" +#include "yaml-cpp/noncopyable.h" + +namespace YAML { +class EventHandler; +class Node; +class Scanner; +struct Directives; +struct Token; + +/** + * A parser turns a stream of bytes into one stream of "events" per YAML + * document in the input stream. + */ +class YAML_CPP_API Parser : private noncopyable { + public: + /** Constructs an empty parser (with no input. */ + Parser(); + + /** + * Constructs a parser from the given input stream. The input stream must + * live as long as the parser. + */ + explicit Parser(std::istream& in); + + ~Parser(); + + /** Evaluates to true if the parser has some valid input to be read. */ + explicit operator bool() const; + + /** + * Resets the parser with the given input stream. Any existing state is + * erased. + */ + void Load(std::istream& in); + + /** + * Handles the next document by calling events on the {@code eventHandler}. + * + * @throw a ParserException on error. + * @return false if there are no more documents + */ + bool HandleNextDocument(EventHandler& eventHandler); + + void PrintTokens(std::ostream& out); + + private: + /** + * Reads any directives that are next in the queue, setting the internal + * {@code m_pDirectives} state. + */ + void ParseDirectives(); + + void HandleDirective(const Token& token); + + /** + * Handles a "YAML" directive, which should be of the form 'major.minor' (like + * a version number). + */ + void HandleYamlDirective(const Token& token); + + /** + * Handles a "TAG" directive, which should be of the form 'handle prefix', + * where 'handle' is converted to 'prefix' in the file. + */ + void HandleTagDirective(const Token& token); + + private: + std::unique_ptr m_pScanner; + std::unique_ptr m_pDirectives; +}; +} + +#endif // PARSER_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/include/yaml-cpp/stlemitter.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/stlemitter.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/stlemitter.h new file mode 100644 index 0000000..06780c8 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/stlemitter.h @@ -0,0 +1,51 @@ +#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define STLEMITTER_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 +#include +#include +#include + +namespace YAML { +template +inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) { + emitter << BeginSeq; + for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it) + emitter << *it; + emitter << EndSeq; + return emitter; +} + +template +inline Emitter& operator<<(Emitter& emitter, const std::vector& v) { + return EmitSeq(emitter, v); +} + +template +inline Emitter& operator<<(Emitter& emitter, const std::list& v) { + return EmitSeq(emitter, v); +} + +template +inline Emitter& operator<<(Emitter& emitter, const std::set& v) { + return EmitSeq(emitter, v); +} + +template +inline Emitter& operator<<(Emitter& emitter, const std::map& m) { + typedef typename std::map map; + emitter << BeginMap; + for (typename map::const_iterator it = m.begin(); it != m.end(); ++it) + emitter << Key << it->first << Value << it->second; + emitter << EndMap; + return emitter; +} +} + +#endif // STLEMITTER_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/include/yaml-cpp/traits.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/traits.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/traits.h new file mode 100644 index 0000000..f33d0e1 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/traits.h @@ -0,0 +1,103 @@ +#ifndef TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define TRAITS_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 + +namespace YAML { +template +struct is_numeric { + enum { value = false }; +}; + +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +#if defined(_MSC_VER) && (_MSC_VER < 1310) +template <> +struct is_numeric<__int64> { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +#else +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +#endif +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; +template <> +struct is_numeric { + enum { value = true }; +}; + +template +struct enable_if_c { + typedef T type; +}; + +template +struct enable_if_c {}; + +template +struct enable_if : public enable_if_c {}; + +template +struct disable_if_c { + typedef T type; +}; + +template +struct disable_if_c {}; + +template +struct disable_if : public disable_if_c {}; +} + +#endif // TRAITS_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/include/yaml-cpp/yaml.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/yaml.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/yaml.h new file mode 100644 index 0000000..7f515ef --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/include/yaml-cpp/yaml.h @@ -0,0 +1,24 @@ +#ifndef YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define YAML_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 "yaml-cpp/parser.h" +#include "yaml-cpp/emitter.h" +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/stlemitter.h" +#include "yaml-cpp/exceptions.h" + +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/impl.h" +#include "yaml-cpp/node/convert.h" +#include "yaml-cpp/node/iterator.h" +#include "yaml-cpp/node/detail/impl.h" +#include "yaml-cpp/node/parse.h" +#include "yaml-cpp/node/emit.h" + +#endif // YAML_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/install.txt ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/install.txt b/thirdparty/yaml-cpp-yaml-cpp-20171024/install.txt new file mode 100644 index 0000000..9392362 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/install.txt @@ -0,0 +1,24 @@ +*** With CMake *** + +yaml-cpp uses CMake to support cross-platform building. In a UNIX-like system, the basic steps to build are: + +1. Download and install CMake (if you don't have root privileges, just install to a local directory, like ~/bin) + +2. From the source directory, run: + +mkdir build +cd build +cmake .. + +and then the usual + +make +make install + +3. To clean up, just remove the 'build' directory. + +*** Without CMake *** + +If you don't want to use CMake, just add all .cpp files to a makefile. yaml-cpp does not need any special build settings, so no 'configure' file is necessary. + +(Note: this is pretty tedious. It's sooo much easier to use CMake.) http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/binary.cpp ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/binary.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/binary.cpp new file mode 100644 index 0000000..a7e5130 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/binary.cpp @@ -0,0 +1,93 @@ +#include "yaml-cpp/binary.h" + +namespace YAML { +static const char encoding[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +std::string EncodeBase64(const unsigned char *data, std::size_t size) { + const char PAD = '='; + + std::string ret; + ret.resize(4 * size / 3 + 3); + char *out = &ret[0]; + + std::size_t chunks = size / 3; + std::size_t remainder = size % 3; + + for (std::size_t i = 0; i < chunks; i++, data += 3) { + *out++ = encoding[data[0] >> 2]; + *out++ = encoding[((data[0] & 0x3) << 4) | (data[1] >> 4)]; + *out++ = encoding[((data[1] & 0xf) << 2) | (data[2] >> 6)]; + *out++ = encoding[data[2] & 0x3f]; + } + + switch (remainder) { + case 0: + break; + case 1: + *out++ = encoding[data[0] >> 2]; + *out++ = encoding[((data[0] & 0x3) << 4)]; + *out++ = PAD; + *out++ = PAD; + break; + case 2: + *out++ = encoding[data[0] >> 2]; + *out++ = encoding[((data[0] & 0x3) << 4) | (data[1] >> 4)]; + *out++ = encoding[((data[1] & 0xf) << 2)]; + *out++ = PAD; + break; + } + + ret.resize(out - &ret[0]); + return ret; +} + +static const unsigned char decoding[] = { + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, + 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, + 255, 0, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, +}; + +std::vector DecodeBase64(const std::string &input) { + typedef std::vector ret_type; + if (input.empty()) + return ret_type(); + + ret_type ret(3 * input.size() / 4 + 1); + unsigned char *out = &ret[0]; + + unsigned value = 0; + for (std::size_t i = 0; i < input.size(); i++) { + unsigned char d = decoding[static_cast(input[i])]; + if (d == 255) + return ret_type(); + + value = (value << 6) | d; + if (i % 4 == 3) { + *out++ = value >> 16; + if (i > 0 && input[i - 1] != '=') + *out++ = value >> 8; + if (input[i] != '=') + *out++ = value; + } + } + + ret.resize(out - &ret[0]); + return ret; +} +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/collectionstack.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/collectionstack.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/collectionstack.h new file mode 100644 index 0000000..2302786 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/collectionstack.h @@ -0,0 +1,39 @@ +#ifndef COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define COLLECTIONSTACK_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 +#include + +namespace YAML { +struct CollectionType { + enum value { NoCollection, BlockMap, BlockSeq, FlowMap, FlowSeq, CompactMap }; +}; + +class CollectionStack { + public: + CollectionType::value GetCurCollectionType() const { + if (collectionStack.empty()) + return CollectionType::NoCollection; + return collectionStack.top(); + } + + void PushCollectionType(CollectionType::value type) { + collectionStack.push(type); + } + void PopCollectionType(CollectionType::value type) { + assert(type == GetCurCollectionType()); + collectionStack.pop(); + } + + private: + std::stack collectionStack; +}; +} + +#endif // COLLECTIONSTACK_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/contrib/graphbuilder.cpp ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilder.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilder.cpp new file mode 100644 index 0000000..416c135 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilder.cpp @@ -0,0 +1,17 @@ +#include "graphbuilderadapter.h" + +#include "yaml-cpp/parser.h" // IWYU pragma: keep + +namespace YAML { +class GraphBuilderInterface; + +void* BuildGraphOfNextDocument(Parser& parser, + GraphBuilderInterface& graphBuilder) { + GraphBuilderAdapter eventHandler(graphBuilder); + if (parser.HandleNextDocument(eventHandler)) { + return eventHandler.RootNode(); + } else { + return NULL; + } +} +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilderadapter.cpp ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilderadapter.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilderadapter.cpp new file mode 100644 index 0000000..02a3d97 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilderadapter.cpp @@ -0,0 +1,94 @@ +#include "graphbuilderadapter.h" +#include "yaml-cpp/contrib/graphbuilder.h" + +namespace YAML { +struct Mark; + +int GraphBuilderAdapter::ContainerFrame::sequenceMarker; + +void GraphBuilderAdapter::OnNull(const Mark &mark, anchor_t anchor) { + void *pParent = GetCurrentParent(); + void *pNode = m_builder.NewNull(mark, pParent); + RegisterAnchor(anchor, pNode); + + DispositionNode(pNode); +} + +void GraphBuilderAdapter::OnAlias(const Mark &mark, anchor_t anchor) { + void *pReffedNode = m_anchors.Get(anchor); + DispositionNode(m_builder.AnchorReference(mark, pReffedNode)); +} + +void GraphBuilderAdapter::OnScalar(const Mark &mark, const std::string &tag, + anchor_t anchor, const std::string &value) { + void *pParent = GetCurrentParent(); + void *pNode = m_builder.NewScalar(mark, tag, pParent, value); + RegisterAnchor(anchor, pNode); + + DispositionNode(pNode); +} + +void GraphBuilderAdapter::OnSequenceStart(const Mark &mark, + const std::string &tag, + anchor_t anchor, + EmitterStyle::value /* style */) { + void *pNode = m_builder.NewSequence(mark, tag, GetCurrentParent()); + m_containers.push(ContainerFrame(pNode)); + RegisterAnchor(anchor, pNode); +} + +void GraphBuilderAdapter::OnSequenceEnd() { + void *pSequence = m_containers.top().pContainer; + m_containers.pop(); + + DispositionNode(pSequence); +} + +void GraphBuilderAdapter::OnMapStart(const Mark &mark, const std::string &tag, + anchor_t anchor, + EmitterStyle::value /* style */) { + void *pNode = m_builder.NewMap(mark, tag, GetCurrentParent()); + m_containers.push(ContainerFrame(pNode, m_pKeyNode)); + m_pKeyNode = NULL; + RegisterAnchor(anchor, pNode); +} + +void GraphBuilderAdapter::OnMapEnd() { + void *pMap = m_containers.top().pContainer; + m_pKeyNode = m_containers.top().pPrevKeyNode; + m_containers.pop(); + DispositionNode(pMap); +} + +void *GraphBuilderAdapter::GetCurrentParent() const { + if (m_containers.empty()) { + return NULL; + } + return m_containers.top().pContainer; +} + +void GraphBuilderAdapter::RegisterAnchor(anchor_t anchor, void *pNode) { + if (anchor) { + m_anchors.Register(anchor, pNode); + } +} + +void GraphBuilderAdapter::DispositionNode(void *pNode) { + if (m_containers.empty()) { + m_pRootNode = pNode; + return; + } + + void *pContainer = m_containers.top().pContainer; + if (m_containers.top().isMap()) { + if (m_pKeyNode) { + m_builder.AssignInMap(pContainer, m_pKeyNode, pNode); + m_pKeyNode = NULL; + } else { + m_pKeyNode = pNode; + } + } else { + m_builder.AppendToSequence(pContainer, pNode); + } +} +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilderadapter.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilderadapter.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilderadapter.h new file mode 100644 index 0000000..0d1e579 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/contrib/graphbuilderadapter.h @@ -0,0 +1,79 @@ +#ifndef GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define GRAPHBUILDERADAPTER_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 +#include +#include + +#include "yaml-cpp/anchor.h" +#include "yaml-cpp/contrib/anchordict.h" +#include "yaml-cpp/contrib/graphbuilder.h" +#include "yaml-cpp/emitterstyle.h" +#include "yaml-cpp/eventhandler.h" + +namespace YAML { +class GraphBuilderInterface; +struct Mark; +} // namespace YAML + +namespace YAML { +class GraphBuilderAdapter : public EventHandler { + public: + GraphBuilderAdapter(GraphBuilderInterface& builder) + : m_builder(builder), m_pRootNode(NULL), m_pKeyNode(NULL) {} + + virtual void OnDocumentStart(const Mark& mark) { (void)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(); + + void* RootNode() const { return m_pRootNode; } + + private: + struct ContainerFrame { + ContainerFrame(void* pSequence) + : pContainer(pSequence), pPrevKeyNode(&sequenceMarker) {} + ContainerFrame(void* pMap, void* pPrevKeyNode) + : pContainer(pMap), pPrevKeyNode(pPrevKeyNode) {} + + void* pContainer; + void* pPrevKeyNode; + + bool isMap() const { return pPrevKeyNode != &sequenceMarker; } + + private: + static int sequenceMarker; + }; + typedef std::stack ContainerStack; + typedef AnchorDict AnchorMap; + + GraphBuilderInterface& m_builder; + ContainerStack m_containers; + AnchorMap m_anchors; + void* m_pRootNode; + void* m_pKeyNode; + + void* GetCurrentParent() const; + void RegisterAnchor(anchor_t anchor, void* pNode); + void DispositionNode(void* pNode); +}; +} + +#endif // GRAPHBUILDERADAPTER_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/convert.cpp ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/convert.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/convert.cpp new file mode 100644 index 0000000..ec05b77 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/convert.cpp @@ -0,0 +1,75 @@ +#include + +#include "yaml-cpp/node/convert.h" + +namespace { +// we're not gonna mess with the mess that is all the isupper/etc. functions +bool IsLower(char ch) { return 'a' <= ch && ch <= 'z'; } +bool IsUpper(char ch) { return 'A' <= ch && ch <= 'Z'; } +char ToLower(char ch) { return IsUpper(ch) ? ch + 'a' - 'A' : ch; } + +std::string tolower(const std::string& str) { + std::string s(str); + std::transform(s.begin(), s.end(), s.begin(), ToLower); + return s; +} + +template +bool IsEntirely(const std::string& str, T func) { + for (std::size_t i = 0; i < str.size(); i++) + if (!func(str[i])) + return false; + + return true; +} + +// IsFlexibleCase +// . Returns true if 'str' is: +// . UPPERCASE +// . lowercase +// . Capitalized +bool IsFlexibleCase(const std::string& str) { + if (str.empty()) + return true; + + if (IsEntirely(str, IsLower)) + return true; + + bool firstcaps = IsUpper(str[0]); + std::string rest = str.substr(1); + return firstcaps && (IsEntirely(rest, IsLower) || IsEntirely(rest, IsUpper)); +} +} + +namespace YAML { +bool convert::decode(const Node& node, bool& rhs) { + if (!node.IsScalar()) + return false; + + // we can't use iostream bool extraction operators as they don't + // recognize all possible values in the table below (taken from + // http://yaml.org/type/bool.html) + static const struct { + std::string truename, falsename; + } names[] = { + {"y", "n"}, {"yes", "no"}, {"true", "false"}, {"on", "off"}, + }; + + if (!IsFlexibleCase(node.Scalar())) + return false; + + for (unsigned i = 0; i < sizeof(names) / sizeof(names[0]); i++) { + if (names[i].truename == tolower(node.Scalar())) { + rhs = true; + return true; + } + + if (names[i].falsename == tolower(node.Scalar())) { + rhs = false; + return true; + } + } + + return false; +} +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/directives.cpp ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/directives.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/directives.cpp new file mode 100644 index 0000000..963bd2c --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/directives.cpp @@ -0,0 +1,22 @@ +#include "directives.h" + +namespace YAML { +Directives::Directives() { + // version + version.isDefault = true; + version.major = 1; + version.minor = 2; +} + +const std::string Directives::TranslateTagHandle( + const std::string& handle) const { + std::map::const_iterator it = tags.find(handle); + if (it == tags.end()) { + if (handle == "!!") + return "tag:yaml.org,2002:"; + return handle; + } + + return it->second; +} +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/directives.h ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/directives.h b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/directives.h new file mode 100644 index 0000000..333af26 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/directives.h @@ -0,0 +1,29 @@ +#ifndef DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66 +#define DIRECTIVES_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 +#include + +namespace YAML { +struct Version { + bool isDefault; + int major, minor; +}; + +struct Directives { + Directives(); + + const std::string TranslateTagHandle(const std::string& handle) const; + + Version version; + std::map tags; +}; +} + +#endif // DIRECTIVES_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/emit.cpp ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emit.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emit.cpp new file mode 100644 index 0000000..51bc791 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emit.cpp @@ -0,0 +1,25 @@ +#include "yaml-cpp/node/emit.h" +#include "yaml-cpp/emitfromevents.h" +#include "yaml-cpp/emitter.h" +#include "nodeevents.h" + +namespace YAML { +Emitter& operator<<(Emitter& out, const Node& node) { + EmitFromEvents emitFromEvents(out); + NodeEvents events(node); + events.Emit(emitFromEvents); + return out; +} + +std::ostream& operator<<(std::ostream& out, const Node& node) { + Emitter emitter(out); + emitter << node; + return out; +} + +std::string Dump(const Node& node) { + Emitter emitter; + emitter << node; + return emitter.c_str(); +} +} // namespace YAML http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/1d6b2416/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitfromevents.cpp ---------------------------------------------------------------------- diff --git a/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitfromevents.cpp b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitfromevents.cpp new file mode 100644 index 0000000..4832649 --- /dev/null +++ b/thirdparty/yaml-cpp-yaml-cpp-20171024/src/emitfromevents.cpp @@ -0,0 +1,119 @@ +#include +#include + +#include "yaml-cpp/emitfromevents.h" +#include "yaml-cpp/emitter.h" +#include "yaml-cpp/emittermanip.h" +#include "yaml-cpp/null.h" + +namespace YAML { +struct Mark; +} // namespace YAML + +namespace { +std::string ToString(YAML::anchor_t anchor) { + std::stringstream stream; + stream << anchor; + return stream.str(); +} +} + +namespace YAML { +EmitFromEvents::EmitFromEvents(Emitter& emitter) : m_emitter(emitter) {} + +void EmitFromEvents::OnDocumentStart(const Mark&) {} + +void EmitFromEvents::OnDocumentEnd() {} + +void EmitFromEvents::OnNull(const Mark&, anchor_t anchor) { + BeginNode(); + EmitProps("", anchor); + m_emitter << Null; +} + +void EmitFromEvents::OnAlias(const Mark&, anchor_t anchor) { + BeginNode(); + m_emitter << Alias(ToString(anchor)); +} + +void EmitFromEvents::OnScalar(const Mark&, const std::string& tag, + anchor_t anchor, const std::string& value) { + BeginNode(); + EmitProps(tag, anchor); + m_emitter << value; +} + +void EmitFromEvents::OnSequenceStart(const Mark&, const std::string& tag, + anchor_t anchor, + EmitterStyle::value style) { + BeginNode(); + EmitProps(tag, anchor); + switch (style) { + case EmitterStyle::Block: + m_emitter << Block; + break; + case EmitterStyle::Flow: + m_emitter << Flow; + break; + default: + break; + } + m_emitter << BeginSeq; + m_stateStack.push(State::WaitingForSequenceEntry); +} + +void EmitFromEvents::OnSequenceEnd() { + m_emitter << EndSeq; + assert(m_stateStack.top() == State::WaitingForSequenceEntry); + m_stateStack.pop(); +} + +void EmitFromEvents::OnMapStart(const Mark&, const std::string& tag, + anchor_t anchor, EmitterStyle::value style) { + BeginNode(); + EmitProps(tag, anchor); + switch (style) { + case EmitterStyle::Block: + m_emitter << Block; + break; + case EmitterStyle::Flow: + m_emitter << Flow; + break; + default: + break; + } + m_emitter << BeginMap; + m_stateStack.push(State::WaitingForKey); +} + +void EmitFromEvents::OnMapEnd() { + m_emitter << EndMap; + assert(m_stateStack.top() == State::WaitingForKey); + m_stateStack.pop(); +} + +void EmitFromEvents::BeginNode() { + if (m_stateStack.empty()) + return; + + switch (m_stateStack.top()) { + case State::WaitingForKey: + m_emitter << Key; + m_stateStack.top() = State::WaitingForValue; + break; + case State::WaitingForValue: + m_emitter << Value; + m_stateStack.top() = State::WaitingForKey; + break; + default: + break; + } +} + +void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) { + if (!tag.empty() && tag != "?" && tag != "!") + m_emitter << VerbatimTag(tag); + if (anchor) + m_emitter << Anchor(ToString(anchor)); +} +}