Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
512d70b8
Commit
512d70b8
authored
Oct 23, 2009
by
Tiago Peixoto
Browse files
Fix empty property problem in graphml
Properties with empty values are now simply not printed in the output.
parent
c9621bc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/boost-workaround/boost/graph/graphml.hpp
View file @
512d70b8
...
...
@@ -376,12 +376,13 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index,
{
if
(
i
->
second
->
key
()
==
typeid
(
graph_property_tag
))
{
std
::
string
val
=
protect_xml_string
(
print_value
<
value_types
>
(
*
i
->
second
,
graph_property_tag
()));
if
(
val
.
empty
())
continue
;
out
<<
" <data key=
\"
"
<<
protect_xml_string
(
graph_key_ids
[
i
->
first
])
<<
"
\"
>"
<<
protect_xml_string
(
print_value
<
value_types
>
(
*
i
->
second
,
graph_property_tag
()))
<<
"</data>
\n
"
;
<<
val
<<
"</data>
\n
"
;
}
}
...
...
@@ -398,11 +399,13 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index,
{
if
(
i
->
second
->
key
()
==
typeid
(
vertex_descriptor
))
{
std
::
string
val
=
protect_xml_string
(
print_value
<
value_types
>
(
*
i
->
second
,
*
v
));
if
(
val
.
empty
())
continue
;
out
<<
" <data key=
\"
"
<<
protect_xml_string
(
vertex_key_ids
[
i
->
first
])
<<
"
\"
>"
<<
protect_xml_string
(
print_value
<
value_types
>
(
*
i
->
second
,
*
v
))
<<
"</data>
\n
"
;
<<
val
<<
"</data>
\n
"
;
}
}
out
<<
" </node>
\n
"
;
...
...
@@ -424,11 +427,13 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index,
{
if
(
i
->
second
->
key
()
==
typeid
(
edge_descriptor
))
{
std
::
string
val
=
protect_xml_string
(
print_value
<
value_types
>
(
*
i
->
second
,
*
e
));
if
(
val
.
empty
())
continue
;
out
<<
" <data key=
\"
"
<<
protect_xml_string
(
edge_key_ids
[
i
->
first
])
<<
"
\"
>"
<<
protect_xml_string
(
print_value
<
value_types
>
(
*
i
->
second
,
*
e
))
<<
"</data>
\n
"
;
<<
val
<<
"</data>
\n
"
;
}
}
out
<<
" </edge>
\n
"
;
...
...
src/graph/graph_io.cc
View file @
512d70b8
...
...
@@ -150,6 +150,9 @@ istream& operator>>(istream& in, vector<string>& vec)
data
+=
line
;
}
if
(
data
==
""
)
return
in
;
// empty string is OK
sregex
re
=
sregex
::
compile
(
", "
);
sregex_token_iterator
iter
(
data
.
begin
(),
data
.
end
(),
re
,
-
1
),
end
;
for
(;
iter
!=
end
;
++
iter
)
...
...
@@ -161,6 +164,7 @@ istream& operator>>(istream& in, vector<string>& vec)
}
return
in
;
}
}
// std namespace
...
...
Write
Preview
Supports
Markdown
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