Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
ccdcb436
Commit
ccdcb436
authored
Nov 08, 2016
by
Martin Flöser
Browse files
[tools/generate] Generate implementation of client side requests
Like in the factored method case, just for generic requests.
parent
8cbf16b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/wayland/tools/generator.cpp
View file @
ccdcb436
...
...
@@ -1262,7 +1262,12 @@ void Generator::generateClientClassRequests(const Interface &interface)
void
Generator
::
generateClientCppRequests
(
const
Interface
&
interface
)
{
const
auto
requests
=
interface
.
requests
();
const
QString
templateString
=
QStringLiteral
(
"void %1::%2(%3)
\n
{
\n
}
\n\n
"
);
const
QString
templateString
=
QStringLiteral
(
"void %1::%2(%3)
\n
"
"{
\n
"
" Q_ASSERT(isValid());
\n
"
" %4_%5(d->%6%7);
\n
"
"}
\n\n
"
);
const
QString
factoryTemplateString
=
QStringLiteral
(
"%2 *%1::%3(%4)
\n
"
"{
\n
"
...
...
@@ -1281,7 +1286,7 @@ void Generator::generateClientCppRequests(const Interface &interface)
continue
;
}
QString
arguments
;
QString
factored
Arguments
;
QString
request
Arguments
;
bool
first
=
true
;
QString
factored
;
for
(
const
auto
&
a
:
r
.
arguments
())
{
...
...
@@ -1296,18 +1301,20 @@ void Generator::generateClientCppRequests(const Interface &interface)
}
if
(
a
.
type
()
==
Argument
::
Type
::
Object
)
{
arguments
.
append
(
QStringLiteral
(
"%1 *%2"
).
arg
(
a
.
typeAsQt
()).
arg
(
toCamelCase
(
a
.
name
())));
if
(
!
factored
.
isEmpty
())
{
factoredArguments
.
append
(
QStringLiteral
(
", *%1"
).
arg
(
toCamelCase
(
a
.
name
())));
}
requestArguments
.
append
(
QStringLiteral
(
", *%1"
).
arg
(
toCamelCase
(
a
.
name
())));
}
else
{
arguments
.
append
(
QStringLiteral
(
"%1 %2"
).
arg
(
a
.
typeAsQt
()).
arg
(
toCamelCase
(
a
.
name
())));
if
(
!
factored
.
isEmpty
())
{
factoredArguments
.
append
(
QStringLiteral
(
", %1"
).
arg
(
toCamelCase
(
a
.
name
())));
}
requestArguments
.
append
(
QStringLiteral
(
", %1"
).
arg
(
toCamelCase
(
a
.
name
())));
}
}
if
(
factored
.
isEmpty
())
{
*
m_stream
.
localData
()
<<
templateString
.
arg
(
interface
.
kwaylandClientName
()).
arg
(
toCamelCase
(
r
.
name
())).
arg
(
arguments
);
*
m_stream
.
localData
()
<<
templateString
.
arg
(
interface
.
kwaylandClientName
())
.
arg
(
toCamelCase
(
r
.
name
()))
.
arg
(
arguments
)
.
arg
(
interface
.
name
())
.
arg
(
r
.
name
())
.
arg
(
interface
.
kwaylandClientName
().
toLower
())
.
arg
(
requestArguments
);
}
else
{
if
(
!
first
)
{
arguments
.
append
(
QStringLiteral
(
", "
));
...
...
@@ -1320,7 +1327,7 @@ void Generator::generateClientCppRequests(const Interface &interface)
.
arg
(
interface
.
name
())
.
arg
(
r
.
name
())
.
arg
(
interface
.
kwaylandClientName
().
toLower
())
.
arg
(
factored
Arguments
);
.
arg
(
request
Arguments
);
}
}
}
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment