Files
domo/src/plugins/uhttpd/uhttpd-rest-api/core/http-parameter.h
2018-05-22 14:50:36 +02:00

64 lines
1.8 KiB
C++

/*!
* Copyright (c) 2015-2018, NADAL Jean-Baptiste. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*
* @Author: NADAL Jean-Baptiste
* @Date: 30/06/2017
*/
#ifndef _HTTP_PARAMETERS_H
#define _HTTP_PARAMETERS_H
/*------------------------------- INCLUDES ----------------------------------*/
#include <stdint.h>
#include <string>
#include <vector>
/*----------------------------- Dependencies --------------------------------*/
struct client;
struct json_object;
/*--------------------------------- CLASS ----------------------------------*/
class HttpParameter
{
public:
HttpParameter(void);
void parse_from_uri(struct json_object *a_root_node, const std::string &a_parameters);
std::string parse_from_uri(const std::string &a_parameters);
bool parse(client *a_client);
std::string get_origin(void);
std::string get_etag(void);
int16_t get_request_timeout(void);
private:
std::vector<std::string> split_params(const std::string &a_string, char a_seperator);
bool is_number(const std::string &a_string);
std::string m_origin;
std::string m_etag;
int16_t m_request_timeout;
};
#endif /* _HTTP_PARAMETERS_H */