Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
e646d433
Commit
e646d433
authored
13 years ago
by
ilor
Browse files
Options
Downloads
Patches
Plain Diff
Escaping \ with \\ and " with \" in StrSet to_string functions
parent
3acdb4a2
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libwccl/values/strset.cpp
+11
-3
11 additions, 3 deletions
libwccl/values/strset.cpp
with
11 additions
and
3 deletions
libwccl/values/strset.cpp
+
11
−
3
View file @
e646d433
...
...
@@ -2,7 +2,7 @@
#include
<libpwrutils/foreach.h>
#include
<libpwrutils/util.h>
#include
<sstream>
#include
<boost/algorithm/string.hpp>
namespace
Wccl
{
...
...
@@ -14,7 +14,12 @@ std::string StrSet::to_raw_string() const
ss
<<
"["
;
value_type
::
const_iterator
it
=
set_
.
begin
();
while
(
it
!=
set_
.
end
())
{
ss
<<
'\"'
<<
PwrNlp
::
to_utf8
(
*
it
)
<<
'\"'
;
//TODO escaping
ss
<<
'\"'
;
std
::
string
item
=
PwrNlp
::
to_utf8
(
*
it
);
boost
::
algorithm
::
replace_all
(
item
,
"
\\
"
,
"
\\\\
"
);
boost
::
algorithm
::
replace_all
(
item
,
"
\"
"
,
"
\\\"
"
);
ss
<<
item
;
ss
<<
'\"'
;
if
(
++
it
!=
set_
.
end
())
{
ss
<<
", "
;
}
...
...
@@ -30,7 +35,10 @@ UnicodeString StrSet::to_raw_string_u() const
value_type
::
const_iterator
it
=
set_
.
begin
();
while
(
it
!=
set_
.
end
())
{
u
.
append
(
UNICODE_STRING
(
"
\"
"
,
1
));
u
.
append
(
*
it
);
//TODO escaping
UnicodeString
item
=
*
it
;
item
.
findAndReplace
(
UNICODE_STRING
(
"
\\
"
,
1
),
UNICODE_STRING
(
"
\\\\
"
,
2
));
item
.
findAndReplace
(
UNICODE_STRING
(
"
\"
"
,
1
),
UNICODE_STRING
(
"
\\\"
"
,
2
));
u
.
append
(
item
);
u
.
append
(
UNICODE_STRING
(
"
\"
"
,
1
));
if
(
++
it
!=
set_
.
end
())
{
u
.
append
(
UNICODE_STRING
(
", "
,
2
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment