clang-format

This commit is contained in:
Jesse Beder 2014-03-23 20:08:54 -05:00
parent d508a7cb0d
commit 06bf012d81
22 changed files with 584 additions and 690 deletions

View File

@ -30,7 +30,7 @@
// #pragma message( "Defining YAML_CPP_API for DLL import" )
#define YAML_CPP_API __declspec(dllimport)
#endif // yaml_cpp_EXPORTS
#else // YAML_CPP_DLL
#else // YAML_CPP_DLL
#define YAML_CPP_API
#endif // YAML_CPP_DLL

View File

@ -47,11 +47,7 @@ class EmitFromEvents : public EventHandler {
Emitter& m_emitter;
struct State {
enum value {
WaitingForSequenceEntry,
WaitingForKey,
WaitingForValue
};
enum value { WaitingForSequenceEntry, WaitingForKey, WaitingForValue };
};
std::stack<State::value> m_stateStack;
};

View File

@ -9,15 +9,7 @@
namespace YAML {
struct EmitterNodeType {
enum value {
None,
Property,
Scalar,
FlowSeq,
BlockSeq,
FlowMap,
BlockMap
};
enum value { None, Property, Scalar, FlowSeq, BlockSeq, FlowMap, BlockMap };
};
}

View File

@ -85,11 +85,7 @@ inline _Anchor Anchor(const std::string content) { return _Anchor(content); }
struct _Tag {
struct Type {
enum value {
Verbatim,
PrimaryHandle,
NamedHandle
};
enum value { Verbatim, PrimaryHandle, NamedHandle };
};
explicit _Tag(const std::string& prefix_, const std::string& content_,

View File

@ -10,103 +10,71 @@
namespace YAML {
template <typename>
struct is_numeric {
enum {
value = false
};
enum { value = false };
};
template <>
struct is_numeric<char> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<unsigned char> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<int> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<unsigned int> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<long int> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<unsigned long int> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<short int> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<unsigned short int> {
enum {
value = true
};
enum { value = true };
};
#if defined(_MSC_VER) && (_MSC_VER < 1310)
template <>
struct is_numeric<__int64> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<unsigned __int64> {
enum {
value = true
};
enum { value = true };
};
#else
template <>
struct is_numeric<long long> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<unsigned long long> {
enum {
value = true
};
enum { value = true };
};
#endif
template <>
struct is_numeric<float> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<double> {
enum {
value = true
};
enum { value = true };
};
template <>
struct is_numeric<long double> {
enum {
value = true
};
enum { value = true };
};
template <bool, class T = void>

View File

@ -12,14 +12,7 @@
namespace YAML {
struct CollectionType {
enum value {
None,
BlockMap,
BlockSeq,
FlowMap,
FlowSeq,
CompactMap
};
enum value { None, BlockMap, BlockSeq, FlowMap, FlowSeq, CompactMap };
};
class CollectionStack {

View File

@ -8,8 +8,8 @@ Directives::Directives() {
version.minor = 2;
}
const std::string Directives::TranslateTagHandle(const std::string& handle)
const {
const std::string Directives::TranslateTagHandle(
const std::string& handle) const {
std::map<std::string, std::string>::const_iterator it = tags.find(handle);
if (it == tags.end()) {
if (handle == "!!")

View File

@ -82,8 +82,8 @@ void EmitterState::StartedNode() {
m_hasNonContent = false;
}
EmitterNodeType::value EmitterState::NextGroupType(GroupType::value type)
const {
EmitterNodeType::value EmitterState::NextGroupType(
GroupType::value type) const {
if (type == GroupType::Seq) {
if (GetFlowType(type) == Block)
return EmitterNodeType::BlockSeq;

View File

@ -19,24 +19,13 @@
namespace YAML {
struct FmtScope {
enum value {
Local,
Global
};
enum value { Local, Global };
};
struct GroupType {
enum value {
None,
Seq,
Map
};
enum value { None, Seq, Map };
};
struct FlowType {
enum value {
None,
Flow,
Block
};
enum value { None, Flow, Block };
};
class EmitterState {

View File

@ -13,9 +13,7 @@
namespace YAML {
namespace Utils {
namespace {
enum {
REPLACEMENT_CHARACTER = 0xFFFD
};
enum { REPLACEMENT_CHARACTER = 0xFFFD };
bool IsAnchorChar(int ch) { // test for ns-anchor-char
switch (ch) {

View File

@ -21,12 +21,7 @@ namespace YAML {
class Binary;
struct StringFormat {
enum value {
Plain,
SingleQuoted,
DoubleQuoted,
Literal
};
enum value { Plain, SingleQuoted, DoubleQuoted, Literal };
};
namespace Utils {

View File

@ -2,7 +2,7 @@
#include <sstream>
#include "directives.h" // IWYU pragma: keep
#include "scanner.h" // IWYU pragma: keep
#include "scanner.h" // IWYU pragma: keep
#include "singledocparser.h"
#include "token.h"
#include "yaml-cpp/exceptions.h" // IWYU pragma: keep

View File

@ -104,8 +104,8 @@ inline int RegEx::MatchOpEmpty(const Source& source) const {
}
template <>
inline int RegEx::MatchOpEmpty<StringCharSource>(const StringCharSource& source)
const {
inline int RegEx::MatchOpEmpty<StringCharSource>(
const StringCharSource& source) const {
return !source
? 0
: -1; // the empty regex only is successful on the empty string

View File

@ -36,16 +36,8 @@ class Scanner {
private:
struct IndentMarker {
enum INDENT_TYPE {
MAP,
SEQ,
NONE
};
enum STATUS {
VALID,
INVALID,
UNKNOWN
};
enum INDENT_TYPE { MAP, SEQ, NONE };
enum STATUS { VALID, INVALID, UNKNOWN };
IndentMarker(int column_, INDENT_TYPE type_)
: column(column_), type(type_), status(VALID), pStartToken(0) {}
@ -55,10 +47,7 @@ class Scanner {
Token *pStartToken;
};
enum FLOW_MARKER {
FLOW_MAP,
FLOW_SEQ
};
enum FLOW_MARKER { FLOW_MAP, FLOW_SEQ };
private:
// scanning

View File

@ -13,21 +13,9 @@
#include "stream.h"
namespace YAML {
enum CHOMP {
STRIP = -1,
CLIP,
KEEP
};
enum ACTION {
NONE,
BREAK,
THROW
};
enum FOLD {
DONT_FOLD,
FOLD_BLOCK,
FOLD_FLOW
};
enum CHOMP { STRIP = -1, CLIP, KEEP };
enum ACTION { NONE, BREAK, THROW };
enum FOLD { DONT_FOLD, FOLD_BLOCK, FOLD_FLOW };
struct ScanScalarParams {
ScanScalarParams()

View File

@ -6,7 +6,7 @@
#include "scanner.h"
#include "scanscalar.h"
#include "scantag.h" // IWYU pragma: keep
#include "tag.h" // IWYU pragma: keep
#include "tag.h" // IWYU pragma: keep
#include "token.h"
#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
#include "yaml-cpp/mark.h"

View File

@ -50,62 +50,62 @@ static bool s_introFinalState[] = {false, // uis_start
false, // uis_utfbe_b1
false, // uis_utf32be_b2
false, // uis_utf32be_bom3
true, // uis_utf32be
true, // uis_utf16be
true, // uis_utf32be
true, // uis_utf16be
false, // uis_utf16be_bom1
false, // uis_utfle_bom1
false, // uis_utf16le_bom2
false, // uis_utf32le_bom3
true, // uis_utf16le
true, // uis_utf32le
true, // uis_utf16le
true, // uis_utf32le
false, // uis_utf8_imp
false, // uis_utf16le_imp
false, // uis_utf32le_imp3
false, // uis_utf8_bom1
false, // uis_utf8_bom2
true, // uis_utf8
true, // uis_error
true, // uis_utf8
true, // uis_error
};
static UtfIntroState s_introTransitions[][uictMax] = {
// uict00, uictBB, uictBF, uictEF,
// uictFE, uictFF, uictAscii, uictOther
{uis_utfbe_b1, uis_utf8, uis_utf8, uis_utf8_bom1,
uis_utf16be_bom1, uis_utfle_bom1, uis_utf8_imp, uis_utf8},
{uis_utf32be_b2, uis_utf8, uis_utf8, uis_utf8,
uis_utf8, uis_utf8, uis_utf16be, uis_utf8},
{uis_utf32be, uis_utf8, uis_utf8, uis_utf8,
uis_utf32be_bom3, uis_utf8, uis_utf8, uis_utf8},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf8, uis_utf32be, uis_utf8, uis_utf8},
{uis_utf32be, uis_utf32be, uis_utf32be, uis_utf32be,
uis_utf32be, uis_utf32be, uis_utf32be, uis_utf32be},
{uis_utf16be, uis_utf16be, uis_utf16be, uis_utf16be,
uis_utf16be, uis_utf16be, uis_utf16be, uis_utf16be},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf8, uis_utf16be, uis_utf8, uis_utf8},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf16le_bom2, uis_utf8, uis_utf8, uis_utf8},
{uis_utf32le_bom3, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf32le, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf32le, uis_utf32le, uis_utf32le, uis_utf32le,
uis_utf32le, uis_utf32le, uis_utf32le, uis_utf32le},
{uis_utf16le_imp, uis_utf8, uis_utf8, uis_utf8,
uis_utf8, uis_utf8, uis_utf8, uis_utf8},
{uis_utf32le_imp3, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf32le, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf8, uis_utf8_bom2, uis_utf8, uis_utf8,
uis_utf8, uis_utf8, uis_utf8, uis_utf8},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf8, uis_utf8, uis_utf8, uis_utf8},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf8, uis_utf8, uis_utf8, uis_utf8}, };
{uis_utfbe_b1, uis_utf8, uis_utf8, uis_utf8_bom1, uis_utf16be_bom1,
uis_utfle_bom1, uis_utf8_imp, uis_utf8},
{uis_utf32be_b2, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf16be, uis_utf8},
{uis_utf32be, uis_utf8, uis_utf8, uis_utf8, uis_utf32be_bom3, uis_utf8,
uis_utf8, uis_utf8},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf32be, uis_utf8,
uis_utf8},
{uis_utf32be, uis_utf32be, uis_utf32be, uis_utf32be, uis_utf32be,
uis_utf32be, uis_utf32be, uis_utf32be},
{uis_utf16be, uis_utf16be, uis_utf16be, uis_utf16be, uis_utf16be,
uis_utf16be, uis_utf16be, uis_utf16be},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf16be, uis_utf8,
uis_utf8},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf16le_bom2, uis_utf8,
uis_utf8, uis_utf8},
{uis_utf32le_bom3, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf32le, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf32le, uis_utf32le, uis_utf32le, uis_utf32le, uis_utf32le,
uis_utf32le, uis_utf32le, uis_utf32le},
{uis_utf16le_imp, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf8, uis_utf8},
{uis_utf32le_imp3, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf32le, uis_utf16le, uis_utf16le, uis_utf16le, uis_utf16le,
uis_utf16le, uis_utf16le, uis_utf16le},
{uis_utf8, uis_utf8_bom2, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf8},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf8},
{uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8, uis_utf8,
uis_utf8}, };
static char s_introUngetCount[][uictMax] = {
// uict00, uictBB, uictBF, uictEF, uictFE, uictFF, uictAscii, uictOther

View File

@ -41,13 +41,7 @@ class Stream : private noncopyable {
void ResetColumn() { m_mark.column = 0; }
private:
enum CharacterSet {
utf8,
utf16le,
utf16be,
utf32le,
utf32be
};
enum CharacterSet { utf8, utf16le, utf16be, utf32le, utf32be };
std::istream& m_input;
Mark m_mark;

View File

@ -22,11 +22,7 @@ const std::string TokenNames[] = {
struct Token {
// enums
enum STATUS {
VALID,
INVALID,
UNVERIFIED
};
enum STATUS { VALID, INVALID, UNVERIFIED };
enum TYPE {
DIRECTIVE,
DOC_START,

View File

@ -6,6 +6,7 @@
#include "gtest/gtest.h"
using ::testing::_;
using ::testing::InSequence;
namespace YAML {
namespace {
@ -92,6 +93,7 @@ class EncodingTest : public HandlerTest {
}
void Run() {
InSequence sequence;
EXPECT_CALL(handler, OnDocumentStart(_));
EXPECT_CALL(handler, OnSequenceStart(_, "?", 0));
for (std::size_t i = 0; i < m_entries.size(); i++) {

File diff suppressed because it is too large Load Diff

View File

@ -21,5 +21,4 @@ class MockEventHandler : public EventHandler {
MOCK_METHOD3(OnMapStart, void(const Mark&, const std::string&, anchor_t));
MOCK_METHOD0(OnMapEnd, void());
};
}