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
670a3e95
Commit
670a3e95
authored
Jul 15, 2009
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patched to read into std::wstring
parent
5b7f931c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
+18
-1
include/conversion.h
+3
-0
src/conversion.cpp
+15
-1
No files found.
include/conversion.h
View file @
670a3e95
...
...
@@ -32,4 +32,7 @@ namespace YAML
template
<>
bool
Converter
<
bool
>::
Convert
(
const
std
::
string
&
input
,
bool
&
output
);
template
<>
bool
Converter
<
std
::
wstring
>::
Convert
(
const
std
::
string
&
input
,
std
::
wstring
&
output
);
}
src/conversion.cpp
View file @
670a3e95
#include "conversion.h"
#include <algorithm>
#include <cstdlib>
////////////////////////////////////////////////////////////////
// Specializations for converting a string to specific types
...
...
@@ -82,5 +82,19 @@ namespace YAML
return
false
;
}
template
<>
bool
Converter
<
std
::
wstring
>::
Convert
(
const
std
::
string
&
input
,
std
::
wstring
&
output
)
{
output
.
clear
();
output
.
resize
(
std
::
mbstowcs
(
NULL
,
input
.
data
(),
input
.
size
()));
std
::
mbstowcs
(
(
wchar_t
*
)
output
.
data
(),
input
.
data
(),
input
.
size
()
);
return
true
;
}
}
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