\r\n

51Degrees Device Detection C/C++  4.4

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

FiftyoneDegrees::DeviceDetection::ResultsDeviceDetection Class Reference abstract

Detailed Description

Encapsulates the results of a device detection engine's processing.

The class is constructed using an instance of a C fiftyoneDegreesResultsDeviceDetection structure which are then referenced to return associated values and metrics. Any memory used by the results is freed by the extending class.

Additional get methods are included on top of the base methods to return device detection specific metrics.

Results instances should only be created by an Engine.

The key used to get the value for a property can be either the name of the property, or the index of the property in the required properties structure.

Results instances should only be created by a Engine.

Usage Example

// Iterate over all User-Agent indexes
for (int i = 0; i < results->getUserAgents(); i++) {
// Get the matched substrings of the User-Agent
string matchedUserAgent = results->getUserAgent(i);
// Do something with the string
// ...
}
// Get the device id for the device
string deviceId = results->getDeviceId();
// Delete the results
delete results;

Inheritance diagram for FiftyoneDegrees::DeviceDetection::ResultsDeviceDetection:

[legend]

Collaboration diagram for FiftyoneDegrees::DeviceDetection::ResultsDeviceDetection:

[legend]

Public Member Functions

Constructor

 ResultsDeviceDetection (fiftyoneDegreesResultsDeviceDetection *results, shared_ptr< fiftyoneDegreesResourceManager > manager)
Create a new instance of Results from the results structure provided. More...

Metric Getters

virtual string  getDeviceId () const =0
Returns the unique device id if the Id property was included in the required list of properties when the Provider was constructed. More...
virtual int  getUserAgents () const =0
Returns the number of different User-Agents that were used in the results. More...
virtual string  getUserAgent (int resultIndex) const =0
Returns relevant parts of the User-Agent which most closely matched the target User-Agent if the ConfigDeviceDetection::setUpdateMatchedUserAgent flag was set to true in the configuration. More...

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

 ResultsBase (fiftyoneDegreesResultsBase *results, shared_ptr< fiftyoneDegreesResourceManager > manager)
Create a new instance of Results from the results structure provided. More...
virtual  ~ResultsBase ()
Free any memory associated with the results and release any resource handles.
int  getAvailableProperties () const
Get the number of available properties contained in the Results instance. More...
bool  containsProperty (const string &propertyName) const
Get whether or not this results instance contains a value for the requested property. More...
vector< string >  getProperties () const
Get the names of the properties which are available in the Results instance. More...
string  getPropertyName (int requiredPropertyIndex) const
Get the name of the property at the require property index, or an empty string if the required property index is invalid. More...
Value< vector< string > >  getValues (const char *propertyName)
Get a vector with all values associated with the required property name. More...
Value< vector< string > >  getValues (const string &propertyName)
Get a vector with all values associated with the required property name. More...
Value< vector< string > >  getValues (const string *propertyName)
Get a vector with all values associated with the required property name. More...
Value< vector< string > >  getValues (int requiredPropertyIndex)
Get a vector with all values associated with the required property index. More...
Value< string >  getValueAsString (const char *propertyName)
Get a string representation of the value associated with the required property name. More...
Value< string >  getValueAsString (const string &propertyName)
Get a string representation of the value associated with the required property name. More...
Value< string >  getValueAsString (const string *propertyName)
Get a string representation of the value associated with the required property name. More...
virtual Value< string >  getValueAsString (int requiredPropertyIndex)
Get a string representation of the value associated with the required property index. More...
Value< bool >  getValueAsBool (const char *propertyName)
Get a boolean representation of the value associated with the required property name. More...
Value< bool >  getValueAsBool (const string &propertyName)
Get a boolean representation of the value associated with the required property name. More...
Value< bool >  getValueAsBool (const string *propertyName)
Get a boolean representation of the value associated with the required property name. More...
virtual Value< bool >  getValueAsBool (int requiredPropertyIndex)
Get a boolean representation of the value associated with the required property index. More...
Value< int >  getValueAsInteger (const char *propertyName)
Get an integer representation of the value associated with the required property name. More...
Value< int >  getValueAsInteger (const string &propertyName)
Get an integer representation of the value associated with the required property name. More...
Value< int >  getValueAsInteger (const string *propertyName)
Get an integer representation of the value associated with the required property name. More...
virtual Value< int >  getValueAsInteger (int requiredPropertyIndex)
Get an integer representation of the value associated with the required property index. More...
Value< double >  getValueAsDouble (const char *propertyName)
Get a double representation of the value associated with the required property name. More...
Value< double >  getValueAsDouble (const string &propertyName)
Get a double representation of the value associated with the required property name. More...
Value< double >  getValueAsDouble (const string *propertyName)
Get a double representation of the value associated with the required property name. More...
virtual Value< double >  getValueAsDouble (int requiredPropertyIndex)
Get a double representation of the value associated with the required property index. More...

Friends

class  ::EngineDeviceDetectionTests

Constructor & Destructor Documentation

◆ ResultsDeviceDetection()

FiftyoneDegrees::DeviceDetection::ResultsDeviceDetection::ResultsDeviceDetection ( fiftyoneDegreesResultsDeviceDetection *   results,
shared_ptr< fiftyoneDegreesResourceManager >   manager  
)

Create a new instance of Results from the results structure provided.

This method should only be called from inside an engine's process method.

Parameters
results - pointer to the underlying results structure
manager - shared pointer to the manager which manages the data set used to create the results. This is needed for thread-safe operation, see local variable description for more info.

Member Function Documentation

◆ getDeviceId()

virtual string FiftyoneDegrees::DeviceDetection::ResultsDeviceDetection::getDeviceId ( ) const
pure virtual

Returns the unique device id if the Id property was included in the required list of properties when the Provider was constructed.

Returns
profile ids separated with a '-' character

Implemented in FiftyoneDegrees::DeviceDetection::Hash::ResultsHash.

◆ getUserAgents()

virtual int FiftyoneDegrees::DeviceDetection::ResultsDeviceDetection::getUserAgents ( ) const
pure virtual

Returns the number of different User-Agents that were used in the results.

Returns
the number of User-Agents available to query with getUserAgent

Implemented in FiftyoneDegrees::DeviceDetection::Hash::ResultsHash.


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