| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* GATE PROJECT LICENSE: | ||
| 2 | +----------------------------------------------------------------------------+ | ||
| 3 | | Copyright(c) 2018-2026, Stefan Meislinger | | ||
| 4 | | All rights reserved. | | ||
| 5 | | | | ||
| 6 | | Redistribution and use in source and binary forms, with or without | | ||
| 7 | | modification, are permitted provided that the following conditions are met:| | ||
| 8 | | | | ||
| 9 | | 1. Redistributions of source code must retain the above copyright notice, | | ||
| 10 | | this list of conditions and the following disclaimer. | | ||
| 11 | | 2. Redistributions in binary form must reproduce the above copyright | | ||
| 12 | | notice, this list of conditions and the following disclaimer in the | | ||
| 13 | | documentation and/or other materials provided with the distribution. | | ||
| 14 | | | | ||
| 15 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"| | ||
| 16 | | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | ||
| 17 | | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | ||
| 18 | | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | | ||
| 19 | | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | ||
| 20 | | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | ||
| 21 | | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | ||
| 22 | | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | ||
| 23 | | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | ||
| 24 | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | | ||
| 25 | | THE POSSIBILITY OF SUCH DAMAGE. | | ||
| 26 | +----------------------------------------------------------------------------+ | ||
| 27 | */ | ||
| 28 | |||
| 29 | #include "gate/tech/webapis.hpp" | ||
| 30 | |||
| 31 | namespace gate | ||
| 32 | { | ||
| 33 | namespace tech | ||
| 34 | { | ||
| 35 | |||
| 36 | // context infos // | ||
| 37 | |||
| 38 | 9 | static gate_result_t GATE_CALL webapi_context_init(gate_struct_t* ptr) | |
| 39 | { | ||
| 40 | 9 | gate_tech_webapi_context_init((gate_tech_webapi_context_t*)ptr); | |
| 41 | 9 | return GATE_RESULT_OK; | |
| 42 | } | ||
| 43 | |||
| 44 | 9 | WebApi::Context::Context() | |
| 45 | 9 | : struct_instance_t(&webapi_context_init) | |
| 46 | { | ||
| 47 | |||
| 48 | 9 | } | |
| 49 | |||
| 50 | ✗ | String WebApi::Context::ProxyServer() const | |
| 51 | { | ||
| 52 | ✗ | return String((*this)->proxy_server); | |
| 53 | } | ||
| 54 | ✗ | void WebApi::Context::ProxyServer(String const& value) | |
| 55 | { | ||
| 56 | ✗ | String::assign((*this)->proxy_server, value); | |
| 57 | ✗ | } | |
| 58 | |||
| 59 | ✗ | uint16_t WebApi::Context::ProxyPort() const | |
| 60 | { | ||
| 61 | ✗ | return (*this)->proxy_port; | |
| 62 | } | ||
| 63 | ✗ | void WebApi::Context::ProxyPort(uint16_t value) | |
| 64 | { | ||
| 65 | ✗ | (*this)->proxy_port = value; | |
| 66 | ✗ | } | |
| 67 | |||
| 68 | ✗ | bool_t WebApi::Context::NativeClient() const | |
| 69 | { | ||
| 70 | ✗ | return (*this)->native_client; | |
| 71 | } | ||
| 72 | ✗ | void WebApi::Context::NativeClient(bool_t value) | |
| 73 | { | ||
| 74 | ✗ | (*this)->native_client = value; | |
| 75 | ✗ | } | |
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | // Ipwhois request // | ||
| 80 | |||
| 81 | 3 | static gate_result_t GATE_CALL ipwhois_request_init(gate_struct_t* ptr) | |
| 82 | { | ||
| 83 | 3 | gate_tech_webapi_ipwhois_request_init((gate_tech_webapi_ipwhois_request_t*)ptr); | |
| 84 | 3 | return GATE_RESULT_OK; | |
| 85 | } | ||
| 86 | |||
| 87 | 3 | WebApi::IpwhoisRequest::IpwhoisRequest() | |
| 88 | 3 | : struct_instance_t(&ipwhois_request_init) | |
| 89 | { | ||
| 90 | 3 | } | |
| 91 | |||
| 92 | ✗ | String WebApi::IpwhoisRequest::IpAddress() const | |
| 93 | { | ||
| 94 | ✗ | return String::duplicate((*this)->ip_address); | |
| 95 | } | ||
| 96 | 3 | void WebApi::IpwhoisRequest::IpAddress(String const& value) | |
| 97 | { | ||
| 98 | 3 | String::assign((*this)->ip_address, value); | |
| 99 | 3 | } | |
| 100 | |||
| 101 | |||
| 102 | // Ipwhois response // | ||
| 103 | |||
| 104 | 3 | static gate_result_t GATE_CALL ipwhois_response_init(gate_struct_t* ptr) | |
| 105 | { | ||
| 106 | 3 | gate_tech_webapi_ipwhois_response_init((gate_tech_webapi_ipwhois_response_t*)ptr); | |
| 107 | 3 | return GATE_RESULT_OK; | |
| 108 | } | ||
| 109 | |||
| 110 | 3 | WebApi::IpwhoisResponse::IpwhoisResponse() | |
| 111 | 3 | : struct_instance_t(&ipwhois_response_init) | |
| 112 | { | ||
| 113 | 3 | } | |
| 114 | |||
| 115 | 3 | String WebApi::IpwhoisResponse::IpAddress() const | |
| 116 | { | ||
| 117 | 3 | return String::duplicate((*this)->ip_address); | |
| 118 | } | ||
| 119 | 3 | String WebApi::IpwhoisResponse::Range() const | |
| 120 | { | ||
| 121 | 3 | return String::duplicate((*this)->range); | |
| 122 | } | ||
| 123 | |||
| 124 | 3 | String WebApi::IpwhoisResponse::InetOrg() const | |
| 125 | { | ||
| 126 | 3 | return String::duplicate((*this)->inet_org); | |
| 127 | } | ||
| 128 | 3 | String WebApi::IpwhoisResponse::InetNetname() const | |
| 129 | { | ||
| 130 | 3 | return String::duplicate((*this)->inet_netname); | |
| 131 | } | ||
| 132 | 3 | String WebApi::IpwhoisResponse::InetDescr() const | |
| 133 | { | ||
| 134 | 3 | return String::duplicate((*this)->inet_descr); | |
| 135 | } | ||
| 136 | 3 | String WebApi::IpwhoisResponse::InetCountry() const | |
| 137 | { | ||
| 138 | 3 | return String::duplicate((*this)->inet_country); | |
| 139 | } | ||
| 140 | 3 | Time WebApi::IpwhoisResponse::InetCreated() const | |
| 141 | { | ||
| 142 | 3 | return Time((*this)->inet_created); | |
| 143 | } | ||
| 144 | 3 | Time WebApi::IpwhoisResponse::InetModified() const | |
| 145 | { | ||
| 146 | 3 | return Time((*this)->inet_modified); | |
| 147 | } | ||
| 148 | |||
| 149 | 3 | String WebApi::IpwhoisResponse::OrgName() const | |
| 150 | { | ||
| 151 | 3 | return String::duplicate((*this)->org_name); | |
| 152 | } | ||
| 153 | 3 | String WebApi::IpwhoisResponse::OrgCountry() const | |
| 154 | { | ||
| 155 | 3 | return String::duplicate((*this)->org_country); | |
| 156 | } | ||
| 157 | 3 | String WebApi::IpwhoisResponse::OrgType() const | |
| 158 | { | ||
| 159 | 3 | return String::duplicate((*this)->org_type); | |
| 160 | } | ||
| 161 | 3 | String WebApi::IpwhoisResponse::OrgAddress() const | |
| 162 | { | ||
| 163 | 3 | return String::duplicate((*this)->org_address); | |
| 164 | } | ||
| 165 | 3 | String WebApi::IpwhoisResponse::OrgPhone() const | |
| 166 | { | ||
| 167 | 3 | return String::duplicate((*this)->org_phone); | |
| 168 | } | ||
| 169 | 3 | String WebApi::IpwhoisResponse::OrgMail() const | |
| 170 | { | ||
| 171 | 3 | return String::duplicate((*this)->org_mail); | |
| 172 | } | ||
| 173 | |||
| 174 | 3 | String WebApi::IpwhoisResponse::RoleName() const | |
| 175 | { | ||
| 176 | 3 | return String::duplicate((*this)->role_name); | |
| 177 | } | ||
| 178 | 3 | String WebApi::IpwhoisResponse::RoleAddress() const | |
| 179 | { | ||
| 180 | 3 | return String::duplicate((*this)->role_address); | |
| 181 | } | ||
| 182 | 3 | String WebApi::IpwhoisResponse::RoleMail() const | |
| 183 | { | ||
| 184 | 3 | return String::duplicate((*this)->role_mail); | |
| 185 | } | ||
| 186 | 3 | String WebApi::IpwhoisResponse::RoleAdminC() const | |
| 187 | { | ||
| 188 | 3 | return String::duplicate((*this)->role_admin_c); | |
| 189 | } | ||
| 190 | 3 | String WebApi::IpwhoisResponse::RoleTechC() const | |
| 191 | { | ||
| 192 | 3 | return String::duplicate((*this)->role_tech_c); | |
| 193 | } | ||
| 194 | |||
| 195 | 3 | String WebApi::IpwhoisResponse::RouteName() const | |
| 196 | { | ||
| 197 | 3 | return String::duplicate((*this)->route_name); | |
| 198 | } | ||
| 199 | 3 | String WebApi::IpwhoisResponse::RouteDescr() const | |
| 200 | { | ||
| 201 | 3 | return String::duplicate((*this)->route_descr); | |
| 202 | } | ||
| 203 | |||
| 204 | 3 | void WebApi::loadIpwhois(Context& ctx, IpwhoisRequest& request, IpwhoisResponse& response) | |
| 205 | { | ||
| 206 | 3 | result_t result = gate_tech_webapi_ipwhois(ctx.c_instance(), request.c_instance(), response.c_instance()); | |
| 207 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | GATEXX_CHECK_EXCEPTION(result); |
| 208 | 3 | } | |
| 209 | |||
| 210 | |||
| 211 | |||
| 212 | // newsfeed request // | ||
| 213 | |||
| 214 | 2 | static gate_result_t GATE_CALL newsfeed_request_init(gate_struct_t* ptr) | |
| 215 | { | ||
| 216 | 2 | gate_tech_webapi_newsfeed_request_init((gate_tech_webapi_newsfeed_request_t*)ptr); | |
| 217 | 2 | return GATE_RESULT_OK; | |
| 218 | } | ||
| 219 | |||
| 220 | 2 | WebApi::NewsfeedRequest::NewsfeedRequest() | |
| 221 | 2 | : struct_instance_t(&newsfeed_request_init) | |
| 222 | { | ||
| 223 | 2 | } | |
| 224 | |||
| 225 | 2 | String WebApi::NewsfeedRequest::RequestUrl() const | |
| 226 | { | ||
| 227 | 2 | return String::duplicate((*this)->request_url); | |
| 228 | } | ||
| 229 | 2 | void WebApi::NewsfeedRequest::RequestUrl(String const& value) | |
| 230 | { | ||
| 231 | 2 | String::assign((*this)->request_url, value); | |
| 232 | 2 | } | |
| 233 | |||
| 234 | |||
| 235 | // newsfeed entry // | ||
| 236 | |||
| 237 | ✗ | static gate_result_t GATE_CALL newsfeed_entry_init(gate_struct_t* ptr) | |
| 238 | { | ||
| 239 | ✗ | gate_tech_webapi_newsentry_init((gate_tech_webapi_newsentry_t*)ptr); | |
| 240 | ✗ | return GATE_RESULT_OK; | |
| 241 | } | ||
| 242 | |||
| 243 | ✗ | WebApi::NewsfeedEntry::NewsfeedEntry() | |
| 244 | ✗ | : struct_instance_t(&newsfeed_entry_init) | |
| 245 | { | ||
| 246 | ✗ | } | |
| 247 | 37 | WebApi::NewsfeedEntry::NewsfeedEntry(gate_tech_webapi_newsentry_t const& src) | |
| 248 | 37 | : struct_instance_t(src) | |
| 249 | { | ||
| 250 | 37 | } | |
| 251 | |||
| 252 | |||
| 253 | 37 | String WebApi::NewsfeedEntry::Uid() const | |
| 254 | { | ||
| 255 | 37 | return String::duplicate((*this)->uid); | |
| 256 | } | ||
| 257 | 37 | String WebApi::NewsfeedEntry::Title() const | |
| 258 | { | ||
| 259 | 37 | return String::duplicate((*this)->title); | |
| 260 | } | ||
| 261 | 37 | String WebApi::NewsfeedEntry::Link() const | |
| 262 | { | ||
| 263 | 37 | return String::duplicate((*this)->link); | |
| 264 | } | ||
| 265 | 37 | Time WebApi::NewsfeedEntry::UpdateTime() const | |
| 266 | { | ||
| 267 | 37 | return Time((*this)->update_time); | |
| 268 | } | ||
| 269 | 37 | String WebApi::NewsfeedEntry::Author() const | |
| 270 | { | ||
| 271 | 37 | return String::duplicate((*this)->author); | |
| 272 | } | ||
| 273 | 37 | String WebApi::NewsfeedEntry::Category() const | |
| 274 | { | ||
| 275 | 37 | return String::duplicate((*this)->category); | |
| 276 | } | ||
| 277 | 37 | String WebApi::NewsfeedEntry::Summary() const | |
| 278 | { | ||
| 279 | 37 | return String::duplicate((*this)->summary); | |
| 280 | } | ||
| 281 | |||
| 282 | 37 | String WebApi::NewsfeedEntry::Content() const | |
| 283 | { | ||
| 284 | 37 | return String::duplicate((*this)->content); | |
| 285 | } | ||
| 286 | |||
| 287 | |||
| 288 | // newsfeed response // | ||
| 289 | |||
| 290 | 2 | static gate_result_t GATE_CALL newsfeed_response_init(gate_struct_t* ptr) | |
| 291 | { | ||
| 292 | 2 | gate_tech_webapi_newsfeed_response_init((gate_tech_webapi_newsfeed_response_t*)ptr); | |
| 293 | 2 | return GATE_RESULT_OK; | |
| 294 | } | ||
| 295 | |||
| 296 | 2 | WebApi::NewsfeedResponse::NewsfeedResponse() | |
| 297 | 2 | : struct_instance_t(&newsfeed_response_init) | |
| 298 | { | ||
| 299 | 2 | } | |
| 300 | |||
| 301 | 2 | String WebApi::NewsfeedResponse::RequestUrl() const | |
| 302 | { | ||
| 303 | 2 | return String::duplicate((*this)->request_url); | |
| 304 | } | ||
| 305 | 2 | String WebApi::NewsfeedResponse::Uid() const | |
| 306 | { | ||
| 307 | 2 | return String::duplicate((*this)->uid); | |
| 308 | } | ||
| 309 | 2 | String WebApi::NewsfeedResponse::Title() const | |
| 310 | { | ||
| 311 | 2 | return String::duplicate((*this)->title); | |
| 312 | } | ||
| 313 | 2 | String WebApi::NewsfeedResponse::Link() const | |
| 314 | { | ||
| 315 | 2 | return String::duplicate((*this)->link); | |
| 316 | } | ||
| 317 | 2 | Time WebApi::NewsfeedResponse::UpdateTime() const | |
| 318 | { | ||
| 319 | 2 | return Time((*this)->update_time); | |
| 320 | } | ||
| 321 | |||
| 322 | 2 | String WebApi::NewsfeedResponse::Description() const | |
| 323 | { | ||
| 324 | 2 | return String::duplicate((*this)->description); | |
| 325 | } | ||
| 326 | 2 | String WebApi::NewsfeedResponse::Language() const | |
| 327 | { | ||
| 328 | 2 | return String::duplicate((*this)->language); | |
| 329 | } | ||
| 330 | 2 | String WebApi::NewsfeedResponse::Publisher() const | |
| 331 | { | ||
| 332 | 2 | return String::duplicate((*this)->publisher); | |
| 333 | } | ||
| 334 | 2 | String WebApi::NewsfeedResponse::Contact() const | |
| 335 | { | ||
| 336 | 2 | return String::duplicate((*this)->contact); | |
| 337 | } | ||
| 338 | 2 | String WebApi::NewsfeedResponse::Image() const | |
| 339 | { | ||
| 340 | 2 | return String::duplicate((*this)->image); | |
| 341 | } | ||
| 342 | |||
| 343 | 2 | Array<WebApi::NewsfeedEntry> WebApi::NewsfeedResponse::Entries() const | |
| 344 | { | ||
| 345 | 2 | gate_enumerator_t enumerator = GATE_INIT_EMPTY; | |
| 346 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | ArrayList<NewsfeedEntry> ret; |
| 347 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
|
2 | if (NULL == gate_arraylist_enumerate((*this)->entries, &enumerator)) |
| 348 | { | ||
| 349 | ✗ | GATEXX_RAISE_ERROR(results::OutOfMemory); | |
| 350 | } | ||
| 351 |
3/4✓ Branch 1 taken 39 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 37 times.
✓ Branch 4 taken 2 times.
|
39 | while (gate_enumerator_valid(&enumerator)) |
| 352 | { | ||
| 353 | gate_tech_webapi_newsentry_t const* ptr_entry | ||
| 354 |
1/2✓ Branch 1 taken 37 times.
✗ Branch 2 not taken.
|
37 | = (gate_tech_webapi_newsentry_t const*)gate_enumerator_get(&enumerator); |
| 355 |
1/2✓ Branch 1 taken 37 times.
✗ Branch 2 not taken.
|
74 | NewsfeedEntry entry(*ptr_entry); |
| 356 |
1/2✓ Branch 1 taken 37 times.
✗ Branch 2 not taken.
|
37 | ret.add(entry); |
| 357 |
1/2✓ Branch 1 taken 37 times.
✗ Branch 2 not taken.
|
37 | gate_enumerator_next(&enumerator); |
| 358 | } | ||
| 359 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | return ret.toArray(); |
| 360 | } | ||
| 361 | |||
| 362 | 2 | void WebApi::loadNewsfeed(Context& ctx, NewsfeedRequest& request, NewsfeedResponse& response) | |
| 363 | { | ||
| 364 | 2 | result_t result = gate_tech_webapi_newsfeed(ctx.c_instance(), request.c_instance(), response.c_instance()); | |
| 365 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | GATEXX_CHECK_EXCEPTION(result); |
| 366 | 2 | } | |
| 367 | |||
| 368 | |||
| 369 | 9 | static gate_result_t GATE_CALL weather_request_init(gate_struct_t* ptr) | |
| 370 | { | ||
| 371 | 9 | gate_tech_webapi_weather_request_init((gate_tech_webapi_weather_request_t*)ptr); | |
| 372 | 9 | return GATE_RESULT_OK; | |
| 373 | } | ||
| 374 | |||
| 375 | 9 | WebApi::WeatherRequest::WeatherRequest() | |
| 376 | 9 | : struct_instance_t(&weather_request_init) | |
| 377 | { | ||
| 378 | 9 | } | |
| 379 | |||
| 380 | 9 | void WebApi::WeatherRequest::Provider(String const& value) | |
| 381 | { | ||
| 382 | 9 | String::assign(this->instance.provider, value); | |
| 383 | 9 | } | |
| 384 | 9 | String WebApi::WeatherRequest::Provider() const | |
| 385 | { | ||
| 386 | 9 | return String((*this)->provider); | |
| 387 | } | ||
| 388 | |||
| 389 | 9 | void WebApi::WeatherRequest::Latitude(real32_t value) | |
| 390 | { | ||
| 391 | 9 | this->instance.latitude = value; | |
| 392 | 9 | } | |
| 393 | 9 | real32_t WebApi::WeatherRequest::Latitude() const | |
| 394 | { | ||
| 395 | 9 | return (*this)->latitude; | |
| 396 | } | ||
| 397 | |||
| 398 | |||
| 399 | 9 | void WebApi::WeatherRequest::Longitude(real32_t value) | |
| 400 | { | ||
| 401 | 9 | this->instance.longitude = value; | |
| 402 | 9 | } | |
| 403 | 9 | real32_t WebApi::WeatherRequest::Longitude() const | |
| 404 | { | ||
| 405 | 9 | return (*this)->longitude; | |
| 406 | } | ||
| 407 | |||
| 408 | 9 | void WebApi::WeatherRequest::Location(String const& value) | |
| 409 | { | ||
| 410 | 9 | String::assign(this->instance.location, value); | |
| 411 | 9 | } | |
| 412 | 9 | String WebApi::WeatherRequest::Location() const | |
| 413 | { | ||
| 414 | 9 | return String((*this)->location); | |
| 415 | } | ||
| 416 | |||
| 417 | 9 | void WebApi::WeatherRequest::RecordTime(Time const& value) | |
| 418 | { | ||
| 419 | 9 | this->instance.record_time = value; | |
| 420 | 9 | } | |
| 421 | 9 | Time WebApi::WeatherRequest::RecordTime() const | |
| 422 | { | ||
| 423 | 9 | return Time((*this)->record_time); | |
| 424 | } | ||
| 425 | |||
| 426 | |||
| 427 | |||
| 428 | 9 | static gate_result_t GATE_CALL weather_response_init(gate_struct_t* ptr) | |
| 429 | { | ||
| 430 | 9 | gate_tech_webapi_weather_response_init((gate_tech_webapi_weather_response_t*)ptr); | |
| 431 | 9 | return GATE_RESULT_OK; | |
| 432 | } | ||
| 433 | |||
| 434 | 9 | WebApi::WeatherResponse::WeatherResponse() | |
| 435 | 9 | : struct_instance_t(&weather_response_init) | |
| 436 | { | ||
| 437 | 9 | } | |
| 438 | 9 | real32_t WebApi::WeatherResponse::Latitude() const | |
| 439 | { | ||
| 440 | 9 | return (*this)->latitude; | |
| 441 | } | ||
| 442 | 9 | real32_t WebApi::WeatherResponse::Longitude() const | |
| 443 | { | ||
| 444 | 9 | return (*this)->longitude; | |
| 445 | } | ||
| 446 | 9 | String WebApi::WeatherResponse::Location() const | |
| 447 | { | ||
| 448 | 9 | return String((*this)->location); | |
| 449 | } | ||
| 450 | 9 | Array<WebApi::WeatherRecord> WebApi::WeatherResponse::Records() const | |
| 451 | { | ||
| 452 |
1/2✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
|
18 | ArrayList<WeatherRecord> tmp; |
| 453 |
2/4✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
9 | tmp.importFrom<WeatherRecord>((*this)->records); |
| 454 |
1/2✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
|
18 | return tmp.toArray(); |
| 455 | } | ||
| 456 | |||
| 457 | |||
| 458 | 9 | void WebApi::loadWeatherRecord(Context& ctx, WeatherRequest& request, WeatherResponse& response) | |
| 459 | { | ||
| 460 | 9 | result_t result = gate_tech_webapi_weather(ctx.c_instance(), request.c_instance(), response.c_instance()); | |
| 461 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | GATEXX_CHECK_EXCEPTION(result); |
| 462 | 9 | } | |
| 463 | |||
| 464 | |||
| 465 | |||
| 466 | 1 | static gate_result_t GATE_CALL geomaps_request_init(gate_struct_t* ptr) | |
| 467 | { | ||
| 468 | 1 | gate_tech_webapi_geomaps_request_init((gate_tech_webapi_geomaps_request_t*)ptr); | |
| 469 | 1 | return GATE_RESULT_OK; | |
| 470 | } | ||
| 471 | |||
| 472 | 1 | WebApi::GeomapRequest::GeomapRequest() | |
| 473 | 1 | : struct_instance_t(&geomaps_request_init) | |
| 474 | { | ||
| 475 | 1 | } | |
| 476 | |||
| 477 | ✗ | void WebApi::GeomapRequest::Provider(String const& value) | |
| 478 | { | ||
| 479 | ✗ | String::assign(this->instance.provider, value); | |
| 480 | ✗ | } | |
| 481 | ✗ | String WebApi::GeomapRequest::Provider() const | |
| 482 | { | ||
| 483 | ✗ | return String(this->instance.provider); | |
| 484 | } | ||
| 485 | |||
| 486 | 1 | void WebApi::GeomapRequest::ImageWidth(uint32_t const& value) | |
| 487 | { | ||
| 488 | 1 | this->instance.image_width = value; | |
| 489 | 1 | } | |
| 490 | 1 | uint32_t WebApi::GeomapRequest::ImageWidth() const | |
| 491 | { | ||
| 492 | 1 | return this->instance.image_width; | |
| 493 | } | ||
| 494 | |||
| 495 | 1 | void WebApi::GeomapRequest::ImageHeight(uint32_t const& value) | |
| 496 | { | ||
| 497 | 1 | this->instance.image_height = value; | |
| 498 | 1 | } | |
| 499 | 1 | uint32_t WebApi::GeomapRequest::ImageHeight() const | |
| 500 | { | ||
| 501 | 1 | return this->instance.image_height; | |
| 502 | } | ||
| 503 | |||
| 504 | 1 | void WebApi::GeomapRequest::CenterLatitude(real32_t value) | |
| 505 | { | ||
| 506 | 1 | this->instance.center_latitude = value; | |
| 507 | 1 | } | |
| 508 | 1 | real32_t WebApi::GeomapRequest::CenterLatitude() const | |
| 509 | { | ||
| 510 | 1 | return this->instance.center_latitude; | |
| 511 | } | ||
| 512 | |||
| 513 | 1 | void WebApi::GeomapRequest::CenterLongitude(real32_t value) | |
| 514 | { | ||
| 515 | 1 | this->instance.center_longitude = value; | |
| 516 | 1 | } | |
| 517 | 1 | real32_t WebApi::GeomapRequest::CenterLongitude() const | |
| 518 | { | ||
| 519 | 1 | return this->instance.center_longitude; | |
| 520 | } | ||
| 521 | |||
| 522 | 1 | void WebApi::GeomapRequest::RadiusMeters(real32_t value) | |
| 523 | { | ||
| 524 | 1 | this->instance.radius_meters = value; | |
| 525 | 1 | } | |
| 526 | 1 | real64_t WebApi::GeomapRequest::RadiusMeters() const | |
| 527 | { | ||
| 528 | 1 | return this->instance.radius_meters; | |
| 529 | } | ||
| 530 | |||
| 531 | 3 | void WebApi::GeomapRequest::ImageType(ImageTypeEnum value) | |
| 532 | { | ||
| 533 | 3 | this->instance.image_type = (gate_int16_t)value; | |
| 534 | 3 | } | |
| 535 | 1 | WebApi::ImageTypeEnum WebApi::GeomapRequest::ImageType() const | |
| 536 | { | ||
| 537 | 1 | return (ImageTypeEnum)this->instance.image_type; | |
| 538 | } | ||
| 539 | |||
| 540 | |||
| 541 | |||
| 542 | |||
| 543 | 3 | static gate_result_t GATE_CALL geomaps_response_init(gate_struct_t* ptr) | |
| 544 | { | ||
| 545 | 3 | gate_tech_webapi_geomaps_response_init((gate_tech_webapi_geomaps_response_t*)ptr); | |
| 546 | 3 | return GATE_RESULT_OK; | |
| 547 | } | ||
| 548 | |||
| 549 | 3 | WebApi::GeomapResponse::GeomapResponse() | |
| 550 | 3 | : struct_instance_t(&geomaps_response_init) | |
| 551 | { | ||
| 552 | 3 | } | |
| 553 | |||
| 554 | 3 | void WebApi::GeomapResponse::ImageWidth(uint32_t const& value) | |
| 555 | { | ||
| 556 | 3 | this->instance.image_width = value; | |
| 557 | 3 | } | |
| 558 | 3 | uint32_t WebApi::GeomapResponse::ImageWidth() const | |
| 559 | { | ||
| 560 | 3 | return this->instance.image_width; | |
| 561 | } | ||
| 562 | |||
| 563 | 3 | void WebApi::GeomapResponse::ImageHeight(uint32_t const& value) | |
| 564 | { | ||
| 565 | 3 | this->instance.image_height = value; | |
| 566 | 3 | } | |
| 567 | 3 | uint32_t WebApi::GeomapResponse::ImageHeight() const | |
| 568 | { | ||
| 569 | 3 | return this->instance.image_height; | |
| 570 | } | ||
| 571 | |||
| 572 | 3 | void WebApi::GeomapResponse::CenterLatitude(real32_t value) | |
| 573 | { | ||
| 574 | 3 | this->instance.center_latitude = value; | |
| 575 | 3 | } | |
| 576 | 3 | real32_t WebApi::GeomapResponse::CenterLatitude() const | |
| 577 | { | ||
| 578 | 3 | return this->instance.center_latitude; | |
| 579 | } | ||
| 580 | |||
| 581 | 3 | void WebApi::GeomapResponse::CenterLongitude(real32_t value) | |
| 582 | { | ||
| 583 | 3 | this->instance.center_longitude = value; | |
| 584 | 3 | } | |
| 585 | 3 | real32_t WebApi::GeomapResponse::CenterLongitude() const | |
| 586 | { | ||
| 587 | 3 | return this->instance.center_longitude; | |
| 588 | } | ||
| 589 | |||
| 590 | 12 | void WebApi::GeomapResponse::MinLatitude(real32_t value) | |
| 591 | { | ||
| 592 | 12 | this->instance.min_latitude = value; | |
| 593 | 12 | } | |
| 594 | 12 | real32_t WebApi::GeomapResponse::MinLatitude() const | |
| 595 | { | ||
| 596 | 12 | return this->instance.min_latitude; | |
| 597 | } | ||
| 598 | 3 | void WebApi::GeomapResponse::MinLongitude(real32_t value) | |
| 599 | { | ||
| 600 | 3 | this->instance.min_longitude = value; | |
| 601 | 3 | } | |
| 602 | 3 | real32_t WebApi::GeomapResponse::MinLongitude() const | |
| 603 | { | ||
| 604 | 3 | return this->instance.min_longitude; | |
| 605 | } | ||
| 606 | |||
| 607 | 3 | void WebApi::GeomapResponse::MaxLatitude(real32_t value) | |
| 608 | { | ||
| 609 | 3 | this->instance.max_latitude = value; | |
| 610 | 3 | } | |
| 611 | 3 | real32_t WebApi::GeomapResponse::MaxLatitude() const | |
| 612 | { | ||
| 613 | 3 | return this->instance.max_latitude; | |
| 614 | } | ||
| 615 | 3 | void WebApi::GeomapResponse::MaxLongitude(real32_t value) | |
| 616 | { | ||
| 617 | 3 | this->instance.max_longitude = value; | |
| 618 | 3 | } | |
| 619 | 3 | real32_t WebApi::GeomapResponse::MaxLongitude() const | |
| 620 | { | ||
| 621 | 3 | return this->instance.max_longitude; | |
| 622 | } | ||
| 623 | |||
| 624 | 3 | void WebApi::GeomapResponse::ImageType(ImageTypeEnum value) | |
| 625 | { | ||
| 626 | 3 | this->instance.image_type = (gate_int16_t)value; | |
| 627 | 3 | } | |
| 628 | 3 | WebApi::ImageTypeEnum WebApi::GeomapResponse::ImageType() const | |
| 629 | { | ||
| 630 | 3 | return (ImageTypeEnum)this->instance.image_type; | |
| 631 | } | ||
| 632 | |||
| 633 | 3 | void WebApi::GeomapResponse::ImageFormat(ImageFormatEnum value) | |
| 634 | { | ||
| 635 | 3 | this->instance.image_format = (gate_int16_t)value; | |
| 636 | 3 | } | |
| 637 | 3 | WebApi::ImageFormatEnum WebApi::GeomapResponse::ImageFormat() const | |
| 638 | { | ||
| 639 | 3 | return (WebApi::ImageFormatEnum)this->instance.image_format; | |
| 640 | } | ||
| 641 | |||
| 642 | ✗ | void WebApi::GeomapResponse::ImageData(Blob const& value) | |
| 643 | { | ||
| 644 | ✗ | Blob::assign(this->instance.image_data, value); | |
| 645 | ✗ | } | |
| 646 | 3 | Blob WebApi::GeomapResponse::ImageData() const | |
| 647 | { | ||
| 648 | 3 | return Blob(this->instance.image_data); | |
| 649 | } | ||
| 650 | |||
| 651 | 3 | void WebApi::loadGeoMap(Context& ctx, GeomapRequest& request, GeomapResponse& response) | |
| 652 | { | ||
| 653 | 3 | result_t result = gate_tech_webapi_geomaps(ctx.c_instance(), request.c_instance(), response.c_instance()); | |
| 654 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | GATEXX_CHECK_EXCEPTION(result); |
| 655 | 3 | } | |
| 656 | |||
| 657 | |||
| 658 | |||
| 659 | } // end of namespace tech | ||
| 660 | } // end of namespace gate | ||
| 661 |