Skip to content

Commit 6fc64e2

Browse files
authored
add docstring to cpp-qt methods (#22770)
1 parent a1c948d commit 6fc64e2

11 files changed

Lines changed: 286 additions & 220 deletions

File tree

modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,22 @@ void {{classname}}::initializeServerConfigs() {
5757
}
5858

5959
/**
60-
* returns 0 on success and -1, -2 or -3 on failure.
61-
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
62-
*/
60+
* returns 0 on success and -1, -2 or -3 on failure.
61+
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
62+
*/
6363
int {{classname}}::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) {
6464
auto it = _serverConfigs.find(operation);
6565
if (it != _serverConfigs.end() && serverIndex < it.value().size()) {
6666
return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value);
6767
}
6868
return -3;
6969
}
70+
71+
/**
72+
* Sets the server index.
73+
* @param operation The id to the target operation.
74+
* @param serverIndex The server index.
75+
*/
7076
void {{classname}}::setServerIndex(const QString &operation, int serverIndex) {
7177
if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) {
7278
_serverIndices[operation] = serverIndex;
@@ -109,13 +115,13 @@ void {{classname}}::setNetworkAccessManager(QNetworkAccessManager* manager) {
109115
}
110116

111117
/**
112-
* Appends a new ServerConfiguration to the config map for a specific operation.
113-
* @param operation The id to the target operation.
114-
* @param url A string that contains the URL of the server
115-
* @param description A String that describes the server
116-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
117-
* returns the index of the new server config on success and -1 if the operation is not found
118-
*/
118+
* Appends a new ServerConfiguration to the config map for a specific operation.
119+
* @param operation The id to the target operation.
120+
* @param url A string that contains the URL of the server
121+
* @param description A String that describes the server
122+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
123+
* returns the index of the new server config on success and -1 if the operation is not found
124+
*/
119125
int {{classname}}::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, {{prefix}}ServerVariable> &variables) {
120126
if (_serverConfigs.contains(operation)) {
121127
_serverConfigs[operation].append({{prefix}}ServerConfiguration(
@@ -129,23 +135,23 @@ int {{classname}}::addServerConfiguration(const QString &operation, const QUrl &
129135
}
130136

131137
/**
132-
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
133-
* @param url A string that contains the URL of the server
134-
* @param description A String that describes the server
135-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
136-
*/
138+
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
139+
* @param url A string that contains the URL of the server
140+
* @param description A String that describes the server
141+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
142+
*/
137143
void {{classname}}::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap<QString, {{prefix}}ServerVariable> &variables) {
138144
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
139145
setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables));
140146
}
141147
}
142148

143149
/**
144-
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
145-
* @param URL A string that contains the URL of the server
146-
* @param description A String that describes the server
147-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
148-
*/
150+
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
151+
* @param URL A string that contains the URL of the server
152+
* @param description A String that describes the server
153+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
154+
*/
149155
void {{classname}}::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, {{prefix}}ServerVariable> &variables) {
150156
setServerIndex(operation, addServerConfiguration(operation, url, description, variables));
151157
}

samples/client/petstore/cpp-qt-addDownloadProgress/client/PFXFakeApi.cpp

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,22 @@ void PFXFakeApi::initializeServerConfigs() {
4444
}
4545

4646
/**
47-
* returns 0 on success and -1, -2 or -3 on failure.
48-
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
49-
*/
47+
* returns 0 on success and -1, -2 or -3 on failure.
48+
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
49+
*/
5050
int PFXFakeApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) {
5151
auto it = _serverConfigs.find(operation);
5252
if (it != _serverConfigs.end() && serverIndex < it.value().size()) {
5353
return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value);
5454
}
5555
return -3;
5656
}
57+
58+
/**
59+
* Sets the server index.
60+
* @param operation The id to the target operation.
61+
* @param serverIndex The server index.
62+
*/
5763
void PFXFakeApi::setServerIndex(const QString &operation, int serverIndex) {
5864
if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) {
5965
_serverIndices[operation] = serverIndex;
@@ -96,13 +102,13 @@ void PFXFakeApi::setNetworkAccessManager(QNetworkAccessManager* manager) {
96102
}
97103

98104
/**
99-
* Appends a new ServerConfiguration to the config map for a specific operation.
100-
* @param operation The id to the target operation.
101-
* @param url A string that contains the URL of the server
102-
* @param description A String that describes the server
103-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
104-
* returns the index of the new server config on success and -1 if the operation is not found
105-
*/
105+
* Appends a new ServerConfiguration to the config map for a specific operation.
106+
* @param operation The id to the target operation.
107+
* @param url A string that contains the URL of the server
108+
* @param description A String that describes the server
109+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
110+
* returns the index of the new server config on success and -1 if the operation is not found
111+
*/
106112
int PFXFakeApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables) {
107113
if (_serverConfigs.contains(operation)) {
108114
_serverConfigs[operation].append(PFXServerConfiguration(
@@ -116,23 +122,23 @@ int PFXFakeApi::addServerConfiguration(const QString &operation, const QUrl &url
116122
}
117123

118124
/**
119-
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
120-
* @param url A string that contains the URL of the server
121-
* @param description A String that describes the server
122-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
123-
*/
125+
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
126+
* @param url A string that contains the URL of the server
127+
* @param description A String that describes the server
128+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
129+
*/
124130
void PFXFakeApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables) {
125131
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
126132
setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables));
127133
}
128134
}
129135

130136
/**
131-
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
132-
* @param URL A string that contains the URL of the server
133-
* @param description A String that describes the server
134-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
135-
*/
137+
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
138+
* @param URL A string that contains the URL of the server
139+
* @param description A String that describes the server
140+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
141+
*/
136142
void PFXFakeApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables) {
137143
setServerIndex(operation, addServerConfiguration(operation, url, description, variables));
138144
}

samples/client/petstore/cpp-qt-addDownloadProgress/client/PFXPetApi.cpp

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,22 @@ void PFXPetApi::initializeServerConfigs() {
6060
}
6161

6262
/**
63-
* returns 0 on success and -1, -2 or -3 on failure.
64-
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
65-
*/
63+
* returns 0 on success and -1, -2 or -3 on failure.
64+
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
65+
*/
6666
int PFXPetApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) {
6767
auto it = _serverConfigs.find(operation);
6868
if (it != _serverConfigs.end() && serverIndex < it.value().size()) {
6969
return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value);
7070
}
7171
return -3;
7272
}
73+
74+
/**
75+
* Sets the server index.
76+
* @param operation The id to the target operation.
77+
* @param serverIndex The server index.
78+
*/
7379
void PFXPetApi::setServerIndex(const QString &operation, int serverIndex) {
7480
if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) {
7581
_serverIndices[operation] = serverIndex;
@@ -112,13 +118,13 @@ void PFXPetApi::setNetworkAccessManager(QNetworkAccessManager* manager) {
112118
}
113119

114120
/**
115-
* Appends a new ServerConfiguration to the config map for a specific operation.
116-
* @param operation The id to the target operation.
117-
* @param url A string that contains the URL of the server
118-
* @param description A String that describes the server
119-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
120-
* returns the index of the new server config on success and -1 if the operation is not found
121-
*/
121+
* Appends a new ServerConfiguration to the config map for a specific operation.
122+
* @param operation The id to the target operation.
123+
* @param url A string that contains the URL of the server
124+
* @param description A String that describes the server
125+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
126+
* returns the index of the new server config on success and -1 if the operation is not found
127+
*/
122128
int PFXPetApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables) {
123129
if (_serverConfigs.contains(operation)) {
124130
_serverConfigs[operation].append(PFXServerConfiguration(
@@ -132,23 +138,23 @@ int PFXPetApi::addServerConfiguration(const QString &operation, const QUrl &url,
132138
}
133139

134140
/**
135-
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
136-
* @param url A string that contains the URL of the server
137-
* @param description A String that describes the server
138-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
139-
*/
141+
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
142+
* @param url A string that contains the URL of the server
143+
* @param description A String that describes the server
144+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
145+
*/
140146
void PFXPetApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables) {
141147
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
142148
setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables));
143149
}
144150
}
145151

146152
/**
147-
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
148-
* @param URL A string that contains the URL of the server
149-
* @param description A String that describes the server
150-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
151-
*/
153+
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
154+
* @param URL A string that contains the URL of the server
155+
* @param description A String that describes the server
156+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
157+
*/
152158
void PFXPetApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables) {
153159
setServerIndex(operation, addServerConfiguration(operation, url, description, variables));
154160
}

samples/client/petstore/cpp-qt-addDownloadProgress/client/PFXPrimitivesApi.cpp

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,22 @@ void PFXPrimitivesApi::initializeServerConfigs() {
4646
}
4747

4848
/**
49-
* returns 0 on success and -1, -2 or -3 on failure.
50-
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
51-
*/
49+
* returns 0 on success and -1, -2 or -3 on failure.
50+
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
51+
*/
5252
int PFXPrimitivesApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value) {
5353
auto it = _serverConfigs.find(operation);
5454
if (it != _serverConfigs.end() && serverIndex < it.value().size()) {
5555
return _serverConfigs[operation][serverIndex].setDefaultValue(variable,value);
5656
}
5757
return -3;
5858
}
59+
60+
/**
61+
* Sets the server index.
62+
* @param operation The id to the target operation.
63+
* @param serverIndex The server index.
64+
*/
5965
void PFXPrimitivesApi::setServerIndex(const QString &operation, int serverIndex) {
6066
if (_serverIndices.contains(operation) && serverIndex < _serverConfigs.find(operation).value().size()) {
6167
_serverIndices[operation] = serverIndex;
@@ -98,13 +104,13 @@ void PFXPrimitivesApi::setNetworkAccessManager(QNetworkAccessManager* manager) {
98104
}
99105

100106
/**
101-
* Appends a new ServerConfiguration to the config map for a specific operation.
102-
* @param operation The id to the target operation.
103-
* @param url A string that contains the URL of the server
104-
* @param description A String that describes the server
105-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
106-
* returns the index of the new server config on success and -1 if the operation is not found
107-
*/
107+
* Appends a new ServerConfiguration to the config map for a specific operation.
108+
* @param operation The id to the target operation.
109+
* @param url A string that contains the URL of the server
110+
* @param description A String that describes the server
111+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
112+
* returns the index of the new server config on success and -1 if the operation is not found
113+
*/
108114
int PFXPrimitivesApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables) {
109115
if (_serverConfigs.contains(operation)) {
110116
_serverConfigs[operation].append(PFXServerConfiguration(
@@ -118,23 +124,23 @@ int PFXPrimitivesApi::addServerConfiguration(const QString &operation, const QUr
118124
}
119125

120126
/**
121-
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
122-
* @param url A string that contains the URL of the server
123-
* @param description A String that describes the server
124-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
125-
*/
127+
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
128+
* @param url A string that contains the URL of the server
129+
* @param description A String that describes the server
130+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
131+
*/
126132
void PFXPrimitivesApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables) {
127133
for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) {
128134
setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables));
129135
}
130136
}
131137

132138
/**
133-
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
134-
* @param URL A string that contains the URL of the server
135-
* @param description A String that describes the server
136-
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
137-
*/
139+
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
140+
* @param URL A string that contains the URL of the server
141+
* @param description A String that describes the server
142+
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
143+
*/
138144
void PFXPrimitivesApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables) {
139145
setServerIndex(operation, addServerConfiguration(operation, url, description, variables));
140146
}

0 commit comments

Comments
 (0)