Revert "Apply formatting/style tweaks to comply with compile time diagnostics for...
authorAdrian Bunk <bunk@debian.org>
Sun, 10 May 2020 08:39:29 +0000 (11:39 +0300)
committerRaspbian forward porter <root@raspbian.org>
Thu, 26 Aug 2021 22:24:06 +0000 (23:24 +0100)
This reverts commit 0d5c57150cebb430fcc216d8066dbb28aeaafe8e.

Gbp-Pq: Name 0004-Revert-Apply-formatting-style-tweaks-to-comply-with-.patch

40 files changed:
CMakeLists.txt
include/yaml-cpp/binary.h
include/yaml-cpp/contrib/anchordict.h
include/yaml-cpp/emitter.h
include/yaml-cpp/node/detail/memory.h
include/yaml-cpp/node/detail/node.h
include/yaml-cpp/node/impl.h
include/yaml-cpp/noncopyable.h [new file with mode: 0644]
include/yaml-cpp/ostream_wrapper.h
include/yaml-cpp/parser.h
src/collectionstack.h
src/contrib/graphbuilderadapter.h
src/directives.cpp
src/emitfromevents.cpp
src/emitter.cpp
src/emitterstate.cpp
src/emitterstate.h
src/emitterutils.cpp
src/exp.h
src/node_data.cpp
src/nodebuilder.cpp
src/nodebuilder.h
src/nodeevents.cpp
src/nodeevents.h
src/ostream_wrapper.cpp
src/parser.cpp
src/ptr_vector.h
src/regex_yaml.cpp
src/regex_yaml.h
src/scanner.cpp
src/scantoken.cpp
src/setting.h
src/singledocparser.cpp
src/singledocparser.h
src/stream.cpp
src/stream.h
src/streamcharsource.h
src/tag.cpp
src/token.h
test/regex_test.cpp

index 59ce2c749329ba62120d8ce128b1a2938b76a068..cc7b1553d4d3a76f83dc10e8b66661886dae1093 100644 (file)
@@ -168,7 +168,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
                set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} -fPIC")
        endif()
        #
-       set(FLAG_TESTED "-Wextra -Wshadow -Weffc++ -pedantic -pedantic-errors")
+       set(FLAG_TESTED "-Wextra")
        check_cxx_compiler_flag(${FLAG_TESTED} FLAG_WEXTRA)
        if(FLAG_WEXTRA)
                set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} ${FLAG_TESTED}")
index 0267a3ad9fc854e3e3143aa2481856f221f7382c..29d5dbd027a94bd1c7874b0889bb4ee903c89cfa 100644 (file)
@@ -19,13 +19,9 @@ YAML_CPP_API std::vector<unsigned char> DecodeBase64(const std::string &input);
 
 class YAML_CPP_API Binary {
  public:
+  Binary() : m_unownedData(0), m_unownedSize(0) {}
   Binary(const unsigned char *data_, std::size_t size_)
-      : m_data{}, m_unownedData(data_), m_unownedSize(size_) {}
-  Binary() : Binary(nullptr, 0) {}
-  Binary(const Binary &) = default;
-  Binary(Binary &&) = default;
-  Binary &operator=(const Binary &) = default;
-  Binary &operator=(Binary &&) = default;
+      : m_unownedData(data_), m_unownedSize(size_) {}
 
   bool owned() const { return !m_unownedData; }
   std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; }
@@ -66,6 +62,6 @@ class YAML_CPP_API Binary {
   const unsigned char *m_unownedData;
   std::size_t m_unownedSize;
 };
-}  // namespace YAML
+}
 
 #endif  // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 1b7809b875f6ea8d5933ce8e5720955f935c0f78..78db9ec9288275e2b283d2dbfe134ed7b247350b 100644 (file)
@@ -22,7 +22,6 @@ namespace YAML {
 template <class T>
 class AnchorDict {
  public:
-  AnchorDict() : m_data{} {}
   void Register(anchor_t anchor, T value) {
     if (anchor > m_data.size()) {
       m_data.resize(anchor);
@@ -35,6 +34,6 @@ class AnchorDict {
  private:
   std::vector<T> m_data;
 };
-}  // namespace YAML
+}
 
 #endif  // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 6f142b011600b2007079d846b2b0d9c6a59d6d09..bf723ab88d8dc6d4510d1a57bb6d9eb988eed443 100644 (file)
@@ -19,6 +19,7 @@
 #include "yaml-cpp/dll.h"
 #include "yaml-cpp/emitterdef.h"
 #include "yaml-cpp/emittermanip.h"
+#include "yaml-cpp/noncopyable.h"
 #include "yaml-cpp/null.h"
 #include "yaml-cpp/ostream_wrapper.h"
 
@@ -30,12 +31,10 @@ struct _Null;
 namespace YAML {
 class EmitterState;
 
-class YAML_CPP_API Emitter {
+class YAML_CPP_API Emitter : private noncopyable {
  public:
   Emitter();
   explicit Emitter(std::ostream& stream);
-  Emitter(const Emitter&) = delete;
-  Emitter& operator=(const Emitter&) = delete;
   ~Emitter();
 
   // output
@@ -274,6 +273,6 @@ inline Emitter& operator<<(Emitter& emitter, _Indent indent) {
 inline Emitter& operator<<(Emitter& emitter, _Precision precision) {
   return emitter.SetLocalPrecision(precision);
 }
-}  // namespace YAML
+}
 
 #endif  // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index a4df0f75832693ddaffa8bb9230a034e53f9bbe8..8f2bc2657a22861a03f0b4e1dd6fadf2acf8da3a 100644 (file)
@@ -22,7 +22,6 @@ namespace YAML {
 namespace detail {
 class YAML_CPP_API memory {
  public:
-  memory() : m_nodes{} {}
   node& create_node();
   void merge(const memory& rhs);
 
@@ -41,7 +40,7 @@ class YAML_CPP_API memory_holder {
  private:
   shared_memory m_pMemory;
 };
-}  // namespace detail
-}  // namespace YAML
+}
+}
 
 #endif  // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index a2cc52b76bfc2cb2f91dd8bf04aaab88a608f890..8a776f62a9e3c736d529d2fae22b71cdeca9f293 100644 (file)
@@ -7,18 +7,18 @@
 #pragma once
 #endif
 
-#include "yaml-cpp/dll.h"
 #include "yaml-cpp/emitterstyle.h"
-#include "yaml-cpp/node/detail/node_ref.h"
-#include "yaml-cpp/node/ptr.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 <set>
 
 namespace YAML {
 namespace detail {
 class node {
  public:
-  node() : m_pRef(new node_ref), m_dependencies{} {}
+  node() : m_pRef(new node_ref) {}
   node(const node&) = delete;
   node& operator=(const node&) = delete;
 
@@ -163,7 +163,7 @@ class node {
   typedef std::set<node*> nodes;
   nodes m_dependencies;
 };
-}  // namespace detail
-}  // namespace YAML
+}
+}
 
 #endif  // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 8346f40ddcaed735c5fc27bc08d8feaa07915f13..de2bf443363cdea2db4f8ddcdeffe7b4f3520552 100644 (file)
@@ -7,15 +7,15 @@
 #pragma once
 #endif
 
-#include "yaml-cpp/exceptions.h"
+#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/node/iterator.h"
-#include "yaml-cpp/node/node.h"
+#include "yaml-cpp/exceptions.h"
 #include <string>
 
 namespace YAML {
-inline Node::Node() : m_isValid(true), m_pMemory(nullptr), m_pNode(nullptr) {}
+inline Node::Node() : m_isValid(true), m_pNode(NULL) {}
 
 inline Node::Node(NodeType::value type)
     : m_isValid(true),
@@ -42,7 +42,7 @@ inline Node::Node(const Node& rhs)
       m_pMemory(rhs.m_pMemory),
       m_pNode(rhs.m_pNode) {}
 
-inline Node::Node(Zombie) : m_isValid(false), m_pMemory{}, m_pNode(nullptr) {}
+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) {}
@@ -202,15 +202,6 @@ inline Node& Node::operator=(const T& rhs) {
   return *this;
 }
 
-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::reset(const YAML::Node& rhs) {
   if (!m_isValid || !rhs.m_isValid)
     throw InvalidNode();
@@ -247,6 +238,15 @@ inline void Node::Assign(char* rhs) {
   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();
@@ -366,7 +366,7 @@ template <typename T>
 inline typename to_value_t<T>::return_type to_value(const T& t) {
   return to_value_t<T>(t)();
 }
-}  // namespace detail
+}
 
 // indexing
 template <typename Key>
@@ -374,8 +374,8 @@ inline const Node Node::operator[](const Key& key) const {
   if (!m_isValid)
     throw InvalidNode();
   EnsureNodeExists();
-  detail::node* value = static_cast<const detail::node&>(*m_pNode).get(
-      detail::to_value(key), m_pMemory);
+  detail::node* value = static_cast<const detail::node&>(*m_pNode)
+                            .get(detail::to_value(key), m_pMemory);
   if (!value) {
     return Node(ZombieNode);
   }
@@ -443,6 +443,6 @@ inline void Node::force_insert(const Key& key, const Value& value) {
 
 // free functions
 inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
-}  // namespace YAML
+}
 
 #endif  // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/include/yaml-cpp/noncopyable.h b/include/yaml-cpp/noncopyable.h
new file mode 100644 (file)
index 0000000..a261040
--- /dev/null
@@ -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
index 259801bcb75f4e03f13ae1bbc68efc5afa399da9..09d45f39b78b15ee34ce2e993126d54d229c11ee 100644 (file)
@@ -17,10 +17,6 @@ class YAML_CPP_API ostream_wrapper {
  public:
   ostream_wrapper();
   explicit ostream_wrapper(std::ostream& stream);
-  ostream_wrapper(const ostream_wrapper&) = delete;
-  ostream_wrapper(ostream_wrapper&&) = delete;
-  ostream_wrapper& operator=(const ostream_wrapper&) = delete;
-  ostream_wrapper& operator=(ostream_wrapper&&) = delete;
   ~ostream_wrapper();
 
   void write(const std::string& str);
@@ -56,7 +52,7 @@ class YAML_CPP_API ostream_wrapper {
 
 template <std::size_t N>
 inline ostream_wrapper& operator<<(ostream_wrapper& stream,
-                                   const char (&str)[N]) {
+                                   const char(&str)[N]) {
   stream.write(str, N - 1);
   return stream;
 }
@@ -71,6 +67,6 @@ inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) {
   stream.write(&ch, 1);
   return stream;
 }
-}  // namespace YAML
+}
 
 #endif  // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index e9fba0c01f68aef5a1281746ae0ff7d7dc5b52c3..ceac22d026892913e7f7fb221e717b07fd556316 100644 (file)
@@ -11,6 +11,7 @@
 #include <memory>
 
 #include "yaml-cpp/dll.h"
+#include "yaml-cpp/noncopyable.h"
 
 namespace YAML {
 class EventHandler;
@@ -23,17 +24,11 @@ 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 {
+class YAML_CPP_API Parser : private noncopyable {
  public:
   /** Constructs an empty parser (with no input. */
   Parser();
 
-  /** non copyable but movable */
-  Parser(const Parser&) = delete;
-  Parser(Parser&&) = default;
-  Parser& operator=(const Parser&) = delete;
-  Parser& operator=(Parser&&) = default;
-
   /**
    * Constructs a parser from the given input stream. The input stream must
    * live as long as the parser.
@@ -86,6 +81,6 @@ class YAML_CPP_API Parser {
   std::unique_ptr<Scanner> m_pScanner;
   std::unique_ptr<Directives> m_pDirectives;
 };
-}  // namespace YAML
+}
 
 #endif  // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 9feba967951f7eaba7b3f029e63917a65a4ef3ae..ebdc5873612f590f931694953e37b222360e048a 100644 (file)
@@ -7,8 +7,8 @@
 #pragma once
 #endif
 
-#include <cassert>
 #include <stack>
+#include <cassert>
 
 namespace YAML {
 struct CollectionType {
@@ -17,7 +17,6 @@ struct CollectionType {
 
 class CollectionStack {
  public:
-  CollectionStack() : collectionStack{} {}
   CollectionType::value GetCurCollectionType() const {
     if (collectionStack.empty())
       return CollectionType::NoCollection;
@@ -36,6 +35,6 @@ class CollectionStack {
  private:
   std::stack<CollectionType::value> collectionStack;
 };
-}  // namespace YAML
+}
 
 #endif  // COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 9078cdfdacdd625c570c58bf32ec079cee6b3787..62b40a135696228adb6001190efc104dc5144c41 100644 (file)
@@ -26,15 +26,7 @@ namespace YAML {
 class GraphBuilderAdapter : public EventHandler {
  public:
   GraphBuilderAdapter(GraphBuilderInterface& builder)
-      : m_builder(builder),
-        m_containers{},
-        m_anchors{},
-        m_pRootNode(nullptr),
-        m_pKeyNode(nullptr) {}
-  GraphBuilderAdapter(const GraphBuilderAdapter&) = delete;
-  GraphBuilderAdapter(GraphBuilderAdapter&&) = delete;
-  GraphBuilderAdapter& operator=(const GraphBuilderAdapter&) = delete;
-  GraphBuilderAdapter& operator=(GraphBuilderAdapter&&) = delete;
+      : m_builder(builder), m_pRootNode(nullptr), m_pKeyNode(nullptr) {}
 
   virtual void OnDocumentStart(const Mark& mark) { (void)mark; }
   virtual void OnDocumentEnd() {}
@@ -58,8 +50,8 @@ class GraphBuilderAdapter : public EventHandler {
   struct ContainerFrame {
     ContainerFrame(void* pSequence)
         : pContainer(pSequence), pPrevKeyNode(&sequenceMarker) {}
-    ContainerFrame(void* pMap, void* pPreviousKeyNode)
-        : pContainer(pMap), pPrevKeyNode(pPreviousKeyNode) {}
+    ContainerFrame(void* pMap, void* pPrevKeyNode)
+        : pContainer(pMap), pPrevKeyNode(pPrevKeyNode) {}
 
     void* pContainer;
     void* pPrevKeyNode;
@@ -82,6 +74,6 @@ class GraphBuilderAdapter : public EventHandler {
   void RegisterAnchor(anchor_t anchor, void* pNode);
   void DispositionNode(void* pNode);
 };
-}  // namespace YAML
+}
 
 #endif  // GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 0c85d0ff37ab837fb19436036bdda5762b727fd0..963bd2cd379a01753a374dea72f08127dd8c7a06 100644 (file)
@@ -1,7 +1,12 @@
 #include "directives.h"
 
 namespace YAML {
-Directives::Directives() : version{true, 1, 2}, tags{} {}
+Directives::Directives() {
+  // version
+  version.isDefault = true;
+  version.major = 1;
+  version.minor = 2;
+}
 
 const std::string Directives::TranslateTagHandle(
     const std::string& handle) const {
@@ -14,4 +19,4 @@ const std::string Directives::TranslateTagHandle(
 
   return it->second;
 }
-}  // namespace YAML
+}
index 5a51bb471e3d217bd8b04f2d4abfeed00fd08c5f..4832649f3c747133a779a54ec8ac29c64aa47683 100644 (file)
@@ -16,11 +16,10 @@ std::string ToString(YAML::anchor_t anchor) {
   stream << anchor;
   return stream.str();
 }
-}  // namespace
+}
 
 namespace YAML {
-EmitFromEvents::EmitFromEvents(Emitter& emitter)
-    : m_emitter(emitter), m_stateStack{} {}
+EmitFromEvents::EmitFromEvents(Emitter& emitter) : m_emitter(emitter) {}
 
 void EmitFromEvents::OnDocumentStart(const Mark&) {}
 
@@ -117,4 +116,4 @@ void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) {
   if (anchor)
     m_emitter << Anchor(ToString(anchor));
 }
-}  // namespace YAML
+}
index 016beb12c0d398bd2285669fd05ed9bcc1c18e45..68722521e4e0b8cf4c8bf0579f050248f4df3323 100644 (file)
@@ -11,7 +11,7 @@ namespace YAML {
 class Binary;
 struct _Null;
 
-Emitter::Emitter() : m_pState(new EmitterState), m_stream{} {}
+Emitter::Emitter() : m_pState(new EmitterState) {}
 
 Emitter::Emitter(std::ostream& stream)
     : m_pState(new EmitterState), m_stream(stream) {}
@@ -906,4 +906,4 @@ Emitter& Emitter::Write(const Binary& binary) {
 
   return *this;
 }
-}  // namespace YAML
+}
index 890b4f0d2e77f2e9a9a62e3ff24eedc9be37b459..d5f39e7836660b9474f407a3c47068a11a95f747 100644 (file)
@@ -6,31 +6,27 @@
 namespace YAML {
 EmitterState::EmitterState()
     : m_isGood(true),
-      m_lastError{},
-      // default global manipulators
-      m_charset(EmitNonAscii),
-      m_strFmt(Auto),
-      m_boolFmt(TrueFalseBool),
-      m_boolLengthFmt(LongBool),
-      m_boolCaseFmt(LowerCase),
-      m_intFmt(Dec),
-      m_indent(2),
-      m_preCommentIndent(2),
-      m_postCommentIndent(1),
-      m_seqFmt(Block),
-      m_mapFmt(Block),
-      m_mapKeyFmt(Auto),
-      m_floatPrecision(std::numeric_limits<float>::max_digits10),
-      m_doublePrecision(std::numeric_limits<double>::max_digits10),
-      //
-      m_modifiedSettings{},
-      m_globalModifiedSettings{},
-      m_groups{},
       m_curIndent(0),
       m_hasAnchor(false),
       m_hasTag(false),
       m_hasNonContent(false),
-      m_docCount(0) {}
+      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>::max_digits10);
+  m_doublePrecision.set(std::numeric_limits<double>::max_digits10);
+}
 
 EmitterState::~EmitterState() {}
 
@@ -366,4 +362,4 @@ bool EmitterState::SetDoublePrecision(std::size_t value,
   _Set(m_doublePrecision, value, scope);
   return true;
 }
-}  // namespace YAML
+}
index 75e216695cddd82ab8784f0837cc67ddd7d5ed8e..0937f000d9f4eb2c5fb6c7ce2f1bd2184478882b 100644 (file)
@@ -145,12 +145,7 @@ class EmitterState {
 
   struct Group {
     explicit Group(GroupType::value type_)
-        : type(type_),
-          flowType{},
-          indent(0),
-          childCount(0),
-          longKey(false),
-          modifiedSettings{} {}
+        : type(type_), indent(0), childCount(0), longKey(false) {}
 
     GroupType::value type;
     FlowType::value flowType;
@@ -203,6 +198,6 @@ void EmitterState::_Set(Setting<T>& fmt, T value, FmtScope::value scope) {
       assert(false);
   }
 }
-}  // namespace YAML
+}
 
 #endif  // EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index e348599d53d8dc3247fb8292e5e0abe091bcc4ec..e02931f950f423b826a2d193de32e6b79adb2037 100644 (file)
@@ -8,8 +8,8 @@
 #include "regeximpl.h"
 #include "stringsource.h"
 #include "yaml-cpp/binary.h"  // IWYU pragma: keep
-#include "yaml-cpp/null.h"
 #include "yaml-cpp/ostream_wrapper.h"
+#include "yaml-cpp/null.h"
 
 namespace YAML {
 namespace Utils {
@@ -173,12 +173,12 @@ bool IsValidPlainScalar(const std::string& str, FlowType::value flowType,
 
   // 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::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::EndScalar() || (Exp::BlankOrBreak() + Exp::Comment()) ||
+      Exp::NotPrintable() || Exp::Utf8_ByteOrderMark() || Exp::Break() ||
       Exp::Tab();
   const RegEx& disallowed =
       flowType == FlowType::Flow ? disallowed_flow : disallowed_block;
@@ -258,7 +258,7 @@ bool WriteAliasName(ostream_wrapper& out, const std::string& str) {
   }
   return true;
 }
-}  // namespace
+}
 
 StringFormat::value ComputeStringFormat(const std::string& str,
                                         EMITTER_MANIP strFormat,
@@ -401,8 +401,8 @@ bool WriteComment(ostream_wrapper& out, const std::string& str,
   for (std::string::const_iterator i = str.begin();
        GetNextCodePointAndAdvance(codePoint, i, str.end());) {
     if (codePoint == '\n') {
-      out << "\n"
-          << IndentTo(curIndent) << "#" << Indentation(postCommentIndent);
+      out << "\n" << IndentTo(curIndent) << "#"
+          << Indentation(postCommentIndent);
       out.set_comment();
     } else {
       WriteCodePoint(out, codePoint);
@@ -479,5 +479,5 @@ bool WriteBinary(ostream_wrapper& out, const Binary& binary) {
                           false);
   return true;
 }
-}  // namespace Utils
-}  // namespace YAML
+}
+}
index fe36535b57833b6f48aa65174c57eb0247bb15ac..7c02cf6e4515868014e7b4bf3ec6c39bc771a57a 100644 (file)
--- a/src/exp.h
+++ b/src/exp.h
@@ -33,15 +33,15 @@ inline const RegEx& Tab() {
   return e;
 }
 inline const RegEx& Blank() {
-  static const RegEx e = Space() | Tab();
+  static const RegEx e = Space() || Tab();
   return e;
 }
 inline const RegEx& Break() {
-  static const RegEx e = RegEx('\n') | RegEx("\r\n");
+  static const RegEx e = RegEx('\n') || RegEx("\r\n");
   return e;
 }
 inline const RegEx& BlankOrBreak() {
-  static const RegEx e = Blank() | Break();
+  static const RegEx e = Blank() || Break();
   return e;
 }
 inline const RegEx& Digit() {
@@ -49,29 +49,29 @@ inline const RegEx& Digit() {
   return e;
 }
 inline const RegEx& Alpha() {
-  static const RegEx e = RegEx('a', 'z') | RegEx('A', 'Z');
+  static const RegEx e = RegEx('a', 'z') || RegEx('A', 'Z');
   return e;
 }
 inline const RegEx& AlphaNumeric() {
-  static const RegEx e = Alpha() | Digit();
+  static const RegEx e = Alpha() || Digit();
   return e;
 }
 inline const RegEx& Word() {
-  static const RegEx e = AlphaNumeric() | RegEx('-');
+  static const RegEx e = AlphaNumeric() || RegEx('-');
   return e;
 }
 inline const RegEx& Hex() {
-  static const RegEx e = Digit() | RegEx('A', 'F') | RegEx('a', 'f');
+  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')));
+      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() {
@@ -82,19 +82,19 @@ inline const RegEx& Utf8_ByteOrderMark() {
 // actual tags
 
 inline const RegEx& DocStart() {
-  static const RegEx e = RegEx("---") + (BlankOrBreak() | RegEx());
+  static const RegEx e = RegEx("---") + (BlankOrBreak() || RegEx());
   return e;
 }
 inline const RegEx& DocEnd() {
-  static const RegEx e = RegEx("...") + (BlankOrBreak() | RegEx());
+  static const RegEx e = RegEx("...") + (BlankOrBreak() || RegEx());
   return e;
 }
 inline const RegEx& DocIndicator() {
-  static const RegEx e = DocStart() | DocEnd();
+  static const RegEx e = DocStart() || DocEnd();
   return e;
 }
 inline const RegEx& BlockEntry() {
-  static const RegEx e = RegEx('-') + (BlankOrBreak() | RegEx());
+  static const RegEx e = RegEx('-') + (BlankOrBreak() || RegEx());
   return e;
 }
 inline const RegEx& Key() {
@@ -106,11 +106,11 @@ inline const RegEx& KeyInFlow() {
   return e;
 }
 inline const RegEx& Value() {
-  static const RegEx e = RegEx(':') + (BlankOrBreak() | RegEx());
+  static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx());
   return e;
 }
 inline const RegEx& ValueInFlow() {
-  static const RegEx e = RegEx(':') + (BlankOrBreak() | RegEx(",}", REGEX_OR));
+  static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx(",}", REGEX_OR));
   return e;
 }
 inline const RegEx& ValueInJSONFlow() {
@@ -122,20 +122,20 @@ inline const RegEx Comment() {
   return e;
 }
 inline const RegEx& Anchor() {
-  static const RegEx e = !(RegEx("[]{},", REGEX_OR) | BlankOrBreak());
+  static const RegEx e = !(RegEx("[]{},", REGEX_OR) || BlankOrBreak());
   return e;
 }
 inline const RegEx& AnchorEnd() {
-  static const RegEx e = RegEx("?:,]}%@`", REGEX_OR) | BlankOrBreak();
+  static const RegEx e = RegEx("?:,]}%@`", REGEX_OR) || BlankOrBreak();
   return e;
 }
 inline const RegEx& URI() {
-  static const RegEx e = Word() | RegEx("#;/?:@&=+$,_.!~*'()[]", REGEX_OR) |
+  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) |
+  static const RegEx e = Word() || RegEx("#;/?:@&=+$_.~*'()", REGEX_OR) ||
                          (RegEx('%') + Hex() + Hex());
   return e;
 }
@@ -148,34 +148,34 @@ inline const RegEx& Tag() {
 // space.
 inline const RegEx& PlainScalar() {
   static const RegEx e =
-      !(BlankOrBreak() | RegEx(",[]{}#&*!|>\'\"%@`", REGEX_OR) |
-        (RegEx("-?:", REGEX_OR) + (BlankOrBreak() | RegEx())));
+      !(BlankOrBreak() || RegEx(",[]{}#&*!|>\'\"%@`", REGEX_OR) ||
+        (RegEx("-?:", REGEX_OR) + (BlankOrBreak() || RegEx())));
   return e;
 }
 inline const RegEx& PlainScalarInFlow() {
   static const RegEx e =
-      !(BlankOrBreak() | RegEx("?,[]{}#&*!|>\'\"%@`", REGEX_OR) |
+      !(BlankOrBreak() || RegEx("?,[]{}#&*!|>\'\"%@`", REGEX_OR) ||
         (RegEx("-:", REGEX_OR) + Blank()));
   return e;
 }
 inline const RegEx& EndScalar() {
-  static const RegEx e = RegEx(':') + (BlankOrBreak() | RegEx());
+  static const RegEx e = RegEx(':') + (BlankOrBreak() || RegEx());
   return e;
 }
 inline const RegEx& EndScalarInFlow() {
   static const RegEx e =
-      (RegEx(':') + (BlankOrBreak() | RegEx() | RegEx(",]}", REGEX_OR))) |
+      (RegEx(':') + (BlankOrBreak() || RegEx() || RegEx(",]}", REGEX_OR))) ||
       RegEx(",?[]{}", REGEX_OR);
   return e;
 }
 
 inline const RegEx& ScanScalarEndInFlow() {
-  static const RegEx e = (EndScalarInFlow() | (BlankOrBreak() + Comment()));
+  static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment()));
   return e;
 }
 
 inline const RegEx& ScanScalarEnd() {
-  static const RegEx e = EndScalar() | (BlankOrBreak() + Comment());
+  static const RegEx e = EndScalar() || (BlankOrBreak() + Comment());
   return e;
 }
 inline const RegEx& EscSingleQuote() {
@@ -192,8 +192,8 @@ inline const RegEx& ChompIndicator() {
   return e;
 }
 inline const RegEx& Chomp() {
-  static const RegEx e = (ChompIndicator() + Digit()) |
-                         (Digit() + ChompIndicator()) | ChompIndicator() |
+  static const RegEx e = (ChompIndicator() + Digit()) ||
+                         (Digit() + ChompIndicator()) || ChompIndicator() ||
                          Digit();
   return e;
 }
index c65accb046e1081069e50e73106ce17df2c4a103..04104b79f060b6b56933c349a2fbe4fbdcdd68a5 100644 (file)
@@ -14,21 +14,16 @@ namespace YAML {
 namespace detail {
 
 const std::string& node_data::empty_scalar() {
-  static const std::string svalue;
-  return svalue;
+    static const std::string svalue;
+    return svalue;
 }
 
 node_data::node_data()
     : m_isDefined(false),
       m_mark(Mark::null_mark()),
       m_type(NodeType::Null),
-      m_tag{},
       m_style(EmitterStyle::Default),
-      m_scalar{},
-      m_sequence{},
-      m_seqSize(0),
-      m_map{},
-      m_undefinedPairs{} {}
+      m_seqSize(0) {}
 
 void node_data::mark_defined() {
   if (m_type == NodeType::Undefined)
@@ -243,8 +238,8 @@ bool node_data::remove(node& key, shared_memory_holder /* pMemory */) {
   if (m_type != NodeType::Map)
     return false;
 
-  for (kv_pairs::iterator it = m_undefinedPairs.begin();
-       it != m_undefinedPairs.end();) {
+  kv_pairs::iterator it = m_undefinedPairs.begin();
+  while (it != m_undefinedPairs.end()) {
     kv_pairs::iterator jt = std::next(it);
     if (it->first->is(key))
       m_undefinedPairs.erase(it);
@@ -312,5 +307,5 @@ void node_data::convert_sequence_to_map(shared_memory_holder pMemory) {
   reset_sequence();
   m_type = NodeType::Map;
 }
-}  // namespace detail
-}  // namespace YAML
+}
+}
index c90a66cb878ead1d81ddb8d8628962bef9150efd..e79ac50a4c4273c50a8cf62f1d789e00a4761202 100644 (file)
@@ -11,12 +11,7 @@ namespace YAML {
 struct Mark;
 
 NodeBuilder::NodeBuilder()
-    : m_pMemory(new detail::memory_holder),
-      m_pRoot(nullptr),
-      m_stack{},
-      m_anchors{},
-      m_keys{},
-      m_mapDepth(0) {
+    : m_pMemory(new detail::memory_holder), m_pRoot(nullptr), m_mapDepth(0) {
   m_anchors.push_back(nullptr);  // since the anchors start at 1
 }
 
@@ -132,4 +127,4 @@ void NodeBuilder::RegisterAnchor(anchor_t anchor, detail::node& node) {
     m_anchors.push_back(&node);
   }
 }
-}  // namespace YAML
+}
index 642da36cc2a6099ef09acc39c15d067a758e97e7..a6a47f007bb709f14b58c9f3014b133d81bee313 100644 (file)
@@ -27,10 +27,6 @@ class Node;
 class NodeBuilder : public EventHandler {
  public:
   NodeBuilder();
-  NodeBuilder(const NodeBuilder&) = delete;
-  NodeBuilder(NodeBuilder&&) = delete;
-  NodeBuilder& operator=(const NodeBuilder&) = delete;
-  NodeBuilder& operator=(NodeBuilder&&) = delete;
   virtual ~NodeBuilder();
 
   Node Root();
@@ -69,6 +65,6 @@ class NodeBuilder : public EventHandler {
   std::vector<PushedKey> m_keys;
   std::size_t m_mapDepth;
 };
-}  // namespace YAML
+}
 
 #endif  // NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index b7222e068edf61d5b10fc62505c2ae4d045e4bc3..82261feb058673ff2ea3d8dc71971f91e139d081 100644 (file)
@@ -20,7 +20,7 @@ anchor_t NodeEvents::AliasManager::LookupAnchor(
 }
 
 NodeEvents::NodeEvents(const Node& node)
-    : m_pMemory(node.m_pMemory), m_root(node.m_pNode), m_refCount{} {
+    : m_pMemory(node.m_pMemory), m_root(node.m_pNode) {
   if (m_root)
     Setup(*m_root);
 }
@@ -98,4 +98,4 @@ 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;
 }
-}  // namespace YAML
+}
index dbed5d2066fc3171c8cef41c4b563c043c0bc774..49c18eb854a98c32d3ea630b4f7973db27c91de6 100644 (file)
@@ -26,17 +26,13 @@ class Node;
 class NodeEvents {
  public:
   explicit NodeEvents(const Node& node);
-  NodeEvents(const NodeEvents&) = delete;
-  NodeEvents(NodeEvents&&) = delete;
-  NodeEvents& operator=(const NodeEvents&) = delete;
-  NodeEvents& operator=(NodeEvents&&) = delete;
 
   void Emit(EventHandler& handler);
 
  private:
   class AliasManager {
    public:
-    AliasManager() : m_anchorByIdentity{}, m_curAnchor(0) {}
+    AliasManager() : m_curAnchor(0) {}
 
     void RegisterReference(const detail::node& node);
     anchor_t LookupAnchor(const detail::node& node) const;
@@ -63,6 +59,6 @@ class NodeEvents {
   typedef std::map<const detail::node_ref*, int> RefCount;
   RefCount m_refCount;
 };
-}  // namespace YAML
+}
 
 #endif  // NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 5fa5858973662f48016e7c6b52a96a9813a40163..a3c7597045424d7bc4383534ab9d308bb67e4522 100644 (file)
@@ -14,12 +14,7 @@ ostream_wrapper::ostream_wrapper()
       m_comment(false) {}
 
 ostream_wrapper::ostream_wrapper(std::ostream& stream)
-    : m_buffer{},
-      m_pStream(&stream),
-      m_pos(0),
-      m_row(0),
-      m_col(0),
-      m_comment(false) {}
+    : m_pStream(&stream), m_pos(0), m_row(0), m_col(0), m_comment(false) {}
 
 ostream_wrapper::~ostream_wrapper() {}
 
@@ -59,4 +54,4 @@ void ostream_wrapper::update_pos(char ch) {
     m_comment = false;
   }
 }
-}  // namespace YAML
+}
index 7bc0c7828af3d6098ab51e3b0c9aa3f623fee43d..cd69f39fcec6f28d54759977f59fdf91fd7c853f 100644 (file)
@@ -11,9 +11,9 @@
 namespace YAML {
 class EventHandler;
 
-Parser::Parser() : m_pScanner{}, m_pDirectives{} {}
+Parser::Parser() {}
 
-Parser::Parser(std::istream& in) : Parser() { Load(in); }
+Parser::Parser(std::istream& in) { Load(in); }
 
 Parser::~Parser() {}
 
@@ -126,4 +126,4 @@ void Parser::PrintTokens(std::ostream& out) {
     m_pScanner->pop();
   }
 }
-}  // namespace YAML
+}
index d58de04cb62c440246e1a5fcdc619ce93c560155..955aebd8d560c000934a5fd6e5cc354f26975171 100644 (file)
 #include <memory>
 #include <vector>
 
+#include "yaml-cpp/noncopyable.h"
+
 namespace YAML {
 
 // TODO: This class is no longer needed
 template <typename T>
-class ptr_vector {
+class ptr_vector : private YAML::noncopyable {
  public:
-  ptr_vector() : m_data{} {}
-  ptr_vector(const ptr_vector&) = delete;
-  ptr_vector(ptr_vector&&) = default;
-  ptr_vector& operator=(const ptr_vector&) = delete;
-  ptr_vector& operator=(ptr_vector&&) = default;
+  ptr_vector() {}
 
   void clear() { m_data.clear(); }
 
@@ -40,6 +38,6 @@ class ptr_vector {
  private:
   std::vector<std::unique_ptr<T>> m_data;
 };
-}  // namespace YAML
+}
 
 #endif  // PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index bf1784b41d5a577b54015f34172563aac7d7b6af..20b772051d237f6ce706029fc0e6fb7256c34cf3 100644 (file)
@@ -2,16 +2,18 @@
 
 namespace YAML {
 // constructors
+RegEx::RegEx() : m_op(REGEX_EMPTY) {}
 
-RegEx::RegEx(REGEX_OP op) : m_op(op), m_a(0), m_z(0), m_params{} {}
-RegEx::RegEx() : RegEx(REGEX_EMPTY) {}
+RegEx::RegEx(REGEX_OP op) : m_op(op) {}
 
-RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch), m_z(0), m_params{} {}
+RegEx::RegEx(char ch) : m_op(REGEX_MATCH), m_a(ch) {}
 
-RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z), m_params{} {}
+RegEx::RegEx(char a, char z) : m_op(REGEX_RANGE), m_a(a), m_z(z) {}
 
-RegEx::RegEx(const std::string& str, REGEX_OP op)
-    : m_op(op), m_a(0), m_z(0), m_params(str.begin(), str.end()) {}
+RegEx::RegEx(const std::string& str, REGEX_OP op) : m_op(op) {
+  for (std::size_t i = 0; i < str.size(); i++)
+    m_params.push_back(RegEx(str[i]));
+}
 
 // combination constructors
 RegEx operator!(const RegEx& ex) {
@@ -20,14 +22,14 @@ RegEx operator!(const RegEx& ex) {
   return ret;
 }
 
-RegEx operator|(const RegEx& ex1, const RegEx& ex2) {
+RegEx operator||(const RegEx& ex1, const RegEx& ex2) {
   RegEx ret(REGEX_OR);
   ret.m_params.push_back(ex1);
   ret.m_params.push_back(ex2);
   return ret;
 }
 
-RegEx operator&(const RegEx& ex1, const RegEx& ex2) {
+RegEx operator&&(const RegEx& ex1, const RegEx& ex2) {
   RegEx ret(REGEX_AND);
   ret.m_params.push_back(ex1);
   ret.m_params.push_back(ex2);
@@ -40,4 +42,4 @@ RegEx operator+(const RegEx& ex1, const RegEx& ex2) {
   ret.m_params.push_back(ex2);
   return ret;
 }
-}  // namespace YAML
+}
index 3a347bbd0826e6e87c5589fccb5df3c10fc39528..1611cb288819b3713a2e228ce4d60825ecdffc47 100644 (file)
@@ -31,14 +31,14 @@ enum REGEX_OP {
 class YAML_CPP_API RegEx {
  public:
   RegEx();
-  explicit RegEx(char ch);
+  RegEx(char ch);
   RegEx(char a, char z);
   RegEx(const std::string& str, REGEX_OP op = REGEX_SEQ);
   ~RegEx() {}
 
   friend YAML_CPP_API RegEx operator!(const RegEx& ex);
-  friend YAML_CPP_API RegEx operator|(const RegEx& ex1, const RegEx& ex2);
-  friend YAML_CPP_API RegEx operator&(const RegEx& ex1, const RegEx& ex2);
+  friend YAML_CPP_API RegEx operator||(const RegEx& ex1, const RegEx& ex2);
+  friend YAML_CPP_API RegEx operator&&(const RegEx& ex1, const RegEx& ex2);
   friend YAML_CPP_API RegEx operator+(const RegEx& ex1, const RegEx& ex2);
 
   bool Matches(char ch) const;
@@ -53,7 +53,7 @@ class YAML_CPP_API RegEx {
   int Match(const Source& source) const;
 
  private:
-  explicit RegEx(REGEX_OP op);
+  RegEx(REGEX_OP op);
 
   template <typename Source>
   bool IsValidSource(const Source& source) const;
index ac848924fc7fe43d922ee89edb2d2c0f4601d4c9..546a2f0c6896cbfe9f725222f229e79add8e55f8 100644 (file)
@@ -9,15 +9,10 @@
 namespace YAML {
 Scanner::Scanner(std::istream& in)
     : INPUT(in),
-      m_tokens{},
       m_startedStream(false),
       m_endedStream(false),
       m_simpleKeyAllowed(false),
-      m_canBeJSONFlow(false),
-      m_simpleKeys{},
-      m_indents{},
-      m_indentRefs{},
-      m_flows{} {}
+      m_canBeJSONFlow(false) {}
 
 Scanner::~Scanner() {}
 
index 325de571502026711cc87da1383807429757dd73..fd8758d78156e5625c377a33fa710ea6e00a337c 100644 (file)
@@ -338,7 +338,7 @@ void Scanner::ScanQuotedScalar() {
 
   // setup the scanning parameters
   ScanScalarParams params;
-  RegEx end = (single ? RegEx(quote) & !Exp::EscSingleQuote() : RegEx(quote));
+  RegEx end = (single ? RegEx(quote) && !Exp::EscSingleQuote() : RegEx(quote));
   params.end = &end;
   params.eatEnd = true;
   params.escape = (single ? '\'' : '\\');
@@ -434,4 +434,4 @@ void Scanner::ScanBlockScalar() {
   token.value = scalar;
   m_tokens.push(token);
 }
-}  // namespace YAML
+}
index 280d1e72b30ab91ccc542538d90492e0bb499620..b78d40e2e8577dc590d7a2edf887951d2d8fd2e7 100644 (file)
@@ -8,8 +8,8 @@
 #endif
 
 #include <memory>
-#include <utility>
 #include <vector>
+#include "yaml-cpp/noncopyable.h"
 
 namespace YAML {
 class SettingChangeBase;
@@ -18,7 +18,6 @@ template <typename T>
 class Setting {
  public:
   Setting() : m_value() {}
-  Setting(const T& value) : m_value() { set(value); }
 
   const T get() const { return m_value; }
   std::unique_ptr<SettingChangeBase> set(const T& value);
@@ -37,14 +36,10 @@ class SettingChangeBase {
 template <typename T>
 class SettingChange : public SettingChangeBase {
  public:
-  SettingChange(Setting<T>* pSetting)
-      : m_pCurSetting(pSetting),
-        m_oldSetting(*pSetting)  // copy old setting to save its state
-  {}
-  SettingChange(const SettingChange&) = delete;
-  SettingChange(SettingChange&&) = delete;
-  SettingChange& operator=(const SettingChange&) = delete;
-  SettingChange& operator=(SettingChange&&) = delete;
+  SettingChange(Setting<T>* pSetting) : m_pCurSetting(pSetting) {
+    // copy old setting to save its state
+    m_oldSetting = *pSetting;
+  }
 
   virtual void pop() { m_pCurSetting->restore(m_oldSetting); }
 
@@ -60,12 +55,9 @@ inline std::unique_ptr<SettingChangeBase> Setting<T>::set(const T& value) {
   return pChange;
 }
 
-class SettingChanges {
+class SettingChanges : private noncopyable {
  public:
-  SettingChanges() : m_settingChanges{} {}
-  SettingChanges(const SettingChanges&) = delete;
-  SettingChanges(SettingChanges&&) = default;
-  SettingChanges& operator=(const SettingChanges&) = delete;
+  SettingChanges() {}
   ~SettingChanges() { clear(); }
 
   void clear() {
@@ -98,6 +90,6 @@ class SettingChanges {
   typedef std::vector<std::unique_ptr<SettingChangeBase>> setting_changes;
   setting_changes m_settingChanges;
 };
-}  // namespace YAML
+}
 
 #endif  // SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 31ca7c42bdab74990ef0ccce53c7602cc8cb8d6b..fb220fb5ced82e5d68d33f45b63152b287fd1b30 100644 (file)
@@ -19,7 +19,6 @@ SingleDocParser::SingleDocParser(Scanner& scanner, const Directives& directives)
     : m_scanner(scanner),
       m_directives(directives),
       m_pCollectionStack(new CollectionStack),
-      m_anchors{},
       m_curAnchor(0) {}
 
 SingleDocParser::~SingleDocParser() {}
@@ -180,10 +179,10 @@ void SingleDocParser::HandleBlockSequence(EventHandler& eventHandler) {
 
     // check for null
     if (!m_scanner.empty()) {
-      const Token& nextToken = m_scanner.peek();
-      if (nextToken.type == Token::BLOCK_ENTRY ||
-          nextToken.type == Token::BLOCK_SEQ_END) {
-        eventHandler.OnNull(nextToken.mark, NullAnchor);
+      const Token& token = m_scanner.peek();
+      if (token.type == Token::BLOCK_ENTRY ||
+          token.type == Token::BLOCK_SEQ_END) {
+        eventHandler.OnNull(token.mark, NullAnchor);
         continue;
       }
     }
index e1904da9ef6c74f829d413a19d4fa4e6670de0fe..0e04fab74a06b57cb9a45a5a4d48df9f750ceca9 100644 (file)
@@ -12,6 +12,7 @@
 #include <string>
 
 #include "yaml-cpp/anchor.h"
+#include "yaml-cpp/noncopyable.h"
 
 namespace YAML {
 class CollectionStack;
@@ -24,13 +25,9 @@ struct Directives;
 struct Mark;
 struct Token;
 
-class SingleDocParser {
+class SingleDocParser : private noncopyable {
  public:
   SingleDocParser(Scanner& scanner, const Directives& directives);
-  SingleDocParser(const SingleDocParser&) = delete;
-  SingleDocParser(SingleDocParser&&) = delete;
-  SingleDocParser& operator=(const SingleDocParser&) = delete;
-  SingleDocParser& operator=(SingleDocParser&&) = delete;
   ~SingleDocParser();
 
   void HandleDocument(EventHandler& eventHandler);
index 592802d179193fa4b8b63a267dcb034facf1a6b6..3b013cfa7d36b4e0f1e17c8d629b59dfaec238b9 100644 (file)
@@ -111,15 +111,24 @@ static UtfIntroState s_introTransitions[][uictMax] = {
 
 static char s_introUngetCount[][uictMax] = {
     // uict00, uictBB, uictBF, uictEF, uictFE, uictFF, uictAscii, uictOther
-    {0, 1, 1, 0, 0, 0, 0, 1}, {0, 2, 2, 2, 2, 2, 2, 2},
-    {3, 3, 3, 3, 0, 3, 3, 3}, {4, 4, 4, 4, 4, 0, 4, 4},
-    {1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1},
-    {2, 2, 2, 2, 2, 0, 2, 2}, {2, 2, 2, 2, 0, 2, 2, 2},
-    {0, 1, 1, 1, 1, 1, 1, 1}, {0, 2, 2, 2, 2, 2, 2, 2},
-    {1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1},
-    {0, 2, 2, 2, 2, 2, 2, 2}, {0, 3, 3, 3, 3, 3, 3, 3},
-    {4, 4, 4, 4, 4, 4, 4, 4}, {2, 0, 2, 2, 2, 2, 2, 2},
-    {3, 3, 0, 3, 3, 3, 3, 3}, {1, 1, 1, 1, 1, 1, 1, 1},
+    {0, 1, 1, 0, 0, 0, 0, 1},
+    {0, 2, 2, 2, 2, 2, 2, 2},
+    {3, 3, 3, 3, 0, 3, 3, 3},
+    {4, 4, 4, 4, 4, 0, 4, 4},
+    {1, 1, 1, 1, 1, 1, 1, 1},
+    {1, 1, 1, 1, 1, 1, 1, 1},
+    {2, 2, 2, 2, 2, 0, 2, 2},
+    {2, 2, 2, 2, 0, 2, 2, 2},
+    {0, 1, 1, 1, 1, 1, 1, 1},
+    {0, 2, 2, 2, 2, 2, 2, 2},
+    {1, 1, 1, 1, 1, 1, 1, 1},
+    {1, 1, 1, 1, 1, 1, 1, 1},
+    {0, 2, 2, 2, 2, 2, 2, 2},
+    {0, 3, 3, 3, 3, 3, 3, 3},
+    {4, 4, 4, 4, 4, 4, 4, 4},
+    {2, 0, 2, 2, 2, 2, 2, 2},
+    {3, 3, 0, 3, 3, 3, 3, 3},
+    {1, 1, 1, 1, 1, 1, 1, 1},
 };
 
 inline UtfIntroCharType IntroCharTypeOf(std::istream::int_type ch) {
@@ -183,9 +192,6 @@ inline void QueueUnicodeCodepoint(std::deque<char>& q, unsigned long ch) {
 
 Stream::Stream(std::istream& input)
     : m_input(input),
-      m_mark{},
-      m_charSet{},
-      m_readahead{},
       m_pPrefetched(new unsigned char[YAML_PREFETCH_SIZE]),
       m_nPrefetchedAvailable(0),
       m_nPrefetchedUsed(0) {
@@ -439,4 +445,4 @@ void Stream::StreamInUtf32() const {
 
   QueueUnicodeCodepoint(m_readahead, ch);
 }
-}  // namespace YAML
+}
index ff5149e970c753a4632946f14b75cde563693472..42d542d5b161e8da61008faaa71372849fcfb116 100644 (file)
@@ -7,6 +7,7 @@
 #pragma once
 #endif
 
+#include "yaml-cpp/noncopyable.h"
 #include "yaml-cpp/mark.h"
 #include <cstddef>
 #include <deque>
 #include <string>
 
 namespace YAML {
-class Stream {
+class Stream : private noncopyable {
  public:
   friend class StreamCharSource;
 
   Stream(std::istream& input);
-  Stream(const Stream&) = delete;
-  Stream(Stream&&) = delete;
-  Stream& operator=(const Stream&) = delete;
-  Stream& operator=(Stream&&) = delete;
   ~Stream();
 
   operator bool() const;
@@ -74,6 +71,6 @@ inline bool Stream::ReadAheadTo(size_t i) const {
     return true;
   return _ReadAheadTo(i);
 }
-}  // namespace YAML
+}
 
 #endif  // STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 4b6a143ea37b7354d738f2c6deb4016fa6b56565..624599e65daf968822fb88b0d1dac7bb67998bef 100644 (file)
@@ -7,6 +7,7 @@
 #pragma once
 #endif
 
+#include "yaml-cpp/noncopyable.h"
 #include <cstddef>
 
 namespace YAML {
@@ -15,9 +16,6 @@ class StreamCharSource {
   StreamCharSource(const Stream& stream) : m_offset(0), m_stream(stream) {}
   StreamCharSource(const StreamCharSource& source)
       : m_offset(source.m_offset), m_stream(source.m_stream) {}
-  StreamCharSource(StreamCharSource&&) = default;
-  StreamCharSource& operator=(const StreamCharSource&) = delete;
-  StreamCharSource& operator=(StreamCharSource&&) = delete;
   ~StreamCharSource() {}
 
   operator bool() const;
@@ -29,6 +27,8 @@ class StreamCharSource {
  private:
   std::size_t m_offset;
   const Stream& m_stream;
+
+  StreamCharSource& operator=(const StreamCharSource&);  // non-assignable
 };
 
 inline StreamCharSource::operator bool() const {
@@ -43,6 +43,6 @@ inline const StreamCharSource StreamCharSource::operator+(int i) const {
     source.m_offset = 0;
   return source;
 }
-}  // namespace YAML
+}
 
 #endif  // STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index df8a2cf461332655cb967db7c6bc08a97e2c2290..51435520e46bc9dd5695136b4c0bb781707745b3 100644 (file)
@@ -6,8 +6,7 @@
 #include "token.h"
 
 namespace YAML {
-Tag::Tag(const Token& token)
-    : type(static_cast<TYPE>(token.data)), handle{}, value{} {
+Tag::Tag(const Token& token) : type(static_cast<TYPE>(token.data)) {
   switch (type) {
     case VERBATIM:
       value = token.value;
@@ -47,4 +46,4 @@ const std::string Tag::Translate(const Directives& directives) {
   }
   throw std::runtime_error("yaml-cpp: internal error, bad tag type");
 }
-}  // namespace YAML
+}
index 9a27f3d6c127f48afbd60aacb1868903c9d29a41..ad0b7d0a0058ce97849acce0126bbfc02f85f09a 100644 (file)
 
 namespace YAML {
 const std::string TokenNames[] = {
-    "DIRECTIVE",        "DOC_START",      "DOC_END",       "BLOCK_SEQ_START",
-    "BLOCK_MAP_START",  "BLOCK_SEQ_END",  "BLOCK_MAP_END", "BLOCK_ENTRY",
-    "FLOW_SEQ_START",   "FLOW_MAP_START", "FLOW_SEQ_END",  "FLOW_MAP_END",
-    "FLOW_MAP_COMPACT", "FLOW_ENTRY",     "KEY",           "VALUE",
-    "ANCHOR",           "ALIAS",          "TAG",           "SCALAR"};
+    "DIRECTIVE", "DOC_START", "DOC_END", "BLOCK_SEQ_START", "BLOCK_MAP_START",
+    "BLOCK_SEQ_END", "BLOCK_MAP_END", "BLOCK_ENTRY", "FLOW_SEQ_START",
+    "FLOW_MAP_START", "FLOW_SEQ_END", "FLOW_MAP_END", "FLOW_MAP_COMPACT",
+    "FLOW_ENTRY", "KEY", "VALUE", "ANCHOR", "ALIAS", "TAG", "SCALAR"};
 
 struct Token {
   // enums
@@ -49,7 +48,7 @@ struct Token {
 
   // data
   Token(TYPE type_, const Mark& mark_)
-      : status(VALID), type(type_), mark(mark_), value{}, params{}, data(0) {}
+      : status(VALID), type(type_), mark(mark_), data(0) {}
 
   friend std::ostream& operator<<(std::ostream& out, const Token& token) {
     out << TokenNames[token.type] << std::string(": ") << token.value;
@@ -65,6 +64,6 @@ struct Token {
   std::vector<std::string> params;
   int data;
 };
-}  // namespace YAML
+}
 
 #endif  // TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66
index 658db9e64dc00b538f70eca968d3d3ceae80db25..7589d2e4bf829d7a1e893b38b6c21a6d8a112b46 100644 (file)
@@ -1,6 +1,6 @@
+#include "gtest/gtest.h"
 #include "regex_yaml.h"
 #include "stream.h"
-#include "gtest/gtest.h"
 
 using YAML::RegEx;
 using YAML::Stream;
@@ -106,8 +106,8 @@ TEST(RegExTest, OperatorOr) {
     for (int j = i + 1; j < 128; ++j) {
       auto iStr = std::string(1, char(i));
       auto jStr = std::string(1, char(j));
-      RegEx ex1 = RegEx(iStr) | RegEx(jStr);
-      RegEx ex2 = RegEx(jStr) | RegEx(iStr);
+      RegEx ex1 = RegEx(iStr) || RegEx(jStr);
+      RegEx ex2 = RegEx(jStr) || RegEx(iStr);
 
       for (int k = MIN_CHAR; k < 128; ++k) {
         auto str = std::string(1, char(k));
@@ -128,8 +128,8 @@ TEST(RegExTest, OperatorOr) {
 }
 
 TEST(RegExTest, OperatorOrShortCircuits) {
-  RegEx ex1 = RegEx(std::string("aaaa")) | RegEx(std::string("aa"));
-  RegEx ex2 = RegEx(std::string("aa")) | RegEx(std::string("aaaa"));
+  RegEx ex1 = RegEx(std::string("aaaa")) || RegEx(std::string("aa"));
+  RegEx ex2 = RegEx(std::string("aa")) || RegEx(std::string("aaaa"));
 
   EXPECT_TRUE(ex1.Matches(std::string("aaaaa")));
   EXPECT_EQ(4, ex1.Match(std::string("aaaaa")));
@@ -139,13 +139,13 @@ TEST(RegExTest, OperatorOrShortCircuits) {
 }
 
 TEST(RegExTest, OperatorAnd) {
-  RegEx emptySet = RegEx('a') & RegEx();
+  RegEx emptySet = RegEx('a') && RegEx();
   EXPECT_FALSE(emptySet.Matches(std::string("a")));
 }
 
 TEST(RegExTest, OperatorAndShortCircuits) {
-  RegEx ex1 = RegEx(std::string("aaaa")) & RegEx(std::string("aa"));
-  RegEx ex2 = RegEx(std::string("aa")) & RegEx(std::string("aaaa"));
+  RegEx ex1 = RegEx(std::string("aaaa")) && RegEx(std::string("aa"));
+  RegEx ex2 = RegEx(std::string("aa")) && RegEx(std::string("aaaa"));
 
   EXPECT_TRUE(ex1.Matches(std::string("aaaaa")));
   EXPECT_EQ(4, ex1.Match(std::string("aaaaa")));
@@ -174,4 +174,4 @@ TEST(RegExTest, StringOr) {
 
   EXPECT_EQ(1, ex.Match(str));
 }
-}  // namespace
+}