Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
UERANSIM
Commits
146f3916
Commit
146f3916
authored
Feb 14, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CLI improvements
parent
9ff9c6f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
44 deletions
+2
-44
src/utils/json.cpp
src/utils/json.cpp
+2
-44
No files found.
src/utils/json.cpp
View file @
146f3916
...
...
@@ -52,48 +52,6 @@ static std::string EscapeJson(const std::string &str)
return
output
;
}
// TODO
static
std
::
string
EscapeYaml
(
const
std
::
string
&
str
)
{
std
::
string
output
;
output
.
reserve
(
str
.
length
());
for
(
char
i
:
str
)
{
switch
(
i
)
{
case
'"'
:
output
+=
"
\\\"
"
;
break
;
case
'/'
:
output
+=
"
\\
/"
;
break
;
case
'\b'
:
output
+=
"
\\
b"
;
break
;
case
'\f'
:
output
+=
"
\\
f"
;
break
;
case
'\n'
:
output
+=
"
\\
n"
;
break
;
case
'\r'
:
output
+=
"
\\
r"
;
break
;
case
'\t'
:
output
+=
"
\\
t"
;
break
;
case
'\\'
:
output
+=
"
\\\\
"
;
break
;
default:
output
+=
i
;
break
;
}
}
return
output
;
}
static
void
AppendJson
(
const
Json
&
json
,
std
::
stringstream
&
stream
,
int
indentation
)
{
std
::
string
indent
(
indentation
,
' '
);
...
...
@@ -157,7 +115,7 @@ static void AppendYaml(const Json &json, std::stringstream &stream, int indentat
case
Json
:
:
Type
::
STRING
:
case
Json
:
:
Type
::
NUMBER
:
case
Json
:
:
Type
::
BOOL
:
stream
<<
json
.
str
();
stream
<<
json
.
str
();
// TODO: Escape YAML
break
;
case
Json
:
:
Type
::
OBJECT
:
{
int
index
=
0
;
...
...
@@ -173,7 +131,7 @@ static void AppendYaml(const Json &json, std::stringstream &stream, int indentat
else
{
stream
<<
"
\n
"
;
initialPos
=
stream
.
tellp
();
initialPos
=
stream
.
tellp
();
AppendYaml
(
item
.
second
,
stream
,
indentation
+
1
,
true
);
}
if
(
index
!=
json
.
itemCount
()
-
1
&&
initialPos
!=
stream
.
tellp
())
...
...
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