\r\n

51Degrees Device Detection C/C++  4.4

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

EngineHash.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_ENGINE_HASH_HPP
24 #define FIFTYONE_DEGREES_ENGINE_HASH_HPP
25 
26 #include <sstream>
27 #include "../common-cxx/resource.h"
28 #include "../EvidenceDeviceDetection.hpp"
29 #include "../EngineDeviceDetection.hpp"
30 #include "../common-cxx/RequiredPropertiesConfig.hpp"
31 #include "../common-cxx/Date.hpp"
32 #include "../common-cxx/overrides.h"
33 #include "ConfigHash.hpp"
34 #include "ResultsHash.hpp"
35 #include "MetaDataHash.hpp"
36 
37 using namespace FiftyoneDegrees::Common;
38 
39 namespace FiftyoneDegrees {
40  namespace DeviceDetection {
41  namespace Hash {
95  friend class ::EngineHashTests;
96  public:
108  EngineHash(
109  const char *fileName,
110  ConfigHash *config,
111  RequiredPropertiesConfig *properties);
112 
119  EngineHash(
120  const string &fileName,
121  ConfigHash *config,
122  RequiredPropertiesConfig *properties);
123 
131  EngineHash(
132  void *data,
133  long length,
134  ConfigHash *config,
135  RequiredPropertiesConfig *properties);
136 
144  EngineHash(
145  unsigned char data[],
146  long length,
147  ConfigHash *config,
148  RequiredPropertiesConfig *properties);
149 
160 
164  ResultsHash* process(const char *userAgent) const;
165 
172  void refreshData() const;
173 
174  void refreshData(const char *fileName) const;
175 
176  void refreshData(void *data, long length) const;
177 
178  void refreshData(unsigned char data[], long length) const;
179 
180  ResultsBase* processBase(EvidenceBase *evidence) const;
181 
182  Date getPublishedTime() const;
183 
184  Date getUpdateAvailableTime() const;
185 
186  string getDataFilePath() const;
187 
188  string getDataFileTempPath() const;
189 
190  string getProduct() const;
191 
192  string getType() const;
193 
200  ResultsDeviceDetection* processDeviceDetection(
202 
203  ResultsDeviceDetection* processDeviceDetection(
204  const char *userAgent) const;
205 
210  protected:
211  /*
212  * Using the super class init function here
213  * so that it is not hidden by the overloaded
214  * functions.
215  */
216  using EngineDeviceDetection::init;
220  void init(fiftyoneDegreesDataSetHash *dataSet);
221 
222  private:
223  void initMetaData();
224 
225  void init();
226 
227  void* copyData(void *data, size_t length) const;
228  };
229  }
230  }
231 }
232 
233 #endif
Base evidence class containing evidence to be processed by an engine.
Definition: EvidenceBase.hpp:67
The Date class wraps the C fiftyoneDegreesDate structure and is used to represent dates in engines.
Definition: Date.hpp:48
Encapsulates the results of a Hash device detection engine's processing.
Definition: ResultsHash.hpp:64
Encapsulates the Hash engine class which implements EngineDeviceDetection.
Definition: EngineHash.hpp:94
51Degrees base namespace.
Definition: ComponentMetaDataBuilderHash.hpp:33
C++ class wrapper for the fiftyoneDegreesConfigHash configuration structure.
Definition: ConfigHash.hpp:72
Data set structure containing all the components used for detections.
Definition: hash.h:295
Device detection specific evidence class containing evidence to be processed by a device detection en...
Definition: EvidenceDeviceDetection.hpp:64
C++ class wrapper for the fiftyoneDegreesPropertiesRequired structure.
Definition: RequiredPropertiesConfig.hpp:58
Encapsulates the results of a device detection engine's processing.
Definition: ResultsDeviceDetection.hpp:76
Definition: GettingStarted.c:63
Shared classes.
Definition: Collection.hpp:31
Encapsulates the results of an engine's processing.
Definition: ResultsBase.hpp:82
Encapsulates the device detection engine class to be extended by device detection engine implementati...
Definition: EngineDeviceDetection.hpp:84