51Degrees Device Detection C/C++  4.1

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

overrides.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 
23 #ifndef FIFTYONE_DEGREES_OVERRIDES_INCLUDED
24 #define FIFTYONE_DEGREES_OVERRIDES_INCLUDED
25 
70 #include <stdint.h>
71 #include <stdbool.h>
72 #include "data.h"
73 #include "string.h"
74 #include "collection.h"
75 #include "properties.h"
76 #include "evidence.h"
77 #include "array.h"
78 
82 typedef struct fiftyone_degrees_override_property_t {
87 
92 typedef struct fiftyone_degrees_override_value_t {
97 
100  bool prefix;
102 );
103 
108 
114 
122  void *state,
123  uint32_t profileId);
124 
134  void *state,
135  uint32_t requiredPropertyIndex);
136 
143  uint32_t capacity);
144 
158  bool prefix,
159  void *state,
161 
168 
180 
193  uint32_t requiredPropertyIndex);
194 
204  uint32_t requiredPropertyIndex,
205  fiftyoneDegreesList *list);
206 
217  int requiredPropertyIndex,
218  const char *value);
219 
230  uint32_t requiredPropertyIndex,
232 
244  uint32_t requiredPropertyIndex);
245 
252 
262  void *state,
264 
269 #endif
An array of properties and values to use when getting override values.
Definition: overrides.h:107
bool fiftyoneDegreesOverrideHasValueForRequiredPropertyIndex(fiftyoneDegreesOverrideValueArray *values, uint32_t requiredPropertyIndex)
Gets whether or not the override values contain an override relating to the property identified by th...
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
int fiftyoneDegreesOverridesGetOverridingRequiredPropertyIndex(fiftyoneDegreesPropertiesAvailable *available, uint32_t requiredPropertyIndex)
Gets the required property index of a property that MIGHT provide logic such as JavaScript or Regular...
bool(* fiftyoneDegreesOverridesFilterMethod)(void *state, uint32_t requiredPropertyIndex)
Determines if the required property index is eligible for overriding considering the configuration of...
Definition: overrides.h:133
uint32_t requiredPropertyIndex
Index in the available properties structure.
Definition: overrides.h:83
String value which should override the value for the property indicated by the required property inde...
Definition: overrides.h:92
String structure containing its value and size.
Definition: string.h:87
void fiftyoneDegreesOverrideValuesFree(fiftyoneDegreesOverrideValueArray *values)
Frees the memory used for the override values.
Data structure used for reusing memory which may have been allocated in a previous operation.
Definition: data.h:106
void fiftyoneDegreesOverrideProfileIds(fiftyoneDegreesEvidenceKeyValuePairArray *evidence, void *state, fiftyoneDegreesOverrideProfileIdMethod override)
Extracts the profile overrides from the evidence and overrides them using the override method supplie...
void fiftyoneDegreesOverridePropertiesFree(fiftyoneDegreesOverridePropertyArray *properties)
Frees the resources used by the override properties.
uint32_t fiftyoneDegreesOverridesExtractFromEvidence(fiftyoneDegreesOverridePropertyArray *properties, fiftyoneDegreesOverrideValueArray *values, fiftyoneDegreesEvidenceKeyValuePairArray *evidence)
Extracts override values from evidence.
fiftyoneDegreesData string
Overridden value.
Definition: overrides.h:95
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
fiftyoneDegreesOverridePropertyArray * fiftyoneDegreesOverridePropertiesCreate(fiftyoneDegreesPropertiesAvailable *available, bool prefix, void *state, fiftyoneDegreesOverridesFilterMethod filter)
Returns a list of the evidence keys that are available to support overriding property values.
void(* fiftyoneDegreesOverrideProfileIdMethod)(void *state, uint32_t profileId)
Called when a profile Id has been found and should override the one found from another source such as...
Definition: overrides.h:121
uint32_t fiftyoneDegreesOverrideValuesAdd(fiftyoneDegreesOverrideValueArray *values, uint32_t requiredPropertyIndex, fiftyoneDegreesList *list)
Adds values from the overrides data structure into the results.
List structure which contains a list of collection items.
Definition: list.h:117
Array of items of type fiftyoneDegreesEvidenceKeyValuePair used to easily access and track the size o...
Definition: evidence.h:172
fiftyoneDegreesOverrideValueArray * fiftyoneDegreesOverrideValuesCreate(uint32_t capacity)
Creates a fresh array of override values with the given capacity.
bool fiftyoneDegreesOverridesAdd(fiftyoneDegreesOverrideValueArray *values, int requiredPropertyIndex, const char *value)
Add an value override to the override values array.
fiftyoneDegreesPropertyAvailable * available
Pointer to the property.
Definition: overrides.h:85
fiftyoneDegreesString * fiftyoneDegreesOverrideValuesGetFirst(fiftyoneDegreesOverrideValueArray *values, uint32_t requiredPropertyIndex, fiftyoneDegreesCollectionItem *item)
Returns the first value for the required property index or NULL of no value exists for the property i...
#define FIFTYONE_DEGREES_ARRAY_TYPE(t, m)
Simple array structure definition macro used for generic types.
Definition: array.h:48
Index and pointer to a property which can be overridden.
Definition: overrides.h:82
fiftyoneDegreesOverridePropertyArray fiftyoneDegreesOverridable
Array of overridable properties.
Definition: overrides.h:107
Array of items of type fiftyoneDegreesOverrideProperty used to easily access and track the size of th...
Definition: overrides.h:102
uint32_t requiredPropertyIndex
Index in the available properties structure.
Definition: overrides.h:93