51Degrees Device Detection C/C++  4.1

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 2019 51 Degrees Mobile Experts Limited, 5 Charlotte Close,
4  * Caversham, Reading, Berkshire, United Kingdom RG4 7BY.
5  *
6  * This Original Work is licensed under the European Union Public Licence (EUPL)
7  * 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 std;
38 using namespace FiftyoneDegrees::Common;
39 
40 namespace FiftyoneDegrees {
41  namespace DeviceDetection {
42  namespace Hash {
96  friend class ::EngineHashTests;
97  public:
109  EngineHash(
110  const char *fileName,
111  ConfigHash *config,
112  RequiredPropertiesConfig *properties);
113 
120  EngineHash(
121  const string &fileName,
122  ConfigHash *config,
123  RequiredPropertiesConfig *properties);
124 
132  EngineHash(
133  void *data,
134  long length,
135  ConfigHash *config,
136  RequiredPropertiesConfig *properties);
137 
145  EngineHash(
146  unsigned char data[],
147  long length,
148  ConfigHash *config,
149  RequiredPropertiesConfig *properties);
150 
160  ResultsHash* process(EvidenceDeviceDetection *evidence);
161 
165  ResultsHash* process(const char *userAgent);
166 
173  void refreshData();
174 
175  void refreshData(const char *fileName);
176 
177  void refreshData(void *data, long length);
178 
179  void refreshData(unsigned char data[], long length);
180 
181  ResultsBase* processBase(EvidenceBase *evidence);
182 
183  Date getPublishedTime();
184 
185  Date getUpdateAvailableTime();
186 
187  string getDataFilePath();
188 
189  string getDataFileTempPath();
190 
191  string getProduct();
192 
193  string getType();
194 
201  ResultsDeviceDetection* processDeviceDetection(
202  EvidenceDeviceDetection *evidence);
203 
204  ResultsDeviceDetection* processDeviceDetection(
205  const char *userAgent);
206 
211  protected:
215  void init(fiftyoneDegreesDataSetHash *dataSet);
216 
217  private:
218  void initMetaData();
219 
220  void init();
221 
222  void* copyData(void *data, size_t length);
223  };
224  }
225  }
226 }
227 
228 #endif
Base evidence class containing evidence to be processed by an engine.
Definition: EvidenceBase.hpp:64
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:65
Encapsulates the Hash engine class which implements EngineDeviceDetection.
Definition: EngineHash.hpp:95
51Degrees base namespace.
Definition: ComponentMetaDataBuilderHash.hpp:34
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:291
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:57
Encapsulates the results of a device detection engine's processing.
Definition: ResultsDeviceDetection.hpp:76
Shared classes.
Definition: Collection.hpp:32
Encapsulates the results of an engine's processing.
Definition: ResultsBase.hpp:81
Encapsulates the device detection engine class to be extended by device detection engine implementati...
Definition: EngineDeviceDetection.hpp:84