Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
9f2781b5
Unverified
Commit
9f2781b5
authored
Apr 29, 2020
by
Ian Taylor
Committed by
GitHub
Apr 29, 2020
Browse files
Fix clang format (#854)
Fix invocation of clang-format in CMakeLists and apply clang-format.
parent
7083db28
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
28 additions
and
25 deletions
+28
-25
CMakeLists.txt
CMakeLists.txt
+1
-0
src/binary.cpp
src/binary.cpp
+1
-1
src/contrib/graphbuilder.cpp
src/contrib/graphbuilder.cpp
+1
-1
src/contrib/graphbuilderadapter.cpp
src/contrib/graphbuilderadapter.cpp
+1
-1
src/depthguard.cpp
src/depthguard.cpp
+4
-5
src/emit.cpp
src/emit.cpp
+1
-1
src/exceptions.cpp
src/exceptions.cpp
+1
-1
src/memory.cpp
src/memory.cpp
+2
-2
src/node.cpp
src/node.cpp
+1
-1
src/null.cpp
src/null.cpp
+1
-1
src/parse.cpp
src/parse.cpp
+2
-2
src/parser.cpp
src/parser.cpp
+1
-3
src/scanscalar.cpp
src/scanscalar.cpp
+1
-1
src/scantag.cpp
src/scantag.cpp
+1
-1
src/simplekey.cpp
src/simplekey.cpp
+6
-2
src/stream.cpp
src/stream.cpp
+3
-2
No files found.
CMakeLists.txt
View file @
9f2781b5
...
@@ -156,6 +156,7 @@ endif()
...
@@ -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
()
src/binary.cpp
View file @
9f2781b5
...
@@ -97,4 +97,4 @@ std::vector<unsigned char> DecodeBase64(const std::string &input) {
...
@@ -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
src/contrib/graphbuilder.cpp
View file @
9f2781b5
...
@@ -14,4 +14,4 @@ void* BuildGraphOfNextDocument(Parser& parser,
...
@@ -14,4 +14,4 @@ void* BuildGraphOfNextDocument(Parser& parser,
return
nullptr
;
return
nullptr
;
}
}
}
}
}
}
// namespace YAML
src/contrib/graphbuilderadapter.cpp
View file @
9f2781b5
...
@@ -91,4 +91,4 @@ void GraphBuilderAdapter::DispositionNode(void *pNode) {
...
@@ -91,4 +91,4 @@ void GraphBuilderAdapter::DispositionNode(void *pNode) {
m_builder
.
AppendToSequence
(
pContainer
,
pNode
);
m_builder
.
AppendToSequence
(
pContainer
,
pNode
);
}
}
}
}
}
}
// namespace YAML
src/depthguard.cpp
View file @
9f2781b5
...
@@ -2,9 +2,8 @@
...
@@ -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
src/emit.cpp
View file @
9f2781b5
#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
)
{
...
...
src/exceptions.cpp
View file @
9f2781b5
...
@@ -17,4 +17,4 @@ BadPushback::~BadPushback() YAML_CPP_NOEXCEPT = default;
...
@@ -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
src/memory.cpp
View file @
9f2781b5
...
@@ -22,5 +22,5 @@ node& memory::create_node() {
...
@@ -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
src/node.cpp
View file @
9f2781b5
...
@@ -9,4 +9,4 @@ Node Clone(const Node& node) {
...
@@ -9,4 +9,4 @@ Node Clone(const Node& node) {
events
.
Emit
(
builder
);
events
.
Emit
(
builder
);
return
builder
.
Root
();
return
builder
.
Root
();
}
}
}
}
// namespace YAML
src/null.cpp
View file @
9f2781b5
...
@@ -7,4 +7,4 @@ bool IsNullString(const std::string& str) {
...
@@ -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
src/parse.cpp
View file @
9f2781b5
...
@@ -3,10 +3,10 @@
...
@@ -3,10 +3,10 @@
#include <fstream>
#include <fstream>
#include <sstream>
#include <sstream>
#include "
yaml-cpp/node/no
de.h"
#include "
nodebuil
de
r
.h"
#include "yaml-cpp/node/impl.h"
#include "yaml-cpp/node/impl.h"
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/parser.h"
#include "yaml-cpp/parser.h"
#include "nodebuilder.h"
namespace
YAML
{
namespace
YAML
{
Node
Load
(
const
std
::
string
&
input
)
{
Node
Load
(
const
std
::
string
&
input
)
{
...
...
src/parser.cpp
View file @
9f2781b5
...
@@ -17,9 +17,7 @@ Parser::Parser(std::istream& in) : Parser() { Load(in); }
...
@@ -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
));
...
...
src/scanscalar.cpp
View file @
9f2781b5
...
@@ -247,4 +247,4 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
...
@@ -247,4 +247,4 @@ std::string ScanScalar(Stream& INPUT, ScanScalarParams& params) {
return
scalar
;
return
scalar
;
}
}
}
}
// namespace YAML
src/scantag.cpp
View file @
9f2781b5
...
@@ -78,4 +78,4 @@ const std::string ScanTagSuffix(Stream& INPUT) {
...
@@ -78,4 +78,4 @@ const std::string ScanTagSuffix(Stream& INPUT) {
return
tag
;
return
tag
;
}
}
}
}
// namespace YAML
src/simplekey.cpp
View file @
9f2781b5
...
@@ -5,7 +5,11 @@ 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() {
...
@@ -125,4 +129,4 @@ void Scanner::PopAllSimpleKeys() {
while
(
!
m_simpleKeys
.
empty
())
while
(
!
m_simpleKeys
.
empty
())
m_simpleKeys
.
pop
();
m_simpleKeys
.
pop
();
}
}
}
}
// namespace YAML
src/stream.cpp
View file @
9f2781b5
...
@@ -151,7 +151,8 @@ inline UtfIntroCharType IntroCharTypeOf(std::istream::int_type ch) {
...
@@ -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
)));
...
@@ -273,7 +274,7 @@ char Stream::get() {
...
@@ -273,7 +274,7 @@ char Stream::get() {
// . Extracts 'n' characters from the stream and updates our position
// . Extracts 'n' characters from the stream and updates our position
std
::
string
Stream
::
get
(
int
n
)
{
std
::
string
Stream
::
get
(
int
n
)
{
std
::
string
ret
;
std
::
string
ret
;
if
(
n
>
0
)
{
if
(
n
>
0
)
{
ret
.
reserve
(
static_cast
<
std
::
string
::
size_type
>
(
n
));
ret
.
reserve
(
static_cast
<
std
::
string
::
size_type
>
(
n
));
for
(
int
i
=
0
;
i
<
n
;
i
++
)
for
(
int
i
=
0
;
i
<
n
;
i
++
)
ret
+=
get
();
ret
+=
get
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment