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

FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection Class Reference

Detailed Description

C++ class wrapper for the fiftyoneDegreesConfigDeviceDetection configuration structure.

See config-dd.h.

This extends the ConfigBase class to add device detection specific configuration options.

Configuration options are set using setter methods and fetched using corresponding getter methods. The names are self explanatory.

Usage Example

using namespace FiftyoneDegrees::Common;
// Construct a new configuration
// Configure the engine to return the matched substrings of a
User-Agent in the results up to a maximum of 500 characters
config->setUpdateMatchedUserAgent(true);
config->setMaxMatchedUserAgentLength(500);
// Use the configuration when constructing an engine
config,
properties);
C++ class wrapper for the fiftyoneDegreesPropertiesRequired structure.
Definition RequiredPropertiesConfig.hpp:59
ConfigDeviceDetection(fiftyoneDegreesConfigDeviceDetection *config)
Constructs a new instance of the configuration with a reference to the C configuration provided.
Encapsulates the device detection engine class to be extended by device detection engine implementati...
Definition EngineDeviceDetection.hpp:84
fiftyoneDegreesConfigDeviceDetection ConfigDeviceDetection
Synonym for fiftyoneDegreesConfigDeviceDetection type.
Definition dd/fiftyone.h:51
Shared classes.
Definition Collection.hpp:31
Device Detection specific classes.
Definition ComponentMetaDataBuilderHash.hpp:34

Inheritance diagram for FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection:

[legend]

Collaboration diagram for FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection:

[legend]

Public Member Functions

Constructors

 ConfigDeviceDetection (fiftyoneDegreesConfigDeviceDetection *config)
 Constructs a new instance of the configuration with a reference to the C configuration provided.

Setters

void setUpdateMatchedUserAgent (bool update)
 Set whether or not the matched User-Agent should be constructed.
void setMaxMatchedUserAgentLength (int length)
 Set the limit in bytes on the length of a single header such as User-Agent, of a pseudo header including the separators between its values, and of the matched User-Agent.
void setAllowUnmatched (bool allow)
 Set whether there should be at least one matched hash node (or substring) in order for the results to be considered valid.
void setProcessSpecialEvidence (bool process)
 Set whether special evidence like getHighEntropyValues, Structured User Agents, or Device Ids, should be checked for during evidence processing.
bool getUpdateMatchedUserAgent ()
 Gets whether the characters matched during processing should be stored in results.
int getMaxMatchedUserAgentLength ()
 Get the limit in bytes on the length of a single header, a pseudo header and the matched User-Agent, as described in setMaxMatchedUserAgentLength.
bool getAllowUnmatched ()
 Get whether there should be at least one matched hash node (or substring) in order for the results to be considered valid.
bool getProcessSpecialEvidence ()
 Get whether special evidence like getHighEntropyValues, Structured User Agents, or Device Ids, should be checked for during evidence processing.

Public Member Functions inherited from FiftyoneDegrees::Common::ConfigBase

 ConfigBase (fiftyoneDegreesConfigBase *config)
 Constructs a new instance of the configuration with a reference to the C configuration provided.
virtual ~ConfigBase ()
 Free any memory associated with temporary directories.
void setUseUpperPrefixHeaders (bool use)
 Set whether or not the HTTP header field might be prefixed with 'HTTP_'.
void setUseTempFile (bool use)
 Set whether or not a temporary file should be created from the original data file and used to initialise the data set.
void setReuseTempFile (bool reuse)
 Set whether or not a temporary file that already exists for a master file should be reused by another process.
void setTempDirectories (vector< string > tempDirs)
 Sets a collection of temporary directories to use if temporary file operation is required in the order in which the directories should be used.
void setPropertyValueIndex (bool index)
 Set whether or not an index to speed up the retrieval of values for profiles and properties is created.
bool getUseUpperPrefixHeaders () const
 Get whether or not an HTTP_ upper case prefixes should be considered when evaluating HTTP headers.
bool getUseTempFile () const
 Get whether or not a temporary file should be created from the original data file and used to initialise the data set.
bool getReuseTempFile () const
 Get whether temporary files can be reused across multiple processes.
vector< string > getTempDirectories () const
 Gets a vector of temporary directory strings which should be used to store temporary files.
bool getPropertyValueIndex () const
 Gets a flag indicating if an index of values for properties and profile is created.
virtual uint16_t getConcurrency () const
 Get the expected number of concurrent accessors of the data set.

Constructor & Destructor Documentation

◆ ConfigDeviceDetection()

FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection::ConfigDeviceDetection ( fiftyoneDegreesConfigDeviceDetection * config)

Constructs a new instance of the configuration with a reference to the C configuration provided.

Parameters
configpointer to the underlying configuration structure

Member Function Documentation

◆ getAllowUnmatched()

bool FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection::getAllowUnmatched ( )

Get whether there should be at least one matched hash node (or substring) in order for the results to be considered valid.

By default, this is false.

Returns
true if results with no matched hash nodes should be considered valid

◆ getMaxMatchedUserAgentLength()

int FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection::getMaxMatchedUserAgentLength ( )

Get the limit in bytes on the length of a single header, a pseudo header and the matched User-Agent, as described in setMaxMatchedUserAgentLength.

Returns
the limit, whether or not the matched User-Agent is stored

◆ getProcessSpecialEvidence()

bool FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection::getProcessSpecialEvidence ( )

Get whether special evidence like getHighEntropyValues, Structured User Agents, or Device Ids, should be checked for during evidence processing.

By default, this is true.

Returns
true if special evidence will be processed

◆ getUpdateMatchedUserAgent()

bool FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection::getUpdateMatchedUserAgent ( )

Gets whether the characters matched during processing should be stored in results.

Returns
true if the characters should be available, otherwise false.

◆ setAllowUnmatched()

void FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection::setAllowUnmatched ( bool allow)

Set whether there should be at least one matched hash node (or substring) in order for the results to be considered valid.

By default, this is false.

Parameters
allowtrue if results with no matched hash nodes should be considered valid

◆ setMaxMatchedUserAgentLength()

void FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection::setMaxMatchedUserAgentLength ( int length)

Set the limit in bytes on the length of a single header such as User-Agent, of a pseudo header including the separators between its values, and of the matched User-Agent.

The working memory for a pseudo header is allocated from this value when a set of results is created, and detection does not grow it. A value longer than the limit is ignored and detection moves on to the next header. A direct User-Agent call over the limit gives the same results as evidence holding that value. The limit applies whether or not setUpdateMatchedUserAgent is true. The default is 500. To raise the limit set a larger value before the engine is created, which also raises the memory each set of results holds.

Parameters
lengthto set

◆ setProcessSpecialEvidence()

void FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection::setProcessSpecialEvidence ( bool process)

Set whether special evidence like getHighEntropyValues, Structured User Agents, or Device Ids, should be checked for during evidence processing.

By default, this is true.

Examples
Hash/GettingStarted.cpp.

◆ setUpdateMatchedUserAgent()

void FiftyoneDegrees::DeviceDetection::ConfigDeviceDetection::setUpdateMatchedUserAgent ( bool update)

Set whether or not the matched User-Agent should be constructed.

This is usually only needed for debugging User-Agents. If this is set to true then setMaxMatchedUserAgentLength must be used to provide the number of characters to record.

Parameters
updateshould update the matched User-Agent

The documentation for this class was generated from the following file: