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
952fe51c
Commit
952fe51c
authored
May 22, 2012
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added writing float/double
parent
c95bcae4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
include/yaml-cpp/emitter.h
+13
-4
util/sandbox.cpp
+1
-1
No files found.
include/yaml-cpp/emitter.h
View file @
952fe51c
...
@@ -132,19 +132,28 @@ namespace YAML
...
@@ -132,19 +132,28 @@ namespace YAML
if
(
!
good
())
if
(
!
good
())
return
*
this
;
return
*
this
;
PrepareNode
(
EmitterNodeType
::
Scalar
);
std
::
stringstream
stream
;
SetStreamablePrecision
<
T
>
(
stream
);
stream
<<
value
;
m_stream
<<
stream
.
str
();
StartedScalar
();
return
*
this
;
return
*
this
;
}
}
template
<>
template
<>
inline
void
Emitter
::
SetStreamablePrecision
<
float
>
(
std
::
stringstream
&
str
)
inline
void
Emitter
::
SetStreamablePrecision
<
float
>
(
std
::
stringstream
&
str
eam
)
{
{
str
.
precision
(
GetFloatPrecision
());
str
eam
.
precision
(
GetFloatPrecision
());
}
}
template
<>
template
<>
inline
void
Emitter
::
SetStreamablePrecision
<
double
>
(
std
::
stringstream
&
str
)
inline
void
Emitter
::
SetStreamablePrecision
<
double
>
(
std
::
stringstream
&
str
eam
)
{
{
str
.
precision
(
GetDoublePrecision
());
str
eam
.
precision
(
GetDoublePrecision
());
}
}
// overloads of insertion
// overloads of insertion
...
...
util/sandbox.cpp
View file @
952fe51c
...
@@ -9,7 +9,7 @@ int main()
...
@@ -9,7 +9,7 @@ int main()
out
<<
YAML
::
Comment
(
"Hello"
);
out
<<
YAML
::
Comment
(
"Hello"
);
out
<<
YAML
::
Anchor
(
"a"
)
<<
YAML
::
Comment
(
"anchor"
)
<<
"item 1"
<<
YAML
::
Comment
(
"a"
);
out
<<
YAML
::
Anchor
(
"a"
)
<<
YAML
::
Comment
(
"anchor"
)
<<
"item 1"
<<
YAML
::
Comment
(
"a"
);
out
<<
YAML
::
BeginMap
<<
YAML
::
Comment
(
"b"
);
out
<<
YAML
::
BeginMap
<<
YAML
::
Comment
(
"b"
);
out
<<
"pens"
<<
YAML
::
Comment
(
"foo"
)
<<
"a"
<<
YAML
::
Comment
(
"bar"
);
out
<<
"pens"
<<
YAML
::
Comment
(
"foo"
)
<<
2.3
<<
YAML
::
Comment
(
"bar"
);
out
<<
"pencils"
<<
15
;
out
<<
"pencils"
<<
15
;
out
<<
YAML
::
EndMap
<<
YAML
::
Comment
(
"monkey"
);
out
<<
YAML
::
EndMap
<<
YAML
::
Comment
(
"monkey"
);
out
<<
"item 2"
;
out
<<
"item 2"
;
...
...
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