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
7f2c3591
Commit
7f2c3591
authored
Sep 03, 2008
by
jbeder
Browse files
Unified line endings.
parent
a57a5748
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
60 deletions
+60
-60
include/crt.h
include/crt.h
+2
-2
include/exceptions.h
include/exceptions.h
+1
-1
include/yaml.h
include/yaml.h
+2
-2
src/map.cpp
src/map.cpp
+1
-1
src/node.cpp
src/node.cpp
+7
-7
src/parser.cpp
src/parser.cpp
+1
-1
src/regex.cpp
src/regex.cpp
+8
-8
src/sequence.cpp
src/sequence.cpp
+1
-1
src/stream.cpp
src/stream.cpp
+17
-17
yaml-reader/main.cpp
yaml-reader/main.cpp
+9
-9
yaml-reader/tests.cpp
yaml-reader/tests.cpp
+10
-10
yaml-reader/tests/test.yaml
yaml-reader/tests/test.yaml
+1
-1
No files found.
include/crt.h
View file @
7f2c3591
...
@@ -7,5 +7,5 @@
...
@@ -7,5 +7,5 @@
#include <stdlib.h>
#include <stdlib.h>
#include <crtdbg.h>
#include <crtdbg.h>
#endif // _DEBUG
#endif // _DEBUG
include/exceptions.h
View file @
7f2c3591
...
@@ -10,7 +10,7 @@ namespace YAML
...
@@ -10,7 +10,7 @@ namespace YAML
public:
public:
ParserException
(
int
line_
,
int
column_
,
const
std
::
string
&
msg_
)
ParserException
(
int
line_
,
int
column_
,
const
std
::
string
&
msg_
)
:
line
(
line_
),
column
(
column_
),
msg
(
msg_
)
{}
:
line
(
line_
),
column
(
column_
),
msg
(
msg_
)
{}
virtual
~
ParserException
()
throw
()
{}
virtual
~
ParserException
()
throw
()
{}
int
line
,
column
;
int
line
,
column
;
std
::
string
msg
;
std
::
string
msg
;
...
...
include/yaml.h
View file @
7f2c3591
...
@@ -4,5 +4,5 @@
...
@@ -4,5 +4,5 @@
#include "parser.h"
#include "parser.h"
#include "node.h"
#include "node.h"
#include "iterator.h"
#include "iterator.h"
#include "exceptions.h"
#include "exceptions.h"
src/map.cpp
View file @
7f2c3591
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include "node.h"
#include "node.h"
#include "scanner.h"
#include "scanner.h"
#include "token.h"
#include "token.h"
#include "exceptions.h"
#include "exceptions.h"
#include <iostream>
#include <iostream>
namespace
YAML
namespace
YAML
...
...
src/node.cpp
View file @
7f2c3591
...
@@ -148,13 +148,13 @@ namespace YAML
...
@@ -148,13 +148,13 @@ namespace YAML
{
{
if
(
!
m_pContent
)
if
(
!
m_pContent
)
return
CT_NONE
;
return
CT_NONE
;
if
(
m_pContent
->
IsScalar
())
if
(
m_pContent
->
IsScalar
())
return
CT_SCALAR
;
return
CT_SCALAR
;
else
if
(
m_pContent
->
IsSequence
())
else
if
(
m_pContent
->
IsSequence
())
return
CT_SEQUENCE
;
return
CT_SEQUENCE
;
else
if
(
m_pContent
->
IsMap
())
else
if
(
m_pContent
->
IsMap
())
return
CT_MAP
;
return
CT_MAP
;
return
CT_NONE
;
return
CT_NONE
;
}
}
...
...
src/parser.cpp
View file @
7f2c3591
...
@@ -121,7 +121,7 @@ namespace YAML
...
@@ -121,7 +121,7 @@ namespace YAML
}
}
void
Parser
::
PrintTokens
(
std
::
ostream
&
out
)
void
Parser
::
PrintTokens
(
std
::
ostream
&
out
)
{
{
while
(
1
)
{
while
(
1
)
{
if
(
m_pScanner
->
empty
())
if
(
m_pScanner
->
empty
())
break
;
break
;
...
...
src/regex.cpp
View file @
7f2c3591
#include "crt.h"
#include "crt.h"
#include "regex.h"
#include "regex.h"
#include "stream.h"
#include "stream.h"
#include <iostream>
#include <iostream>
namespace
YAML
namespace
YAML
...
@@ -92,8 +92,8 @@ namespace YAML
...
@@ -92,8 +92,8 @@ namespace YAML
bool
RegEx
::
Matches
(
std
::
istream
&
in
)
const
bool
RegEx
::
Matches
(
std
::
istream
&
in
)
const
{
{
return
Match
(
in
)
>=
0
;
return
Match
(
in
)
>=
0
;
}
}
bool
RegEx
::
Matches
(
Stream
&
in
)
const
bool
RegEx
::
Matches
(
Stream
&
in
)
const
{
{
return
Match
(
in
)
>=
0
;
return
Match
(
in
)
>=
0
;
...
@@ -113,12 +113,12 @@ namespace YAML
...
@@ -113,12 +113,12 @@ namespace YAML
return
m_pOp
->
Match
(
str
,
*
this
);
return
m_pOp
->
Match
(
str
,
*
this
);
}
}
// Match
// Match
int
RegEx
::
Match
(
Stream
&
in
)
const
int
RegEx
::
Match
(
Stream
&
in
)
const
{
{
return
Match
(
in
.
stream
());
return
Match
(
in
.
stream
());
}
}
// Match
// Match
// . The stream version does the same thing as the string version;
// . The stream version does the same thing as the string version;
// REMEMBER that we only match from the start of the stream!
// REMEMBER that we only match from the start of the stream!
...
...
src/sequence.cpp
View file @
7f2c3591
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#include "sequence.h"
#include "sequence.h"
#include "node.h"
#include "node.h"
#include "scanner.h"
#include "scanner.h"
#include "token.h"
#include "token.h"
#include <iostream>
#include <iostream>
namespace
YAML
namespace
YAML
...
...
src/stream.cpp
View file @
7f2c3591
#include "crt.h"
#include "crt.h"
#include "stream.h"
#include "stream.h"
#include <iostream>
#include <iostream>
namespace
YAML
namespace
YAML
{
{
int
Stream
::
pos
()
const
int
Stream
::
pos
()
const
{
{
return
input
.
tellg
();
return
input
.
tellg
();
}
}
char
Stream
::
peek
()
char
Stream
::
peek
()
{
{
return
input
.
peek
();
return
input
.
peek
();
}
}
Stream
::
operator
bool
()
Stream
::
operator
bool
()
{
{
return
input
.
good
();
return
input
.
good
();
}
}
// get
// get
// . Extracts a character from the stream and updates our position
// . Extracts a character from the stream and updates our position
char
Stream
::
get
()
char
Stream
::
get
()
...
@@ -48,6 +48,6 @@ namespace YAML
...
@@ -48,6 +48,6 @@ namespace YAML
{
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
for
(
int
i
=
0
;
i
<
n
;
i
++
)
get
();
get
();
}
}
}
}
yaml-reader/main.cpp
View file @
7f2c3591
...
@@ -14,7 +14,7 @@ void run()
...
@@ -14,7 +14,7 @@ void run()
std
::
ifstream
fin
(
"tests/test.yaml"
);
std
::
ifstream
fin
(
"tests/test.yaml"
);
try
{
try
{
YAML
::
Parser
parser
(
fin
);
YAML
::
Parser
parser
(
fin
);
parser
.
PrintTokens
(
std
::
cout
);
parser
.
PrintTokens
(
std
::
cout
);
}
catch
(
YAML
::
Exception
&
)
{
}
catch
(
YAML
::
Exception
&
)
{
std
::
cout
<<
"Error parsing the yaml!
\n
"
;
std
::
cout
<<
"Error parsing the yaml!
\n
"
;
...
@@ -22,15 +22,15 @@ void run()
...
@@ -22,15 +22,15 @@ void run()
}
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
bool
verbose
=
false
;
bool
verbose
=
false
;
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"-v"
)
==
0
)
if
(
strcmp
(
argv
[
i
],
"-v"
)
==
0
)
verbose
=
true
;
verbose
=
true
;
}
}
#ifdef WINDOWS
#ifdef WINDOWS
_CrtSetDbgFlag
(
_CRTDBG_LEAK_CHECK_DF
|
_CRTDBG_ALLOC_MEM_DF
);
_CrtSetDbgFlag
(
_CRTDBG_LEAK_CHECK_DF
|
_CRTDBG_ALLOC_MEM_DF
);
#endif // WINDOWS
#endif // WINDOWS
Test
::
RunAll
(
verbose
);
Test
::
RunAll
(
verbose
);
run
();
run
();
...
...
yaml-reader/tests.cpp
View file @
7f2c3591
...
@@ -22,7 +22,7 @@ namespace Test
...
@@ -22,7 +22,7 @@ namespace Test
if
(
!
Inout
(
files
[
i
],
verbose
))
{
if
(
!
Inout
(
files
[
i
],
verbose
))
{
std
::
cout
<<
"Inout test failed on "
<<
files
[
i
]
<<
"
\n
"
;
std
::
cout
<<
"Inout test failed on "
<<
files
[
i
]
<<
"
\n
"
;
passed
=
false
;
passed
=
false
;
}
else
}
else
std
::
cout
<<
"Inout test passed: "
<<
files
[
i
]
<<
"
\n
"
;
std
::
cout
<<
"Inout test passed: "
<<
files
[
i
]
<<
"
\n
"
;
}
}
...
@@ -34,7 +34,7 @@ namespace Test
...
@@ -34,7 +34,7 @@ namespace Test
// outputs again, and makes sure that the two outputs are the same
// outputs again, and makes sure that the two outputs are the same
bool
Inout
(
const
std
::
string
&
file
,
bool
verbose
)
bool
Inout
(
const
std
::
string
&
file
,
bool
verbose
)
{
{
std
::
ifstream
fin
(
file
.
c_str
());
std
::
ifstream
fin
(
file
.
c_str
());
try
{
try
{
// read and output
// read and output
...
@@ -71,14 +71,14 @@ namespace Test
...
@@ -71,14 +71,14 @@ namespace Test
fout
<<
"---
\n
"
;
fout
<<
"---
\n
"
;
fout
<<
secondTry
<<
std
::
endl
;
fout
<<
secondTry
<<
std
::
endl
;
}
catch
(
YAML
::
ParserException
&
e
)
{
}
catch
(
YAML
::
ParserException
&
e
)
{
std
::
cout
<<
file
<<
" (line "
<<
e
.
line
+
1
<<
", col "
<<
e
.
column
+
1
<<
"): "
<<
e
.
msg
<<
std
::
endl
;
std
::
cout
<<
file
<<
" (line "
<<
e
.
line
+
1
<<
", col "
<<
e
.
column
+
1
<<
"): "
<<
e
.
msg
<<
std
::
endl
;
if
(
verbose
)
{
if
(
verbose
)
{
std
::
cout
<<
"Token queue:
\n
"
;
std
::
cout
<<
"Token queue:
\n
"
;
std
::
ifstream
f
(
file
.
c_str
());
std
::
ifstream
f
(
file
.
c_str
());
YAML
::
Parser
p
(
f
);
YAML
::
Parser
p
(
f
);
p
.
PrintTokens
(
std
::
cout
);
p
.
PrintTokens
(
std
::
cout
);
}
}
return
false
;
return
false
;
}
}
...
...
yaml-reader/tests/test.yaml
View file @
7f2c3591
-
it's just
-
it's just
-
one thing
-
one thing
-
after another
-
after another
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