ifm3d
util.h
1 // -*- c++ -*-
2 /*
3  * Copyright 2018 ifm electronic, gmbh
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef IFM3D_DEVICE_UTIL_H
8 #define IFM3D_DEVICE_UTIL_H
9 
10 #include <cstdint>
11 #include <ifm3d/device/module_device.h>
12 #include <string>
13 #include <vector>
14 
15 namespace httplib
16 {
17  class Result;
18 }
19 
20 namespace ifm3d
21 {
25  IFM3D_EXPORT std::string& ltrim(std::string& str,
26  const std::string& chars = "\t\n\v\f\r ");
27 
31  IFM3D_EXPORT std::string& rtrim(std::string& str,
32  const std::string& chars = "\t\n\v\f\r ");
33 
37  IFM3D_EXPORT std::string& trim(std::string& str,
38  const std::string& chars = "\t\n\v\f\r ");
39 
43  IFM3D_EXPORT std::vector<std::string> split(const std::string& in,
44  char delim);
45 
46  IFM3D_EXPORT std::string base64_encode(
47  const std::vector<std::uint8_t>& data);
48 
49  IFM3D_EXPORT std::vector<std::uint8_t> base64_decode(
50  const std::string& base64);
51 
52  IFM3D_EXPORT void check_http_result(httplib::Result const& res);
53 
54  IFM3D_EXPORT bool is_stdin_available(int timeout_seconds = 2);
55 
56 } // end: namespace ifm3d
57 
58 #endif // IFM3D_CAMERA_UTIL_H