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
087e0673
Commit
087e0673
authored
Jan 24, 2015
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed the None enumeration vaules to NoType to avoid a collision with X11's macro
parent
2b2e6071
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
32 deletions
+32
-32
include/yaml-cpp/emitterdef.h
+1
-1
src/collectionstack.h
+2
-2
src/emitter.cpp
+22
-22
src/emitterstate.cpp
+4
-4
src/emitterstate.h
+3
-3
No files found.
include/yaml-cpp/emitterdef.h
View file @
087e0673
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
namespace
YAML
{
namespace
YAML
{
struct
EmitterNodeType
{
struct
EmitterNodeType
{
enum
value
{
No
n
e
,
Property
,
Scalar
,
FlowSeq
,
BlockSeq
,
FlowMap
,
BlockMap
};
enum
value
{
No
Typ
e
,
Property
,
Scalar
,
FlowSeq
,
BlockSeq
,
FlowMap
,
BlockMap
};
};
};
}
}
...
...
src/collectionstack.h
View file @
087e0673
...
@@ -12,14 +12,14 @@
...
@@ -12,14 +12,14 @@
namespace
YAML
{
namespace
YAML
{
struct
CollectionType
{
struct
CollectionType
{
enum
value
{
No
ne
,
BlockMap
,
BlockSeq
,
FlowMap
,
FlowSeq
,
CompactMap
};
enum
value
{
No
Collection
,
BlockMap
,
BlockSeq
,
FlowMap
,
FlowSeq
,
CompactMap
};
};
};
class
CollectionStack
{
class
CollectionStack
{
public
:
public
:
CollectionType
::
value
GetCurCollectionType
()
const
{
CollectionType
::
value
GetCurCollectionType
()
const
{
if
(
collectionStack
.
empty
())
if
(
collectionStack
.
empty
())
return
CollectionType
::
No
ne
;
return
CollectionType
::
No
Collection
;
return
collectionStack
.
top
();
return
collectionStack
.
top
();
}
}
...
...
src/emitter.cpp
View file @
087e0673
...
@@ -146,7 +146,7 @@ void Emitter::EmitBeginDoc() {
...
@@ -146,7 +146,7 @@ void Emitter::EmitBeginDoc() {
if
(
!
good
())
if
(
!
good
())
return
;
return
;
if
(
m_pState
->
CurGroupType
()
!=
GroupType
::
No
n
e
)
{
if
(
m_pState
->
CurGroupType
()
!=
GroupType
::
No
Typ
e
)
{
m_pState
->
SetError
(
"Unexpected begin document"
);
m_pState
->
SetError
(
"Unexpected begin document"
);
return
;
return
;
}
}
...
@@ -168,7 +168,7 @@ void Emitter::EmitEndDoc() {
...
@@ -168,7 +168,7 @@ void Emitter::EmitEndDoc() {
if
(
!
good
())
if
(
!
good
())
return
;
return
;
if
(
m_pState
->
CurGroupType
()
!=
GroupType
::
No
n
e
)
{
if
(
m_pState
->
CurGroupType
()
!=
GroupType
::
No
Typ
e
)
{
m_pState
->
SetError
(
"Unexpected begin document"
);
m_pState
->
SetError
(
"Unexpected begin document"
);
return
;
return
;
}
}
...
@@ -248,7 +248,7 @@ void Emitter::EmitNewline() {
...
@@ -248,7 +248,7 @@ void Emitter::EmitNewline() {
if
(
!
good
())
if
(
!
good
())
return
;
return
;
PrepareNode
(
EmitterNodeType
::
No
n
e
);
PrepareNode
(
EmitterNodeType
::
No
Typ
e
);
m_stream
<<
"
\n
"
;
m_stream
<<
"
\n
"
;
m_pState
->
SetNonContent
();
m_pState
->
SetNonContent
();
}
}
...
@@ -259,7 +259,7 @@ bool Emitter::CanEmitNewline() const { return true; }
...
@@ -259,7 +259,7 @@ bool Emitter::CanEmitNewline() const { return true; }
// E.g., if we're in a sequence, write the "- "
// E.g., if we're in a sequence, write the "- "
void
Emitter
::
PrepareNode
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
PrepareNode
(
EmitterNodeType
::
value
child
)
{
switch
(
m_pState
->
CurGroupNodeType
())
{
switch
(
m_pState
->
CurGroupNodeType
())
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
PrepareTopNode
(
child
);
PrepareTopNode
(
child
);
break
;
break
;
case
EmitterNodeType
:
:
FlowSeq
:
case
EmitterNodeType
:
:
FlowSeq
:
...
@@ -282,16 +282,16 @@ void Emitter::PrepareNode(EmitterNodeType::value child) {
...
@@ -282,16 +282,16 @@ void Emitter::PrepareNode(EmitterNodeType::value child) {
}
}
void
Emitter
::
PrepareTopNode
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
PrepareTopNode
(
EmitterNodeType
::
value
child
)
{
if
(
child
==
EmitterNodeType
::
No
n
e
)
if
(
child
==
EmitterNodeType
::
No
Typ
e
)
return
;
return
;
if
(
m_pState
->
CurGroupChildCount
()
>
0
&&
m_stream
.
col
()
>
0
)
{
if
(
m_pState
->
CurGroupChildCount
()
>
0
&&
m_stream
.
col
()
>
0
)
{
if
(
child
!=
EmitterNodeType
::
No
n
e
)
if
(
child
!=
EmitterNodeType
::
No
Typ
e
)
EmitBeginDoc
();
EmitBeginDoc
();
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -323,7 +323,7 @@ void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child) {
...
@@ -323,7 +323,7 @@ void Emitter::FlowSeqPrepareNode(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -344,7 +344,7 @@ void Emitter::BlockSeqPrepareNode(EmitterNodeType::value child) {
...
@@ -344,7 +344,7 @@ void Emitter::BlockSeqPrepareNode(EmitterNodeType::value child) {
const
std
::
size_t
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
nextIndent
=
curIndent
+
m_pState
->
CurGroupIndent
();
const
std
::
size_t
nextIndent
=
curIndent
+
m_pState
->
CurGroupIndent
();
if
(
child
==
EmitterNodeType
::
No
n
e
)
if
(
child
==
EmitterNodeType
::
No
Typ
e
)
return
;
return
;
if
(
!
m_pState
->
HasBegunContent
())
{
if
(
!
m_pState
->
HasBegunContent
())
{
...
@@ -356,7 +356,7 @@ void Emitter::BlockSeqPrepareNode(EmitterNodeType::value child) {
...
@@ -356,7 +356,7 @@ void Emitter::BlockSeqPrepareNode(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -405,7 +405,7 @@ void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child) {
...
@@ -405,7 +405,7 @@ void Emitter::FlowMapPrepareLongKey(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -433,7 +433,7 @@ void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child) {
...
@@ -433,7 +433,7 @@ void Emitter::FlowMapPrepareLongKeyValue(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -464,7 +464,7 @@ void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child) {
...
@@ -464,7 +464,7 @@ void Emitter::FlowMapPrepareSimpleKey(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -492,7 +492,7 @@ void Emitter::FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
...
@@ -492,7 +492,7 @@ void Emitter::FlowMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -533,7 +533,7 @@ void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
...
@@ -533,7 +533,7 @@ void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
const
std
::
size_t
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
::
No
n
e
)
if
(
child
==
EmitterNodeType
::
No
Typ
e
)
return
;
return
;
if
(
!
m_pState
->
HasBegunContent
())
{
if
(
!
m_pState
->
HasBegunContent
())
{
...
@@ -548,7 +548,7 @@ void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
...
@@ -548,7 +548,7 @@ void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -565,7 +565,7 @@ void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
...
@@ -565,7 +565,7 @@ void Emitter::BlockMapPrepareLongKey(EmitterNodeType::value child) {
void
Emitter
::
BlockMapPrepareLongKeyValue
(
EmitterNodeType
::
value
child
)
{
void
Emitter
::
BlockMapPrepareLongKeyValue
(
EmitterNodeType
::
value
child
)
{
const
std
::
size_t
curIndent
=
m_pState
->
CurIndent
();
const
std
::
size_t
curIndent
=
m_pState
->
CurIndent
();
if
(
child
==
EmitterNodeType
::
No
n
e
)
if
(
child
==
EmitterNodeType
::
No
Typ
e
)
return
;
return
;
if
(
!
m_pState
->
HasBegunContent
())
{
if
(
!
m_pState
->
HasBegunContent
())
{
...
@@ -575,7 +575,7 @@ void Emitter::BlockMapPrepareLongKeyValue(EmitterNodeType::value child) {
...
@@ -575,7 +575,7 @@ void Emitter::BlockMapPrepareLongKeyValue(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -592,7 +592,7 @@ void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) {
...
@@ -592,7 +592,7 @@ void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) {
const
std
::
size_t
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
::
No
n
e
)
if
(
child
==
EmitterNodeType
::
No
Typ
e
)
return
;
return
;
if
(
!
m_pState
->
HasBegunNode
())
{
if
(
!
m_pState
->
HasBegunNode
())
{
...
@@ -602,7 +602,7 @@ void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) {
...
@@ -602,7 +602,7 @@ void Emitter::BlockMapPrepareSimpleKey(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -625,7 +625,7 @@ void Emitter::BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
...
@@ -625,7 +625,7 @@ void Emitter::BlockMapPrepareSimpleKeyValue(EmitterNodeType::value child) {
}
}
switch
(
child
)
{
switch
(
child
)
{
case
EmitterNodeType
:
:
No
n
e
:
case
EmitterNodeType
:
:
No
Typ
e
:
break
;
break
;
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Property
:
case
EmitterNodeType
:
:
Scalar
:
case
EmitterNodeType
:
:
Scalar
:
...
@@ -871,7 +871,7 @@ Emitter& Emitter::Write(const _Comment& comment) {
...
@@ -871,7 +871,7 @@ Emitter& Emitter::Write(const _Comment& comment) {
if
(
!
good
())
if
(
!
good
())
return
*
this
;
return
*
this
;
PrepareNode
(
EmitterNodeType
::
No
n
e
);
PrepareNode
(
EmitterNodeType
::
No
Typ
e
);
if
(
m_stream
.
col
()
>
0
)
if
(
m_stream
.
col
()
>
0
)
m_stream
<<
Indentation
(
m_pState
->
GetPreCommentIndent
());
m_stream
<<
Indentation
(
m_pState
->
GetPreCommentIndent
());
...
...
src/emitterstate.cpp
View file @
087e0673
...
@@ -98,7 +98,7 @@ EmitterNodeType::value EmitterState::NextGroupType(
...
@@ -98,7 +98,7 @@ EmitterNodeType::value EmitterState::NextGroupType(
// can't happen
// can't happen
assert
(
false
);
assert
(
false
);
return
EmitterNodeType
::
No
n
e
;
return
EmitterNodeType
::
No
Typ
e
;
}
}
void
EmitterState
::
StartedDoc
()
{
void
EmitterState
::
StartedDoc
()
{
...
@@ -168,17 +168,17 @@ void EmitterState::EndedGroup(GroupType::value type) {
...
@@ -168,17 +168,17 @@ void EmitterState::EndedGroup(GroupType::value type) {
EmitterNodeType
::
value
EmitterState
::
CurGroupNodeType
()
const
{
EmitterNodeType
::
value
EmitterState
::
CurGroupNodeType
()
const
{
if
(
m_groups
.
empty
())
if
(
m_groups
.
empty
())
return
EmitterNodeType
::
No
n
e
;
return
EmitterNodeType
::
No
Typ
e
;
return
m_groups
.
top
().
NodeType
();
return
m_groups
.
top
().
NodeType
();
}
}
GroupType
::
value
EmitterState
::
CurGroupType
()
const
{
GroupType
::
value
EmitterState
::
CurGroupType
()
const
{
return
m_groups
.
empty
()
?
GroupType
::
No
n
e
:
m_groups
.
top
().
type
;
return
m_groups
.
empty
()
?
GroupType
::
No
Typ
e
:
m_groups
.
top
().
type
;
}
}
FlowType
::
value
EmitterState
::
CurGroupFlowType
()
const
{
FlowType
::
value
EmitterState
::
CurGroupFlowType
()
const
{
return
m_groups
.
empty
()
?
FlowType
::
No
n
e
:
m_groups
.
top
().
flowType
;
return
m_groups
.
empty
()
?
FlowType
::
No
Typ
e
:
m_groups
.
top
().
flowType
;
}
}
int
EmitterState
::
CurGroupIndent
()
const
{
int
EmitterState
::
CurGroupIndent
()
const
{
...
...
src/emitterstate.h
View file @
087e0673
...
@@ -22,10 +22,10 @@ struct FmtScope {
...
@@ -22,10 +22,10 @@ struct FmtScope {
enum
value
{
Local
,
Global
};
enum
value
{
Local
,
Global
};
};
};
struct
GroupType
{
struct
GroupType
{
enum
value
{
No
n
e
,
Seq
,
Map
};
enum
value
{
No
Typ
e
,
Seq
,
Map
};
};
};
struct
FlowType
{
struct
FlowType
{
enum
value
{
No
n
e
,
Flow
,
Block
};
enum
value
{
No
Typ
e
,
Flow
,
Block
};
};
};
class
EmitterState
{
class
EmitterState
{
...
@@ -170,7 +170,7 @@ class EmitterState {
...
@@ -170,7 +170,7 @@ class EmitterState {
// can't get here
// can't get here
assert
(
false
);
assert
(
false
);
return
EmitterNodeType
::
No
n
e
;
return
EmitterNodeType
::
No
Typ
e
;
}
}
};
};
...
...
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