Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
9a5f9e4c
Commit
9a5f9e4c
authored
Mar 28, 2021
by
Volker Krause
Browse files
Add a method to write extractor meta data for the new script extractors
Needed by KItinerary Workbench.
parent
4b4aa729
Pipeline
#55774
passed with stages
in 12 minutes and 57 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/engine/extractorrepository.cpp
View file @
9a5f9e4c
...
...
@@ -434,3 +434,29 @@ QJsonValue ExtractorRepository::extractorToJson(const Extractor &extractor) cons
}
return
a
;
}
QJsonValue
ExtractorRepository
::
extractorToJson
(
const
ScriptExtractor
*
extractor
)
const
{
QJsonArray
a
;
bool
added
=
false
;
for
(
const
auto
&
ext
:
d
->
m_extractorsNew
)
{
auto
e
=
dynamic_cast
<
ScriptExtractor
*>
(
ext
.
get
());
if
(
!
e
||
e
->
fileName
()
!=
extractor
->
fileName
())
{
continue
;
}
if
(
extractor
->
name
()
==
e
->
name
())
{
a
.
push_back
(
extractor
->
toJson
());
added
=
true
;
}
else
{
a
.
push_back
(
e
->
toJson
());
}
}
if
(
!
added
)
{
a
.
push_back
(
extractor
->
toJson
());
}
if
(
a
.
size
()
==
1
)
{
return
a
.
at
(
0
);
}
return
a
;
}
src/lib/engine/extractorrepository.h
View file @
9a5f9e4c
...
...
@@ -36,6 +36,7 @@ class AbstractExtractor;
class
Extractor
;
class
ExtractorDocumentNode
;
class
ExtractorRepositoryPrivate
;
class
ScriptExtractor
;
/**
* Collection of all known data extractors.
...
...
@@ -93,6 +94,7 @@ public:
* Only for tooling, do not use otherwise.
*/
QJsonValue
extractorToJson
(
const
Extractor
&
extractor
)
const
;
QJsonValue
extractorToJson
(
const
ScriptExtractor
*
extractor
)
const
;
///@endcond
private:
...
...
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