Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
0c8a5393
Commit
0c8a5393
authored
Jan 24, 2015
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warnings on visual studio, including changing unsigned to std::size_t
parent
ad712c4f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
66 additions
and
58 deletions
+66
-58
CMakeLists.txt
+1
-1
include/yaml-cpp/emitter.h
+9
-8
src/emitter.cpp
+20
-20
src/emitterstate.cpp
+6
-4
src/emitterstate.h
+8
-8
src/emitterutils.cpp
+1
-1
src/indentation.h
+8
-6
src/ostream_wrapper.cpp
+2
-2
src/ptr_stack.h
+3
-2
src/ptr_vector.h
+3
-2
src/scanner.h
+4
-3
src/simplekey.cpp
+1
-1
No files found.
CMakeLists.txt
View file @
0c8a5393
...
@@ -238,7 +238,7 @@ if(MSVC)
...
@@ -238,7 +238,7 @@ if(MSVC)
# /W3 = set warning level; see http://msdn.microsoft.com/en-us/library/thxezb7y.aspx
# /W3 = set warning level; see http://msdn.microsoft.com/en-us/library/thxezb7y.aspx
# /wd4127 = disable warning C4127 "conditional expression is constant"; see http://msdn.microsoft.com/en-us/library/6t66728h.aspx
# /wd4127 = disable warning C4127 "conditional expression is constant"; see http://msdn.microsoft.com/en-us/library/6t66728h.aspx
# /wd4355 = disable warning C4355 "'this' : used in base member initializer list"; http://msdn.microsoft.com/en-us/library/3c594ae3.aspx
# /wd4355 = disable warning C4355 "'this' : used in base member initializer list"; http://msdn.microsoft.com/en-us/library/3c594ae3.aspx
set
(
yaml_cxx_flags
"/W3 /wd4127 /wd4355
/D_SCL_SECURE_NO_WARNINGS
${
yaml_cxx_flags
}
"
)
set
(
yaml_cxx_flags
"/W3 /wd4127 /wd4355
${
yaml_cxx_flags
}
"
)
endif
()
endif
()
...
...
include/yaml-cpp/emitter.h
View file @
0c8a5393
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#pragma once
#pragma once
#endif
#endif
#include <cstddef>
#include <memory>
#include <memory>
#include <sstream>
#include <sstream>
#include <string>
#include <string>
...
@@ -48,11 +49,11 @@ class YAML_CPP_API Emitter : private noncopyable {
...
@@ -48,11 +49,11 @@ class YAML_CPP_API Emitter : private noncopyable {
bool
SetIntBase
(
EMITTER_MANIP
value
);
bool
SetIntBase
(
EMITTER_MANIP
value
);
bool
SetSeqFormat
(
EMITTER_MANIP
value
);
bool
SetSeqFormat
(
EMITTER_MANIP
value
);
bool
SetMapFormat
(
EMITTER_MANIP
value
);
bool
SetMapFormat
(
EMITTER_MANIP
value
);
bool
SetIndent
(
unsigned
n
);
bool
SetIndent
(
std
::
size_t
n
);
bool
SetPreCommentIndent
(
unsigned
n
);
bool
SetPreCommentIndent
(
std
::
size_t
n
);
bool
SetPostCommentIndent
(
unsigned
n
);
bool
SetPostCommentIndent
(
std
::
size_t
n
);
bool
SetFloatPrecision
(
unsigned
n
);
bool
SetFloatPrecision
(
std
::
size_t
n
);
bool
SetDoublePrecision
(
unsigned
n
);
bool
SetDoublePrecision
(
std
::
size_t
n
);
// local setters
// local setters
Emitter
&
SetLocalValue
(
EMITTER_MANIP
value
);
Emitter
&
SetLocalValue
(
EMITTER_MANIP
value
);
...
@@ -79,8 +80,8 @@ class YAML_CPP_API Emitter : private noncopyable {
...
@@ -79,8 +80,8 @@ class YAML_CPP_API Emitter : private noncopyable {
private
:
private
:
template
<
typename
T
>
template
<
typename
T
>
void
SetStreamablePrecision
(
std
::
stringstream
&
)
{}
void
SetStreamablePrecision
(
std
::
stringstream
&
)
{}
unsigned
GetFloatPrecision
()
const
;
std
::
size_t
GetFloatPrecision
()
const
;
unsigned
GetDoublePrecision
()
const
;
std
::
size_t
GetDoublePrecision
()
const
;
void
PrepareIntegralStream
(
std
::
stringstream
&
stream
)
const
;
void
PrepareIntegralStream
(
std
::
stringstream
&
stream
)
const
;
void
StartedScalar
();
void
StartedScalar
();
...
@@ -115,7 +116,7 @@ class YAML_CPP_API Emitter : private noncopyable {
...
@@ -115,7 +116,7 @@ class YAML_CPP_API Emitter : private noncopyable {
void
BlockMapPrepareSimpleKey
(
EmitterNodeType
::
value
child
);
void
BlockMapPrepareSimpleKey
(
EmitterNodeType
::
value
child
);
void
BlockMapPrepareSimpleKeyValue
(
EmitterNodeType
::
value
child
);
void
BlockMapPrepareSimpleKeyValue
(
EmitterNodeType
::
value
child
);
void
SpaceOrIndentTo
(
bool
requireSpace
,
unsigned
indent
);
void
SpaceOrIndentTo
(
bool
requireSpace
,
std
::
size_t
indent
);
const
char
*
ComputeFullBoolName
(
bool
b
)
const
;
const
char
*
ComputeFullBoolName
(
bool
b
)
const
;
bool
CanEmitNewline
()
const
;
bool
CanEmitNewline
()
const
;
...
...
src/emitter.cpp
View file @
0c8a5393
...
@@ -66,23 +66,23 @@ bool Emitter::SetMapFormat(EMITTER_MANIP value) {
...
@@ -66,23 +66,23 @@ bool Emitter::SetMapFormat(EMITTER_MANIP value) {
return
ok
;
return
ok
;
}
}
bool
Emitter
::
SetIndent
(
unsigned
n
)
{
bool
Emitter
::
SetIndent
(
std
::
size_t
n
)
{
return
m_pState
->
SetIndent
(
n
,
FmtScope
::
Global
);
return
m_pState
->
SetIndent
(
n
,
FmtScope
::
Global
);
}
}
bool
Emitter
::
SetPreCommentIndent
(
unsigned
n
)
{
bool
Emitter
::
SetPreCommentIndent
(
std
::
size_t
n
)
{
return
m_pState
->
SetPreCommentIndent
(
n
,
FmtScope
::
Global
);
return
m_pState
->
SetPreCommentIndent
(
n
,
FmtScope
::
Global
);
}
}
bool
Emitter
::
SetPostCommentIndent
(
unsigned
n
)
{
bool
Emitter
::
SetPostCommentIndent
(
std
::
size_t
n
)
{
return
m_pState
->
SetPostCommentIndent
(
n
,
FmtScope
::
Global
);
return
m_pState
->
SetPostCommentIndent
(
n
,
FmtScope
::
Global
);
}
}
bool
Emitter
::
SetFloatPrecision
(
unsigned
n
)
{
bool
Emitter
::
SetFloatPrecision
(
std
::
size_t
n
)
{
return
m_pState
->
SetFloatPrecision
(
n
,
FmtScope
::
Global
);
return
m_pState
->
SetFloatPrecision
(
n
,
FmtScope
::
Global
);
}
}
bool
Emitter
::
SetDoublePrecision
(
unsigned
n
)
{
bool
Emitter
::
SetDoublePrecision
(
std
::
size_t
n
)
{
return
m_pState
->
SetDoublePrecision
(
n
,
FmtScope
::
Global
);
return
m_pState
->
SetDoublePrecision
(
n
,
FmtScope
::
Global
);
}
}
...
@@ -310,7 +310,7 @@ void Emitter::PrepareTopNode(EmitterNodeType::value child) {
...
@@ -310,7 +310,7 @@ void Emitter::PrepareTopNode(EmitterNodeType::value child) {
}
}
void
Emitter
::
FlowSeqPrepareNode
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
FlowSeqPrepareNode
(
EmitterNodeType
::
value
child
)
{
const
unsigned
lastIndent
=
m_pState
->
LastIndent
();
const
std
::
size_t
lastIndent
=
m_pState
->
LastIndent
();
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
m_stream
.
comment
())
if
(
m_stream
.
comment
())
...
@@ -341,8 +341,8 @@ void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child) {
...
@@ -341,8 +341,8 @@ void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child) {
}
}
void
Emitter
::
BlockSeqPrepareNode
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
BlockSeqPrepareNode
(
EmitterNodeType
::
value
child
)
{
const
unsigned
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
curIndent
=
m_pState
->
CurIndent
();
const
unsigned
nextIndent
=
curIndent
+
m_pState
->
CurGroupIndent
();
const
std
::
size_t
nextIndent
=
curIndent
+
m_pState
->
CurGroupIndent
();
if
(
child
==
EmitterNodeType
::
None
)
if
(
child
==
EmitterNodeType
::
None
)
return
;
return
;
...
@@ -392,7 +392,7 @@ void Emitter::FlowMapPrepareNode(EmitterNodeType::value child) {
...
@@ -392,7 +392,7 @@ void Emitter::FlowMapPrepareNode(EmitterNodeType::value child) {
}
}
void
Emitter
::
FlowMapPrepareLongKey
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
FlowMapPrepareLongKey
(
EmitterNodeType
::
value
child
)
{
const
unsigned
lastIndent
=
m_pState
->
LastIndent
();
const
std
::
size_t
lastIndent
=
m_pState
->
LastIndent
();
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
m_stream
.
comment
())
if
(
m_stream
.
comment
())
...
@@ -423,7 +423,7 @@ void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child) {
...
@@ -423,7 +423,7 @@ void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child) {
}
}
void
Emitter
::
FlowMapPrepareLongKeyValue
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
FlowMapPrepareLongKeyValue
(
EmitterNodeType
::
value
child
)
{
const
unsigned
lastIndent
=
m_pState
->
LastIndent
();
const
std
::
size_t
lastIndent
=
m_pState
->
LastIndent
();
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
m_stream
.
comment
())
if
(
m_stream
.
comment
())
...
@@ -451,7 +451,7 @@ void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child) {
...
@@ -451,7 +451,7 @@ void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child) {
}
}
void
Emitter
::
FlowMapPrepareSimpleKey
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
FlowMapPrepareSimpleKey
(
EmitterNodeType
::
value
child
)
{
const
unsigned
lastIndent
=
m_pState
->
LastIndent
();
const
std
::
size_t
lastIndent
=
m_pState
->
LastIndent
();
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
m_stream
.
comment
())
if
(
m_stream
.
comment
())
...
@@ -482,7 +482,7 @@ void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child) {
...
@@ -482,7 +482,7 @@ void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child) {
}
}
void
Emitter
::
FlowMapPrepareSimpleKeyValue
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
FlowMapPrepareSimpleKeyValue
(
EmitterNodeType
::
value
child
)
{
const
unsigned
lastIndent
=
m_pState
->
LastIndent
();
const
std
::
size_t
lastIndent
=
m_pState
->
LastIndent
();
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
m_stream
.
comment
())
if
(
m_stream
.
comment
())
...
@@ -530,7 +530,7 @@ void Emitter::BlockMapPrepareNode(EmitterNodeType::value child) {
...
@@ -530,7 +530,7 @@ void Emitter::BlockMapPrepareNode(EmitterNodeType::value child) {
}
}
void
Emitter
::
BlockMapPrepareLongKey
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
BlockMapPrepareLongKey
(
EmitterNodeType
::
value
child
)
{
const
unsigned
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
childCount
=
m_pState
->
CurGroupChildCount
();
const
std
::
size_t
childCount
=
m_pState
->
CurGroupChildCount
();
if
(
child
==
EmitterNodeType
::
None
)
if
(
child
==
EmitterNodeType
::
None
)
...
@@ -563,7 +563,7 @@ void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
...
@@ -563,7 +563,7 @@ void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
}
}
void
Emitter
::
BlockMapPrepareLongKeyValue
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
BlockMapPrepareLongKeyValue
(
EmitterNodeType
::
value
child
)
{
const
unsigned
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
curIndent
=
m_pState
->
CurIndent
();
if
(
child
==
EmitterNodeType
::
None
)
if
(
child
==
EmitterNodeType
::
None
)
return
;
return
;
...
@@ -589,7 +589,7 @@ void Emitter::BlockMapPrepareLongKeyValue(EmitterNodeType::value child) {
...
@@ -589,7 +589,7 @@ void Emitter::BlockMapPrepareLongKeyValue(EmitterNodeType::value child) {
}
}
void
Emitter
::
BlockMapPrepareSimpleKey
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
BlockMapPrepareSimpleKey
(
EmitterNodeType
::
value
child
)
{
const
unsigned
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
childCount
=
m_pState
->
CurGroupChildCount
();
const
std
::
size_t
childCount
=
m_pState
->
CurGroupChildCount
();
if
(
child
==
EmitterNodeType
::
None
)
if
(
child
==
EmitterNodeType
::
None
)
...
@@ -617,8 +617,8 @@ void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) {
...
@@ -617,8 +617,8 @@ void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) {
}
}
void
Emitter
::
BlockMapPrepareSimpleKeyValue
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
BlockMapPrepareSimpleKeyValue
(
EmitterNodeType
::
value
child
)
{
const
unsigned
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
curIndent
=
m_pState
->
CurIndent
();
const
unsigned
nextIndent
=
curIndent
+
m_pState
->
CurGroupIndent
();
const
std
::
size_t
nextIndent
=
curIndent
+
m_pState
->
CurGroupIndent
();
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
!
m_pState
->
HasBegunNode
())
{
m_stream
<<
":"
;
m_stream
<<
":"
;
...
@@ -642,7 +642,7 @@ void Emitter::BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
...
@@ -642,7 +642,7 @@ void Emitter::BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
// SpaceOrIndentTo
// SpaceOrIndentTo
// . Prepares for some more content by proper spacing
// . Prepares for some more content by proper spacing
void
Emitter
::
SpaceOrIndentTo
(
bool
requireSpace
,
unsigned
indent
)
{
void
Emitter
::
SpaceOrIndentTo
(
bool
requireSpace
,
std
::
size_t
indent
)
{
if
(
m_stream
.
comment
())
if
(
m_stream
.
comment
())
m_stream
<<
"
\n
"
;
m_stream
<<
"
\n
"
;
if
(
m_stream
.
col
()
>
0
&&
requireSpace
)
if
(
m_stream
.
col
()
>
0
&&
requireSpace
)
...
@@ -709,11 +709,11 @@ Emitter& Emitter::Write(const std::string& str) {
...
@@ -709,11 +709,11 @@ Emitter& Emitter::Write(const std::string& str) {
return
*
this
;
return
*
this
;
}
}
unsigned
Emitter
::
GetFloatPrecision
()
const
{
std
::
size_t
Emitter
::
GetFloatPrecision
()
const
{
return
m_pState
->
GetFloatPrecision
();
return
m_pState
->
GetFloatPrecision
();
}
}
unsigned
Emitter
::
GetDoublePrecision
()
const
{
std
::
size_t
Emitter
::
GetDoublePrecision
()
const
{
return
m_pState
->
GetDoublePrecision
();
return
m_pState
->
GetDoublePrecision
();
}
}
...
...
src/emitterstate.cpp
View file @
0c8a5393
...
@@ -155,7 +155,7 @@ void EmitterState::EndedGroup(GroupType::value type) {
...
@@ -155,7 +155,7 @@ void EmitterState::EndedGroup(GroupType::value type) {
}
}
// reset old settings
// reset old settings
unsigned
lastIndent
=
(
m_groups
.
empty
()
?
0
:
m_groups
.
top
().
indent
);
std
::
size_t
lastIndent
=
(
m_groups
.
empty
()
?
0
:
m_groups
.
top
().
indent
);
assert
(
m_curIndent
>=
lastIndent
);
assert
(
m_curIndent
>=
lastIndent
);
m_curIndent
-=
lastIndent
;
m_curIndent
-=
lastIndent
;
...
@@ -276,7 +276,7 @@ bool EmitterState::SetIntFormat(EMITTER_MANIP value, FmtScope::value scope) {
...
@@ -276,7 +276,7 @@ bool EmitterState::SetIntFormat(EMITTER_MANIP value, FmtScope::value scope) {
}
}
}
}
bool
EmitterState
::
SetIndent
(
unsigned
value
,
FmtScope
::
value
scope
)
{
bool
EmitterState
::
SetIndent
(
std
::
size_t
value
,
FmtScope
::
value
scope
)
{
if
(
value
<=
1
)
if
(
value
<=
1
)
return
false
;
return
false
;
...
@@ -284,7 +284,8 @@ bool EmitterState::SetIndent(unsigned value, FmtScope::value scope) {
...
@@ -284,7 +284,8 @@ bool EmitterState::SetIndent(unsigned value, FmtScope::value scope) {
return
true
;
return
true
;
}
}
bool
EmitterState
::
SetPreCommentIndent
(
unsigned
value
,
FmtScope
::
value
scope
)
{
bool
EmitterState
::
SetPreCommentIndent
(
std
::
size_t
value
,
FmtScope
::
value
scope
)
{
if
(
value
==
0
)
if
(
value
==
0
)
return
false
;
return
false
;
...
@@ -292,7 +293,8 @@ bool EmitterState::SetPreCommentIndent(unsigned value, FmtScope::value scope) {
...
@@ -292,7 +293,8 @@ bool EmitterState::SetPreCommentIndent(unsigned value, FmtScope::value scope) {
return
true
;
return
true
;
}
}
bool
EmitterState
::
SetPostCommentIndent
(
unsigned
value
,
FmtScope
::
value
scope
)
{
bool
EmitterState
::
SetPostCommentIndent
(
std
::
size_t
value
,
FmtScope
::
value
scope
)
{
if
(
value
==
0
)
if
(
value
==
0
)
return
false
;
return
false
;
...
...
src/emitterstate.h
View file @
0c8a5393
...
@@ -94,12 +94,12 @@ class EmitterState {
...
@@ -94,12 +94,12 @@ class EmitterState {
bool
SetIntFormat
(
EMITTER_MANIP
value
,
FmtScope
::
value
scope
);
bool
SetIntFormat
(
EMITTER_MANIP
value
,
FmtScope
::
value
scope
);
EMITTER_MANIP
GetIntFormat
()
const
{
return
m_intFmt
.
get
();
}
EMITTER_MANIP
GetIntFormat
()
const
{
return
m_intFmt
.
get
();
}
bool
SetIndent
(
unsigned
value
,
FmtScope
::
value
scope
);
bool
SetIndent
(
std
::
size_t
value
,
FmtScope
::
value
scope
);
int
GetIndent
()
const
{
return
m_indent
.
get
();
}
int
GetIndent
()
const
{
return
m_indent
.
get
();
}
bool
SetPreCommentIndent
(
unsigned
value
,
FmtScope
::
value
scope
);
bool
SetPreCommentIndent
(
std
::
size_t
value
,
FmtScope
::
value
scope
);
int
GetPreCommentIndent
()
const
{
return
m_preCommentIndent
.
get
();
}
int
GetPreCommentIndent
()
const
{
return
m_preCommentIndent
.
get
();
}
bool
SetPostCommentIndent
(
unsigned
value
,
FmtScope
::
value
scope
);
bool
SetPostCommentIndent
(
std
::
size_t
value
,
FmtScope
::
value
scope
);
int
GetPostCommentIndent
()
const
{
return
m_postCommentIndent
.
get
();
}
int
GetPostCommentIndent
()
const
{
return
m_postCommentIndent
.
get
();
}
bool
SetFlowType
(
GroupType
::
value
groupType
,
EMITTER_MANIP
value
,
bool
SetFlowType
(
GroupType
::
value
groupType
,
EMITTER_MANIP
value
,
...
@@ -110,9 +110,9 @@ class EmitterState {
...
@@ -110,9 +110,9 @@ class EmitterState {
EMITTER_MANIP
GetMapKeyFormat
()
const
{
return
m_mapKeyFmt
.
get
();
}
EMITTER_MANIP
GetMapKeyFormat
()
const
{
return
m_mapKeyFmt
.
get
();
}
bool
SetFloatPrecision
(
int
value
,
FmtScope
::
value
scope
);
bool
SetFloatPrecision
(
int
value
,
FmtScope
::
value
scope
);
unsigned
GetFloatPrecision
()
const
{
return
m_floatPrecision
.
get
();
}
std
::
size_t
GetFloatPrecision
()
const
{
return
m_floatPrecision
.
get
();
}
bool
SetDoublePrecision
(
int
value
,
FmtScope
::
value
scope
);
bool
SetDoublePrecision
(
int
value
,
FmtScope
::
value
scope
);
unsigned
GetDoublePrecision
()
const
{
return
m_doublePrecision
.
get
();
}
std
::
size_t
GetDoublePrecision
()
const
{
return
m_doublePrecision
.
get
();
}
private
:
private
:
template
<
typename
T
>
template
<
typename
T
>
...
@@ -132,8 +132,8 @@ class EmitterState {
...
@@ -132,8 +132,8 @@ class EmitterState {
Setting
<
EMITTER_MANIP
>
m_boolLengthFmt
;
Setting
<
EMITTER_MANIP
>
m_boolLengthFmt
;
Setting
<
EMITTER_MANIP
>
m_boolCaseFmt
;
Setting
<
EMITTER_MANIP
>
m_boolCaseFmt
;
Setting
<
EMITTER_MANIP
>
m_intFmt
;
Setting
<
EMITTER_MANIP
>
m_intFmt
;
Setting
<
unsigned
>
m_indent
;
Setting
<
std
::
size_t
>
m_indent
;
Setting
<
unsigned
>
m_preCommentIndent
,
m_postCommentIndent
;
Setting
<
std
::
size_t
>
m_preCommentIndent
,
m_postCommentIndent
;
Setting
<
EMITTER_MANIP
>
m_seqFmt
;
Setting
<
EMITTER_MANIP
>
m_seqFmt
;
Setting
<
EMITTER_MANIP
>
m_mapFmt
;
Setting
<
EMITTER_MANIP
>
m_mapFmt
;
Setting
<
EMITTER_MANIP
>
m_mapKeyFmt
;
Setting
<
EMITTER_MANIP
>
m_mapKeyFmt
;
...
@@ -175,7 +175,7 @@ class EmitterState {
...
@@ -175,7 +175,7 @@ class EmitterState {
};
};
ptr_stack
<
Group
>
m_groups
;
ptr_stack
<
Group
>
m_groups
;
unsigned
m_curIndent
;
std
::
size_t
m_curIndent
;
bool
m_hasAnchor
;
bool
m_hasAnchor
;
bool
m_hasTag
;
bool
m_hasTag
;
bool
m_hasNonContent
;
bool
m_hasNonContent
;
...
...
src/emitterutils.cpp
View file @
0c8a5393
...
@@ -358,7 +358,7 @@ bool WriteChar(ostream_wrapper& out, char ch) {
...
@@ -358,7 +358,7 @@ bool WriteChar(ostream_wrapper& out, char ch) {
bool
WriteComment
(
ostream_wrapper
&
out
,
const
std
::
string
&
str
,
bool
WriteComment
(
ostream_wrapper
&
out
,
const
std
::
string
&
str
,
int
postCommentIndent
)
{
int
postCommentIndent
)
{
const
unsigned
curIndent
=
out
.
col
();
const
std
::
size_t
curIndent
=
out
.
col
();
out
<<
"#"
<<
Indentation
(
postCommentIndent
);
out
<<
"#"
<<
Indentation
(
postCommentIndent
);
out
.
set_comment
();
out
.
set_comment
();
int
codePoint
;
int
codePoint
;
...
...
src/indentation.h
View file @
0c8a5393
...
@@ -7,25 +7,27 @@
...
@@ -7,25 +7,27 @@
#pragma once
#pragma once
#endif
#endif
#include "yaml-cpp/ostream_wrapper.h"
#include <iostream>
#include <iostream>
#include <cstddef>
#include "yaml-cpp/ostream_wrapper.h"
namespace
YAML
{
namespace
YAML
{
struct
Indentation
{
struct
Indentation
{
Indentation
(
unsigned
n_
)
:
n
(
n_
)
{}
Indentation
(
std
::
size_t
n_
)
:
n
(
n_
)
{}
unsigned
n
;
std
::
size_t
n
;
};
};
inline
ostream_wrapper
&
operator
<<
(
ostream_wrapper
&
out
,
inline
ostream_wrapper
&
operator
<<
(
ostream_wrapper
&
out
,
const
Indentation
&
indent
)
{
const
Indentation
&
indent
)
{
for
(
unsigned
i
=
0
;
i
<
indent
.
n
;
i
++
)
for
(
std
::
size_t
i
=
0
;
i
<
indent
.
n
;
i
++
)
out
<<
' '
;
out
<<
' '
;
return
out
;
return
out
;
}
}
struct
IndentTo
{
struct
IndentTo
{
IndentTo
(
unsigned
n_
)
:
n
(
n_
)
{}
IndentTo
(
std
::
size_t
n_
)
:
n
(
n_
)
{}
unsigned
n
;
std
::
size_t
n
;
};
};
inline
ostream_wrapper
&
operator
<<
(
ostream_wrapper
&
out
,
inline
ostream_wrapper
&
operator
<<
(
ostream_wrapper
&
out
,
...
...
src/ostream_wrapper.cpp
View file @
0c8a5393
...
@@ -23,7 +23,7 @@ void ostream_wrapper::write(const std::string& str) {
...
@@ -23,7 +23,7 @@ void ostream_wrapper::write(const std::string& str) {
m_pStream
->
write
(
str
.
c_str
(),
str
.
size
());
m_pStream
->
write
(
str
.
c_str
(),
str
.
size
());
}
else
{
}
else
{
m_buffer
.
resize
(
std
::
max
(
m_buffer
.
size
(),
m_pos
+
str
.
size
()
+
1
));
m_buffer
.
resize
(
std
::
max
(
m_buffer
.
size
(),
m_pos
+
str
.
size
()
+
1
));
std
::
copy
(
str
.
begin
(),
str
.
end
(),
&
m_buffer
[
m_pos
]
);
std
::
copy
(
str
.
begin
(),
str
.
end
(),
m_buffer
.
begin
()
+
m_pos
);
}
}
for
(
std
::
size_t
i
=
0
;
i
<
str
.
size
();
i
++
)
{
for
(
std
::
size_t
i
=
0
;
i
<
str
.
size
();
i
++
)
{
...
@@ -36,7 +36,7 @@ void ostream_wrapper::write(const char* str, std::size_t size) {
...
@@ -36,7 +36,7 @@ void ostream_wrapper::write(const char* str, std::size_t size) {
m_pStream
->
write
(
str
,
size
);
m_pStream
->
write
(
str
,
size
);
}
else
{
}
else
{
m_buffer
.
resize
(
std
::
max
(
m_buffer
.
size
(),
m_pos
+
size
+
1
));
m_buffer
.
resize
(
std
::
max
(
m_buffer
.
size
(),
m_pos
+
size
+
1
));
std
::
copy
(
str
,
str
+
size
,
&
m_buffer
[
m_pos
]
);
std
::
copy
(
str
,
str
+
size
,
m_buffer
.
begin
()
+
m_pos
);
}
}
for
(
std
::
size_t
i
=
0
;
i
<
size
;
i
++
)
{
for
(
std
::
size_t
i
=
0
;
i
<
size
;
i
++
)
{
...
...
src/ptr_stack.h
View file @
0c8a5393
...
@@ -7,12 +7,13 @@
...
@@ -7,12 +7,13 @@
#pragma once
#pragma once
#endif
#endif
#include "yaml-cpp/noncopyable.h"
#include <cstddef>
#include <cstddef>
#include <cstdlib>
#include <cstdlib>
#include <memory>
#include <memory>
#include <vector>
#include <vector>
#include "yaml-cpp/noncopyable.h"
template
<
typename
T
>
template
<
typename
T
>
class
ptr_stack
:
private
YAML
::
noncopyable
{
class
ptr_stack
:
private
YAML
::
noncopyable
{
public
:
public
:
...
@@ -20,7 +21,7 @@ class ptr_stack : private YAML::noncopyable {
...
@@ -20,7 +21,7 @@ class ptr_stack : private YAML::noncopyable {
~
ptr_stack
()
{
clear
();
}
~
ptr_stack
()
{
clear
();
}
void
clear
()
{
void
clear
()
{
for
(
unsigned
i
=
0
;
i
<
m_data
.
size
();
i
++
)
for
(
std
::
size_t
i
=
0
;
i
<
m_data
.
size
();
i
++
)
delete
m_data
[
i
];
delete
m_data
[
i
];
m_data
.
clear
();
m_data
.
clear
();
}
}
...
...
src/ptr_vector.h
View file @
0c8a5393
...
@@ -7,12 +7,13 @@
...
@@ -7,12 +7,13 @@
#pragma once
#pragma once
#endif
#endif
#include "yaml-cpp/noncopyable.h"
#include <cstddef>
#include <cstddef>
#include <cstdlib>
#include <cstdlib>
#include <memory>
#include <memory>
#include <vector>
#include <vector>
#include "yaml-cpp/noncopyable.h"
namespace
YAML
{
namespace
YAML
{
template
<
typename
T
>
template
<
typename
T
>
...
@@ -22,7 +23,7 @@ class ptr_vector : private YAML::noncopyable {
...
@@ -22,7 +23,7 @@ class ptr_vector : private YAML::noncopyable {
~
ptr_vector
()
{
clear
();
}
~
ptr_vector
()
{
clear
();
}
void
clear
()
{
void
clear
()
{
for
(
unsigned
i
=
0
;
i
<
m_data
.
size
();
i
++
)
for
(
std
::
size_t
i
=
0
;
i
<
m_data
.
size
();
i
++
)
delete
m_data
[
i
];
delete
m_data
[
i
];
m_data
.
clear
();
m_data
.
clear
();
}
}
...
...
src/scanner.h
View file @
0c8a5393
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#pragma once
#pragma once
#endif
#endif
#include <cstddef>
#include <ios>
#include <ios>
#include <map>
#include <map>
#include <queue>
#include <queue>
...
@@ -60,7 +61,7 @@ class Scanner {
...
@@ -60,7 +61,7 @@ class Scanner {
bool
InFlowContext
()
const
{
return
!
m_flows
.
empty
();
}
bool
InFlowContext
()
const
{
return
!
m_flows
.
empty
();
}
bool
InBlockContext
()
const
{
return
m_flows
.
empty
();
}
bool
InBlockContext
()
const
{
return
m_flows
.
empty
();
}
in
t
GetFlowLevel
()
const
{
return
m_flows
.
size
();
}
std
::
size_
t
GetFlowLevel
()
const
{
return
m_flows
.
size
();
}
Token
::
TYPE
GetStartTokenFor
(
IndentMarker
::
INDENT_TYPE
type
)
const
;
Token
::
TYPE
GetStartTokenFor
(
IndentMarker
::
INDENT_TYPE
type
)
const
;
IndentMarker
*
PushIndentTo
(
int
column
,
IndentMarker
::
INDENT_TYPE
type
);
IndentMarker
*
PushIndentTo
(
int
column
,
IndentMarker
::
INDENT_TYPE
type
);
...
@@ -83,13 +84,13 @@ class Scanner {
...
@@ -83,13 +84,13 @@ class Scanner {
const
RegEx
&
GetValueRegex
()
const
;
const
RegEx
&
GetValueRegex
()
const
;
struct
SimpleKey
{
struct
SimpleKey
{
SimpleKey
(
const
Mark
&
mark_
,
in
t
flowLevel_
);
SimpleKey
(
const
Mark
&
mark_
,
std
::
size_
t
flowLevel_
);
void
Validate
();
void
Validate
();
void
Invalidate
();
void
Invalidate
();
Mark
mark
;
Mark
mark
;
in
t
flowLevel
;
std
::
size_
t
flowLevel
;
IndentMarker
*
pIndent
;
IndentMarker
*
pIndent
;
Token
*
pMapStart
,
*
pKey
;
Token
*
pMapStart
,
*
pKey
;
};
};
...
...
src/simplekey.cpp
View file @
0c8a5393
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
namespace
YAML
{
namespace
YAML
{
struct
Mark
;
struct
Mark
;
Scanner
::
SimpleKey
::
SimpleKey
(
const
Mark
&
mark_
,
in
t
flowLevel_
)
Scanner
::
SimpleKey
::
SimpleKey
(
const
Mark
&
mark_
,
std
::
size_
t
flowLevel_
)
:
mark
(
mark_
),
flowLevel
(
flowLevel_
),
pIndent
(
0
),
pMapStart
(
0
),
pKey
(
0
)
{}
:
mark
(
mark_
),
flowLevel
(
flowLevel_
),
pIndent
(
0
),
pMapStart
(
0
),
pKey
(
0
)
{}
void
Scanner
::
SimpleKey
::
Validate
()
{
void
Scanner
::
SimpleKey
::
Validate
()
{
...
...
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