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
2601f5fd
Commit
2601f5fd
authored
Jul 31, 2008
by
beder
Browse files
No commit message
No commit message
parent
89ed418b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
0 deletions
+37
-0
include/node.h
include/node.h
+4
-0
src/content.h
src/content.h
+3
-0
src/map.cpp
src/map.cpp
+5
-0
src/map.h
src/map.h
+2
-0
src/node.cpp
src/node.cpp
+8
-0
src/scalar.cpp
src/scalar.cpp
+6
-0
src/scalar.h
src/scalar.h
+2
-0
src/sequence.cpp
src/sequence.cpp
+5
-0
src/sequence.h
src/sequence.h
+2
-0
No files found.
include/node.h
View file @
2601f5fd
...
@@ -13,6 +13,8 @@ namespace YAML
...
@@ -13,6 +13,8 @@ namespace YAML
class
Content
;
class
Content
;
class
Scanner
;
class
Scanner
;
enum
CONTENT_TYPE
{
CT_NONE
,
CT_SCALAR
,
CT_SEQUENCE
,
CT_MAP
};
class
Node
class
Node
{
{
public:
public:
...
@@ -23,6 +25,8 @@ namespace YAML
...
@@ -23,6 +25,8 @@ namespace YAML
void
Parse
(
Scanner
*
pScanner
,
const
ParserState
&
state
);
void
Parse
(
Scanner
*
pScanner
,
const
ParserState
&
state
);
void
Write
(
std
::
ostream
&
out
,
int
indent
,
bool
startedLine
,
bool
onlyOneCharOnLine
)
const
;
void
Write
(
std
::
ostream
&
out
,
int
indent
,
bool
startedLine
,
bool
onlyOneCharOnLine
)
const
;
CONTENT_TYPE
GetType
()
const
;
// accessors
// accessors
Iterator
begin
()
const
;
Iterator
begin
()
const
;
Iterator
end
()
const
;
Iterator
end
()
const
;
...
...
src/content.h
View file @
2601f5fd
...
@@ -16,6 +16,8 @@ namespace YAML
...
@@ -16,6 +16,8 @@ namespace YAML
class
Sequence
;
class
Sequence
;
class
Map
;
class
Map
;
enum
CONTENT_TYPE
;
class
Content
class
Content
{
{
public:
public:
...
@@ -31,6 +33,7 @@ namespace YAML
...
@@ -31,6 +33,7 @@ namespace YAML
virtual
bool
GetEnd
(
std
::
map
<
Node
*
,
Node
*
,
ltnode
>::
const_iterator
&
it
)
const
{
return
false
;
}
virtual
bool
GetEnd
(
std
::
map
<
Node
*
,
Node
*
,
ltnode
>::
const_iterator
&
it
)
const
{
return
false
;
}
virtual
Node
*
GetNode
(
unsigned
i
)
const
{
return
0
;
}
virtual
Node
*
GetNode
(
unsigned
i
)
const
{
return
0
;
}
virtual
unsigned
GetSize
()
const
{
return
0
;
}
virtual
unsigned
GetSize
()
const
{
return
0
;
}
virtual
CONTENT_TYPE
GetType
()
const
=
0
;
// extraction
// extraction
virtual
void
Read
(
std
::
string
&
s
)
{
throw
InvalidScalar
();
}
virtual
void
Read
(
std
::
string
&
s
)
{
throw
InvalidScalar
();
}
...
...
src/map.cpp
View file @
2601f5fd
...
@@ -163,6 +163,11 @@ namespace YAML
...
@@ -163,6 +163,11 @@ namespace YAML
out
<<
std
::
endl
;
out
<<
std
::
endl
;
}
}
CONTENT_TYPE
Map
::
GetType
()
const
{
return
CT_MAP
;
}
int
Map
::
Compare
(
Content
*
pContent
)
int
Map
::
Compare
(
Content
*
pContent
)
{
{
return
-
pContent
->
Compare
(
this
);
return
-
pContent
->
Compare
(
this
);
...
...
src/map.h
View file @
2601f5fd
...
@@ -19,6 +19,8 @@ namespace YAML
...
@@ -19,6 +19,8 @@ namespace YAML
virtual
void
Parse
(
Scanner
*
pScanner
,
const
ParserState
&
state
);
virtual
void
Parse
(
Scanner
*
pScanner
,
const
ParserState
&
state
);
virtual
void
Write
(
std
::
ostream
&
out
,
int
indent
,
bool
startedLine
,
bool
onlyOneCharOnLine
);
virtual
void
Write
(
std
::
ostream
&
out
,
int
indent
,
bool
startedLine
,
bool
onlyOneCharOnLine
);
virtual
CONTENT_TYPE
GetType
()
const
;
// ordering
// ordering
virtual
int
Compare
(
Content
*
pContent
);
virtual
int
Compare
(
Content
*
pContent
);
virtual
int
Compare
(
Scalar
*
pScalar
)
{
return
1
;
}
virtual
int
Compare
(
Scalar
*
pScalar
)
{
return
1
;
}
...
...
src/node.cpp
View file @
2601f5fd
...
@@ -144,6 +144,14 @@ namespace YAML
...
@@ -144,6 +144,14 @@ namespace YAML
}
}
}
}
CONTENT_TYPE
Node
::
GetType
()
const
{
if
(
!
m_pContent
)
return
CT_NONE
;
return
m_pContent
->
GetType
();
}
// begin
// begin
// Returns an iterator to the beginning of this (sequence or map).
// Returns an iterator to the beginning of this (sequence or map).
Iterator
Node
::
begin
()
const
Iterator
Node
::
begin
()
const
...
...
src/scalar.cpp
View file @
2601f5fd
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "scanner.h"
#include "scanner.h"
#include "token.h"
#include "token.h"
#include "exceptions.h"
#include "exceptions.h"
#include "node.h"
#include <sstream>
#include <sstream>
namespace
YAML
namespace
YAML
...
@@ -37,6 +38,11 @@ namespace YAML
...
@@ -37,6 +38,11 @@ namespace YAML
out
<<
"
\"\n
"
;
out
<<
"
\"\n
"
;
}
}
CONTENT_TYPE
Scalar
::
GetType
()
const
{
return
CT_SCALAR
;
}
void
Scalar
::
Read
(
std
::
string
&
s
)
void
Scalar
::
Read
(
std
::
string
&
s
)
{
{
s
=
m_data
;
s
=
m_data
;
...
...
src/scalar.h
View file @
2601f5fd
...
@@ -14,6 +14,8 @@ namespace YAML
...
@@ -14,6 +14,8 @@ namespace YAML
virtual
void
Parse
(
Scanner
*
pScanner
,
const
ParserState
&
state
);
virtual
void
Parse
(
Scanner
*
pScanner
,
const
ParserState
&
state
);
virtual
void
Write
(
std
::
ostream
&
out
,
int
indent
,
bool
startedLine
,
bool
onlyOneCharOnLine
);
virtual
void
Write
(
std
::
ostream
&
out
,
int
indent
,
bool
startedLine
,
bool
onlyOneCharOnLine
);
virtual
CONTENT_TYPE
GetType
()
const
;
// extraction
// extraction
virtual
void
Read
(
std
::
string
&
s
);
virtual
void
Read
(
std
::
string
&
s
);
virtual
void
Read
(
int
&
i
);
virtual
void
Read
(
int
&
i
);
...
...
src/sequence.cpp
View file @
2601f5fd
...
@@ -150,6 +150,11 @@ namespace YAML
...
@@ -150,6 +150,11 @@ namespace YAML
out
<<
std
::
endl
;
out
<<
std
::
endl
;
}
}
CONTENT_TYPE
Sequence
::
GetType
()
const
{
return
CT_SEQUENCE
;
}
int
Sequence
::
Compare
(
Content
*
pContent
)
int
Sequence
::
Compare
(
Content
*
pContent
)
{
{
return
-
pContent
->
Compare
(
this
);
return
-
pContent
->
Compare
(
this
);
...
...
src/sequence.h
View file @
2601f5fd
...
@@ -22,6 +22,8 @@ namespace YAML
...
@@ -22,6 +22,8 @@ namespace YAML
virtual
void
Parse
(
Scanner
*
pScanner
,
const
ParserState
&
state
);
virtual
void
Parse
(
Scanner
*
pScanner
,
const
ParserState
&
state
);
virtual
void
Write
(
std
::
ostream
&
out
,
int
indent
,
bool
startedLine
,
bool
onlyOneCharOnLine
);
virtual
void
Write
(
std
::
ostream
&
out
,
int
indent
,
bool
startedLine
,
bool
onlyOneCharOnLine
);
virtual
CONTENT_TYPE
GetType
()
const
;
// ordering
// ordering
virtual
int
Compare
(
Content
*
pContent
);
virtual
int
Compare
(
Content
*
pContent
);
virtual
int
Compare
(
Scalar
*
pScalar
)
{
return
1
;
}
virtual
int
Compare
(
Scalar
*
pScalar
)
{
return
1
;
}
...
...
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