Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-dashboard
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
cellframe-dashboard
Commits
a1869885
Commit
a1869885
authored
5 years ago
by
Evgenii Tagiltsev
Browse files
Options
Downloads
Patches
Plain Diff
[*] changed regexp for getWallets
parent
08144ab9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!27
Bugs 2588
Pipeline
#994
passed with stage
Stage: build
in 3 minutes and 28 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CellFrameDashboardService/DapChainWalletHandler.cpp
+29
-19
29 additions, 19 deletions
CellFrameDashboardService/DapChainWalletHandler.cpp
with
29 additions
and
19 deletions
CellFrameDashboardService/DapChainWalletHandler.cpp
+
29
−
19
View file @
a1869885
#include
"DapChainWalletHandler.h"
#include
<QDebug>
#include
<QRegularExpression>
DapChainWalletHandler
::
DapChainWalletHandler
(
QObject
*
parent
)
:
QObject
(
parent
)
{
...
...
@@ -42,27 +43,36 @@ QMap<QString, QVariant> DapChainWalletHandler::getWallets()
QProcess
process
;
process
.
start
(
QString
(
"%1 wallet list"
).
arg
(
CLI_PATH
));
process
.
waitForFinished
(
-
1
);
QString
str
=
QString
::
fromLatin1
(
process
.
readAll
());
QRegExp
rx
(
":{1,1}([
\\
s
\\
w
\\
W]+)(
\\
n|
\\
r){1,1}"
);
rx
.
setMinimal
(
true
);
int
pos
=
0
;
int
x
{
0
};
QString
tempName
;
while
((
pos
=
rx
.
indexIn
(
str
,
pos
))
!=
-
1
)
{
if
(
x
==
0
)
{
tempName
=
rx
.
cap
(
1
);
++
x
;
}
else
{
map
.
insert
(
tempName
,
rx
.
cap
(
1
));
x
=
0
;
}
pos
+=
rx
.
matchedLength
();
QByteArray
result
=
process
.
readAll
();
QRegularExpression
rx
(
"wallet:
\\
s(.+)
\\
s+addr:
\\
s(.+)"
,
QRegularExpression
::
MultilineOption
);
QRegularExpressionMatchIterator
itr
=
rx
.
globalMatch
(
result
);
while
(
itr
.
hasNext
())
{
QRegularExpressionMatch
match
=
itr
.
next
();
map
[
match
.
captured
(
1
)]
=
match
.
captured
(
2
);
}
// QString str = QString::fromLatin1(process.readAll());
// QRegExp rx(":{1,1}([\\s\\w\\W]+)(\\n|\\r){1,1}" );
// rx.setMinimal(true);
// int pos = 0;
// int x {0};
// QString tempName;
// while ((pos = rx.indexIn(str, pos)) != -1)
// {
// if(x == 0)
// {
// tempName = rx.cap(1);
// ++x;
// }
// else
// {
// map.insert(tempName, rx.cap(1));
// x = 0;
// }
// pos += rx.matchedLength();
// }
return
map
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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