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
5dbcf7ee
Commit
5dbcf7ee
authored
Apr 01, 2013
by
Jesse Beder
Browse files
Fix conversion for C-strings (both literals and normal C-strings) so it compiles on Visual Studio.
parent
f5418306
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
include/yaml-cpp/node/convert.h
include/yaml-cpp/node/convert.h
+15
-0
include/yaml-cpp/node/detail/impl.h
include/yaml-cpp/node/detail/impl.h
+6
-1
include/yaml-cpp/node/detail/node_data.h
include/yaml-cpp/node/detail/node_data.h
+1
-0
No files found.
include/yaml-cpp/node/convert.h
View file @
5dbcf7ee
...
@@ -47,6 +47,21 @@ namespace YAML
...
@@ -47,6 +47,21 @@ namespace YAML
}
}
};
};
// C-strings can only be encoded
template
<
>
struct
convert
<
const
char
*>
{
static
Node
encode
(
const
char
*&
rhs
)
{
return
Node
(
rhs
);
}
};
template
<
std
::
size_t
N
>
struct
convert
<
const
char
[
N
]
>
{
static
Node
encode
(
const
char
(
&
rhs
)[
N
])
{
return
Node
(
rhs
);
}
};
template
<
>
template
<
>
struct
convert
<
_Null
>
{
struct
convert
<
_Null
>
{
static
Node
encode
(
const
_Null
&
/* rhs */
)
{
static
Node
encode
(
const
_Null
&
/* rhs */
)
{
...
...
include/yaml-cpp/node/detail/impl.h
View file @
5dbcf7ee
...
@@ -149,6 +149,11 @@ namespace YAML
...
@@ -149,6 +149,11 @@ namespace YAML
return
false
;
return
false
;
}
}
inline
bool
node_data
::
equals
(
node
&
node
,
const
char
*
rhs
,
shared_memory_holder
pMemory
)
{
return
equals
<
std
::
string
>
(
node
,
rhs
,
pMemory
);
}
template
<
typename
T
>
template
<
typename
T
>
inline
node
&
node_data
::
convert_to_node
(
const
T
&
rhs
,
shared_memory_holder
pMemory
)
inline
node
&
node_data
::
convert_to_node
(
const
T
&
rhs
,
shared_memory_holder
pMemory
)
{
{
...
...
include/yaml-cpp/node/detail/node_data.h
View file @
5dbcf7ee
...
@@ -77,6 +77,7 @@ namespace YAML
...
@@ -77,6 +77,7 @@ namespace YAML
template
<
typename
T
>
template
<
typename
T
>
static
bool
equals
(
node
&
node
,
const
T
&
rhs
,
shared_memory_holder
pMemory
);
static
bool
equals
(
node
&
node
,
const
T
&
rhs
,
shared_memory_holder
pMemory
);
static
bool
equals
(
node
&
node
,
const
char
*
rhs
,
shared_memory_holder
pMemory
);
template
<
typename
T
>
template
<
typename
T
>
static
node
&
convert_to_node
(
const
T
&
rhs
,
shared_memory_holder
pMemory
);
static
node
&
convert_to_node
(
const
T
&
rhs
,
shared_memory_holder
pMemory
);
...
...
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