51Degrees Device Detection C/C++  4.1

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

properties.h

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 
117 #ifndef FIFTYONE_DEGREES_PROPERTIES_H_INCLUDED
118 #define FIFTYONE_DEGREES_PROPERTIES_H_INCLUDED
119 
120 #include <stdint.h>
121 #ifdef _MSC_FULL_VER
122 #include <string.h>
123 #else
124 #include <strings.h>
125 #define _stricmp strcasecmp
126 #define _strnicmp strncasecmp
127 #endif
128 #include "string.h"
129 #include "list.h"
130 #include "data.h"
131 #include "collection.h"
132 #include "array.h"
133 
134 #ifdef __cplusplus
135 #define EXTERNAL extern "C"
136 #else
137 #define EXTERNAL
138 #endif
139 
145 
147 
148 
153 
155 typedef struct fiftyone_degrees_property_available_t {
156  uint32_t propertyIndex;
169 
171 
172 
175 
180 EXTERNAL typedef struct fiftyone_degrees_properties_required_t {
181  const char **array;
184  int count;
185  const char *string;
191 
200 typedef fiftyoneDegreesString*(*fiftyoneDegreesPropertiesGetMethod)(
201  void *state,
202  uint32_t index,
204 
219  void* state,
221  fiftyoneDegreesEvidenceProperties* evidenceProperties);
222 
229 
249  void *state,
250  fiftyoneDegreesPropertiesGetMethod getPropertyMethod,
251  fiftyoneDegreesEvidencePropertiesGetMethod getEvidencePropertiesMethod);
252 
261  const char *propertyName);
262 
273  const char *propertyName);
274 
284  int requiredPropertyIndex);
285 
293 EXTERNAL fiftyoneDegreesString*
296  int requiredPropertyIndex);
297 
303 EXTERNAL void fiftyoneDegreesPropertiesFree(
305 
310 #endif
int fiftyoneDegreesPropertiesGetPropertyIndexFromName(fiftyoneDegreesPropertiesAvailable *available, const char *propertyName)
Gets the index of the property in the source data structure from the name.
fiftyoneDegreesString * fiftyoneDegreesPropertiesGetNameFromRequiredIndex(fiftyoneDegreesPropertiesAvailable *available, int requiredPropertyIndex)
Gets the name as a string from the required property index.
const char ** array
Array of required properties or NULL if all properties are required.
Definition: properties.h:181
Used to store a handle to the underlying item that could be used to release the item when it's finish...
Definition: collection.h:309
bool delayExecution
True if the execution any JavaScript returned as a value of this property should be delayed.
Definition: properties.h:163
fiftyoneDegreesEvidenceProperties * evidenceProperties
Evidence properties which are required by this property.
Definition: properties.h:159
uint32_t(* fiftyoneDegreesEvidencePropertiesGetMethod)(void *state, fiftyoneDegreesPropertyAvailable *property, fiftyoneDegreesEvidenceProperties *evidenceProperties)
Populates the evidence properties structure with the indexes of the properties required by the proper...
Definition: properties.h:218
int fiftyoneDegreesPropertiesGetRequiredPropertyIndexFromName(fiftyoneDegreesPropertiesAvailable *available, const char *propertyName)
Gets the required property index in the list of all required properties from the name.
uint32_t propertyIndex
Index of the property in the collection of all properties.
Definition: properties.h:156
void fiftyoneDegreesPropertiesFree(fiftyoneDegreesPropertiesAvailable *available)
Frees the memory and resources used by the properties results previously created using the fiftyoneDe...
String structure containing its value and size.
Definition: string.h:87
uint32_t fiftyoneDegreesEvidencePropertyIndex
Index in the properties collection to a property which is required to get evidence for another proper...
Definition: properties.h:144
fiftyoneDegreesCollectionItem name
Name of the property from strings.
Definition: properties.h:158
fiftyoneDegreesString *(* fiftyoneDegreesPropertiesGetMethod)(void *state, uint32_t index, fiftyoneDegreesCollectionItem *item)
Returns a string for the property at the index provided or NULL if there is no property available at ...
Definition: properties.h:200
Array of items of type fiftyoneDegreesPropertyAvailable used to easily access and track the size of t...
Definition: properties.h:170
Used to access the property item quickly without the need to search.
Definition: properties.h:155
fiftyoneDegreesPropertiesAvailable * existing
A pointer to an existing set of property names from another instance.
Definition: properties.h:187
Defines a set of properties which are required by a caller.
Definition: properties.h:180
int count
Number of properties in array.
Definition: properties.h:184
int fiftyoneDegreesPropertiesGetPropertyIndexFromRequiredIndex(fiftyoneDegreesPropertiesAvailable *available, int requiredPropertyIndex)
Maps the required property index to the index in the source data structure.
fiftyoneDegreesPropertiesRequired fiftyoneDegreesPropertiesDefault
The default properties required to make all possible properties available.
Definition: properties.h:228
#define FIFTYONE_DEGREES_ARRAY_TYPE(t, m)
Simple array structure definition macro used for generic types.
Definition: array.h:48
const char * string
Separated list of required properties or NULL if all properties are required.
Definition: properties.h:185
Array of items of type fiftyoneDegreesEvidencePropertyIndex used to easily access and track the size ...
Definition: properties.h:146
fiftyoneDegreesPropertiesAvailable * fiftyoneDegreesPropertiesCreate(fiftyoneDegreesPropertiesRequired *properties, void *state, fiftyoneDegreesPropertiesGetMethod getPropertyMethod, fiftyoneDegreesEvidencePropertiesGetMethod getEvidencePropertiesMethod)
Creates a properties result instance for use with future property operations.