\r\n

51Degrees Device Detection C/C++  4.5

A device detection library that is used natively or by 51Degrees products

Transform.hpp

1 /* *********************************************************************
2  * This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3  * Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
4  * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5  *
6  * This Original Work is licensed under the European Union Public Licence
7  * (EUPL) v.1.2 and is subject to its terms as set out below.
8  *
9  * If a copy of the EUPL was not distributed with this file, You can obtain
10  * one at https://opensource.org/licenses/EUPL-1.2.
11  *
12  * The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13  * amended by the European Commission) shall be deemed incompatible for
14  * the purposes of the Work and the provisions of the compatibility
15  * clause in Article 5 of the EUPL shall not apply.
16  *
17  * If using the Work as, or as part of, a network application, by
18  * including the attribution notice(s) required under Article 5 of the EUPL
19  * in the end user terms of the application under an appropriate heading,
20  * such notice(s) shall fulfill the requirements of that article.
21  * ********************************************************************* */
22 
23 #ifndef FIFTYONE_DEGREES_TRANSFORM_HPP
24 #define FIFTYONE_DEGREES_TRANSFORM_HPP
25 
26 #include <map>
27 #include <string>
28 #include <vector>
29 
30 #include "transform.h"
31 
48 namespace FiftyoneDegrees {
49  namespace DeviceDetection {
50  class Transform {
51  using Headers = std::map<std::string, std::string>;
52 
53  using CTransformAPI =
55  (const char* base64,
56  char *buffer,
57  size_t length,
58  fiftyoneDegreesKeyValuePairArray* const headers,
59  fiftyoneDegreesException* const exception);
60 
61  Headers apiInvoker(CTransformAPI func, const std::string& json);
62 
63  public:
71  Transform(size_t capacity = 1024);
72 
80  Headers fromJsonGHEV(const std::string& json);
81 
89  Headers fromBase64GHEV(const std::string& base64);
90 
98  Headers fromSUA(const std::string& json);
99 
100  private:
101  std::vector<char> buffer;
102  };
103  } // namespace Common
104 } // namespace FiftyoneDegrees
105 
106 #endif // FIFTYONE_DEGREES_TRANSFORM_HPP
Transform(size_t capacity=1024)
Due to the default param value Transform() ctor is also available in C++ and managed language s....
A C++ wrapper class for transform.h conversion routines.
Definition: ComponentMetaDataBuilderHash.hpp:33
Headers fromBase64GHEV(const std::string &base64)
Convert from the base64 encoded getHighEntropyValues() results JSON string into HTTP header key-value...
Array of items of type fiftyoneDegreesKeyValuePair used to easily access and track the size of the ar...
Definition: pair.h:36
User-Agent Client Hints (UACH) Representation Conversion Routines.
Definition: transform.h:79
Headers fromSUA(const std::string &json)
Convert from the oRTB 2.6 Structured User-Agent JSON string into HTTP header key-value pairs,...
Headers fromJsonGHEV(const std::string &json)
Convert from getHighEntropyValues() results JSON string into HTTP header key-value pairs,...
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition: exceptions.h:111