Main Page
Namespaces
Namespace List
Namespace Members
All
Functions
Enumerations
Enumerator
Classes
Class List
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
w
~
Variables
a
b
c
d
e
f
h
i
l
m
n
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Files
File List
File Members
All
Functions
Typedefs
Enumerations
Enumerator
Macros
include
pf_driver
pf
http_helpers
curl_resource.h
Go to the documentation of this file.
1
// Copyright 2022 Fraunhofer IPA
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#pragma once
16
17
#include <sstream>
18
#include <curlpp/cURLpp.hpp>
19
#include <curlpp/Easy.hpp>
20
#include <curlpp/Options.hpp>
21
#include <json/json.h>
22
23
#include "
pf_driver/pf/http_helpers/param_map_type.h
"
24
#include "
pf_driver/pf/http_helpers/param_type.h
"
25
26
class
CurlResource
27
{
28
public
:
29
CurlResource
(
const
std::string& host);
30
31
void
append_path
(
const
std::string& path);
32
33
void
append_query
(
const
std::initializer_list<param_type>& list,
bool
do_encoding =
false
);
34
35
void
append_query
(
const
param_map_type
& params,
bool
do_encoding =
false
);
36
37
void
get
(Json::Value& json_resp);
38
39
void
print
();
40
41
private
:
42
std::string
url_
;
43
curlpp::Cleanup
cleaner
;
44
curlpp::Easy
request_
;
45
std::list<std::string>
header_
;
46
std::stringstream
response_
;
47
};
CurlResource::cleaner
curlpp::Cleanup cleaner
Definition:
curl_resource.h:43
CurlResource::response_
std::stringstream response_
Definition:
curl_resource.h:46
CurlResource::append_path
void append_path(const std::string &path)
Definition:
curl_resource.cpp:10
CurlResource::append_query
void append_query(const std::initializer_list< param_type > &list, bool do_encoding=false)
Definition:
curl_resource.cpp:15
CurlResource::url_
std::string url_
Definition:
curl_resource.h:42
CurlResource::header_
std::list< std::string > header_
Definition:
curl_resource.h:45
CurlResource::request_
curlpp::Easy request_
Definition:
curl_resource.h:44
CurlResource::CurlResource
CurlResource(const std::string &host)
Definition:
curl_resource.cpp:3
param_map_type
std::map< std::string, std::string > param_map_type
Definition:
param_map_type.h:20
CurlResource::get
void get(Json::Value &json_resp)
Definition:
curl_resource.cpp:35
CurlResource
Definition:
curl_resource.h:26
CurlResource::print
void print()
Definition:
curl_resource.cpp:44
param_map_type.h
param_type.h
pf_driver
Author(s): Harsh Deshpande
autogenerated on Sun Feb 4 2024 03:32:56