Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alexander Lapshin
common
Commits
df3cb2db
Commit
df3cb2db
authored
Jun 15, 2021
by
Alexander Lapshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
42c2294b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
31 deletions
+7
-31
json_functions.h
json/json_functions.h
+1
-29
exec.cpp
utils/exec.cpp
+2
-2
svalue.h
utils/svalue.h
+4
-0
No files found.
json/json_functions.h
View file @
df3cb2db
...
@@ -554,23 +554,6 @@ template <typename T> void PutValue(jsonalloc& alc, jsonval& ss, const std::stri
...
@@ -554,23 +554,6 @@ template <typename T> void PutValue(jsonalloc& alc, jsonval& ss, const std::stri
ss
.
AddMember
(
jname
,
obj
,
alc
);
ss
.
AddMember
(
jname
,
obj
,
alc
);
}
}
template
<
typename
T
>
void
PutValue
(
jsonalloc
&
alc
,
jsonval
&
ss
,
const
std
::
vector
<
T
>&
vec
)
{
for
(
const
auto
&
el
:
vec
)
{
PutValue
(
alc
,
ss
,
el
);
}
}
template
<
typename
T
>
void
PutValue
(
jsonalloc
&
alc
,
jsonval
&
ss
,
const
std
::
vector
<
T
>&
vec
,
bool
(
*
f
)(
rapidjson
::
Document
::
AllocatorType
&
,
jsonval
&
,
const
T
&
))
{
for
(
auto
it
=
vec
.
begin
();
it
!=
vec
.
end
();
++
it
)
{
jsonval
child
(
rapidjson
::
kObjectType
);
if
(
f
(
alc
,
child
,
*
it
))
{
ss
.
PushBack
(
child
,
alc
);
}
}
}
template
<
typename
T
>
void
PutValue
(
jsonalloc
&
alc
,
jsonval
&
ss
,
const
std
::
string
&
conName
,
const
std
::
vector
<
T
>&
vec
,
bool
(
*
f
)(
rapidjson
::
Document
::
AllocatorType
&
,
jsonval
&
,
const
T
&
))
template
<
typename
T
>
void
PutValue
(
jsonalloc
&
alc
,
jsonval
&
ss
,
const
std
::
string
&
conName
,
const
std
::
vector
<
T
>&
vec
,
bool
(
*
f
)(
rapidjson
::
Document
::
AllocatorType
&
,
jsonval
&
,
const
T
&
))
{
{
jsonval
jsvec
(
rapidjson
::
kArrayType
);
jsonval
jsvec
(
rapidjson
::
kArrayType
);
...
@@ -734,17 +717,6 @@ static void PutValue(jsonalloc& alc, jsonval& ss, const std::string& conName, co
...
@@ -734,17 +717,6 @@ static void PutValue(jsonalloc& alc, jsonval& ss, const std::string& conName, co
ss
.
AddMember
(
jname
,
jvalue
,
alc
);
ss
.
AddMember
(
jname
,
jvalue
,
alc
);
}
}
static
void
PutValue
(
jsonalloc
&
alc
,
jsonval
&
ss
,
const
double
value
)
{
ss
.
PushBack
(
value
,
alc
);
}
static
void
PutValue
(
jsonalloc
&
alc
,
jsonval
&
ss
,
const
std
::
string
&
value
)
{
jsonval
jvalue
(
value
,
alc
);
ss
.
PushBack
(
jvalue
,
alc
);
}
static
void
flushjson
(
const
jsondoc
&
outroot
,
const
std
::
string
&
outputfile
,
const
bool
pretty
=
true
)
static
void
flushjson
(
const
jsondoc
&
outroot
,
const
std
::
string
&
outputfile
,
const
bool
pretty
=
true
)
{
{
if
(
!
outputfile
.
length
())
{
if
(
!
outputfile
.
length
())
{
...
@@ -1012,7 +984,7 @@ static bool loadjson(const std::map<std::string, std::string>& parent, const std
...
@@ -1012,7 +984,7 @@ static bool loadjson(const std::map<std::string, std::string>& parent, const std
}
}
value
=
itr
->
second
;
value
=
itr
->
second
;
return
true
;
return
true
;
}
}
...
...
utils/exec.cpp
View file @
df3cb2db
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
std
::
string
exec
(
const
char
*
cmd
)
std
::
string
exec
(
const
char
*
cmd
)
{
{
#ifndef
WIN32
#ifndef
MSVC
FILE
*
pipe
=
popen
(
cmd
,
"r"
);
FILE
*
pipe
=
popen
(
cmd
,
"r"
);
#else
#else
FILE
*
pipe
=
_popen
(
cmd
,
"r"
);
FILE
*
pipe
=
_popen
(
cmd
,
"r"
);
...
@@ -17,7 +17,7 @@ std::string exec(const char* cmd)
...
@@ -17,7 +17,7 @@ std::string exec(const char* cmd)
result
+=
buffer
;
result
+=
buffer
;
}
}
#ifndef
WIN32
#ifndef
MSVC
pclose
(
pipe
);
pclose
(
pipe
);
#else
#else
_pclose
(
pipe
);
_pclose
(
pipe
);
...
...
utils/svalue.h
View file @
df3cb2db
#pragma once
#pragma once
#ifndef MSVC
#pragma GCC diagnostic ignored "-Wnon-template-friend"
#endif
template
<
typename
T
>
class
svalue
template
<
typename
T
>
class
svalue
{
{
public
:
public
:
...
...
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