mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Fix clang format (#854)
Fix invocation of clang-format in CMakeLists and apply clang-format.
This commit is contained in:
@@ -156,6 +156,7 @@ endif()
|
|||||||
if (YAML_CPP_CLANG_FORMAT_EXE)
|
if (YAML_CPP_CLANG_FORMAT_EXE)
|
||||||
add_custom_target(format
|
add_custom_target(format
|
||||||
COMMAND clang-format --style=file -i $<TARGET_PROPERTY:yaml-cpp,SOURCES>
|
COMMAND clang-format --style=file -i $<TARGET_PROPERTY:yaml-cpp,SOURCES>
|
||||||
|
COMMAND_EXPAND_LISTS
|
||||||
COMMENT "Running clang-format"
|
COMMENT "Running clang-format"
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -97,4 +97,4 @@ std::vector<unsigned char> DecodeBase64(const std::string &input) {
|
|||||||
ret.resize(out - &ret[0]);
|
ret.resize(out - &ret[0]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -14,4 +14,4 @@ void* BuildGraphOfNextDocument(Parser& parser,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -91,4 +91,4 @@ void GraphBuilderAdapter::DispositionNode(void *pNode) {
|
|||||||
m_builder.AppendToSequence(pContainer, pNode);
|
m_builder.AppendToSequence(pContainer, pNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace YAML {
|
namespace YAML {
|
||||||
|
|
||||||
DeepRecursion::DeepRecursion(int depth, const Mark& mark_, const std::string& msg_)
|
DeepRecursion::DeepRecursion(int depth, const Mark& mark_,
|
||||||
: ParserException(mark_, msg_),
|
const std::string& msg_)
|
||||||
m_depth(depth) {
|
: ParserException(mark_, msg_), m_depth(depth) {}
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace YAML
|
} // namespace YAML
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#include "yaml-cpp/node/emit.h"
|
#include "yaml-cpp/node/emit.h"
|
||||||
|
#include "nodeevents.h"
|
||||||
#include "yaml-cpp/emitfromevents.h"
|
#include "yaml-cpp/emitfromevents.h"
|
||||||
#include "yaml-cpp/emitter.h"
|
#include "yaml-cpp/emitter.h"
|
||||||
#include "nodeevents.h"
|
|
||||||
|
|
||||||
namespace YAML {
|
namespace YAML {
|
||||||
Emitter& operator<<(Emitter& out, const Node& node) {
|
Emitter& operator<<(Emitter& out, const Node& node) {
|
||||||
|
@@ -17,4 +17,4 @@ BadPushback::~BadPushback() YAML_CPP_NOEXCEPT = default;
|
|||||||
BadInsert::~BadInsert() YAML_CPP_NOEXCEPT = default;
|
BadInsert::~BadInsert() YAML_CPP_NOEXCEPT = default;
|
||||||
EmitterException::~EmitterException() YAML_CPP_NOEXCEPT = default;
|
EmitterException::~EmitterException() YAML_CPP_NOEXCEPT = default;
|
||||||
BadFile::~BadFile() YAML_CPP_NOEXCEPT = default;
|
BadFile::~BadFile() YAML_CPP_NOEXCEPT = default;
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -22,5 +22,5 @@ node& memory::create_node() {
|
|||||||
void memory::merge(const memory& rhs) {
|
void memory::merge(const memory& rhs) {
|
||||||
m_nodes.insert(rhs.m_nodes.begin(), rhs.m_nodes.end());
|
m_nodes.insert(rhs.m_nodes.begin(), rhs.m_nodes.end());
|
||||||
}
|
}
|
||||||
}
|
} // namespace detail
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -9,4 +9,4 @@ Node Clone(const Node& node) {
|
|||||||
events.Emit(builder);
|
events.Emit(builder);
|
||||||
return builder.Root();
|
return builder.Root();
|
||||||
}
|
}
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -7,4 +7,4 @@ bool IsNullString(const std::string& str) {
|
|||||||
return str.empty() || str == "~" || str == "null" || str == "Null" ||
|
return str.empty() || str == "~" || str == "null" || str == "Null" ||
|
||||||
str == "NULL";
|
str == "NULL";
|
||||||
}
|
}
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -3,10 +3,10 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "yaml-cpp/node/node.h"
|
|
||||||
#include "yaml-cpp/node/impl.h"
|
|
||||||
#include "yaml-cpp/parser.h"
|
|
||||||
#include "nodebuilder.h"
|
#include "nodebuilder.h"
|
||||||
|
#include "yaml-cpp/node/impl.h"
|
||||||
|
#include "yaml-cpp/node/node.h"
|
||||||
|
#include "yaml-cpp/parser.h"
|
||||||
|
|
||||||
namespace YAML {
|
namespace YAML {
|
||||||
Node Load(const std::string& input) {
|
Node Load(const std::string& input) {
|
||||||
|
@@ -17,9 +17,7 @@ Parser::Parser(std::istream& in) : Parser() { Load(in); }
|
|||||||
|
|
||||||
Parser::~Parser() = default;
|
Parser::~Parser() = default;
|
||||||
|
|
||||||
Parser::operator bool() const {
|
Parser::operator bool() const { return m_pScanner && !m_pScanner->empty(); }
|
||||||
return m_pScanner && !m_pScanner->empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parser::Load(std::istream& in) {
|
void Parser::Load(std::istream& in) {
|
||||||
m_pScanner.reset(new Scanner(in));
|
m_pScanner.reset(new Scanner(in));
|
||||||
|
@@ -247,4 +247,4 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
|
|||||||
|
|
||||||
return scalar;
|
return scalar;
|
||||||
}
|
}
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -78,4 +78,4 @@ const std::string ScanTagSuffix(Stream& INPUT) {
|
|||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -5,7 +5,11 @@ namespace YAML {
|
|||||||
struct Mark;
|
struct Mark;
|
||||||
|
|
||||||
Scanner::SimpleKey::SimpleKey(const Mark& mark_, std::size_t flowLevel_)
|
Scanner::SimpleKey::SimpleKey(const Mark& mark_, std::size_t flowLevel_)
|
||||||
: mark(mark_), flowLevel(flowLevel_), pIndent(nullptr), pMapStart(nullptr), pKey(nullptr) {}
|
: mark(mark_),
|
||||||
|
flowLevel(flowLevel_),
|
||||||
|
pIndent(nullptr),
|
||||||
|
pMapStart(nullptr),
|
||||||
|
pKey(nullptr) {}
|
||||||
|
|
||||||
void Scanner::SimpleKey::Validate() {
|
void Scanner::SimpleKey::Validate() {
|
||||||
// Note: pIndent will *not* be garbage here;
|
// Note: pIndent will *not* be garbage here;
|
||||||
@@ -125,4 +129,4 @@ void Scanner::PopAllSimpleKeys() {
|
|||||||
while (!m_simpleKeys.empty())
|
while (!m_simpleKeys.empty())
|
||||||
m_simpleKeys.pop();
|
m_simpleKeys.pop();
|
||||||
}
|
}
|
||||||
}
|
} // namespace YAML
|
||||||
|
@@ -151,7 +151,8 @@ inline UtfIntroCharType IntroCharTypeOf(std::istream::int_type ch) {
|
|||||||
|
|
||||||
inline char Utf8Adjust(unsigned long ch, unsigned char lead_bits,
|
inline char Utf8Adjust(unsigned long ch, unsigned char lead_bits,
|
||||||
unsigned char rshift) {
|
unsigned char rshift) {
|
||||||
const unsigned char header = static_cast<unsigned char>(((1 << lead_bits) - 1) << (8 - lead_bits));
|
const unsigned char header =
|
||||||
|
static_cast<unsigned char>(((1 << lead_bits) - 1) << (8 - lead_bits));
|
||||||
const unsigned char mask = (0xFF >> (lead_bits + 1));
|
const unsigned char mask = (0xFF >> (lead_bits + 1));
|
||||||
return static_cast<char>(
|
return static_cast<char>(
|
||||||
static_cast<unsigned char>(header | ((ch >> rshift) & mask)));
|
static_cast<unsigned char>(header | ((ch >> rshift) & mask)));
|
||||||
|
Reference in New Issue
Block a user