\r\n

51Degrees Device Detection C/C++  4.4

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 2023 51 Degrees Mobile Experts Limited, Davidson House,
4  * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5  *
6  * This Original Work is licensed under the European Union Public Licence
7  * (EUPL) 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 #include "common.h"
79 
83 typedef struct fiftyone_degrees_override_property_t {
88 
93 typedef struct fiftyone_degrees_override_value_t {
98 
101  bool prefix;
103 );
104 
109 
115 
123  void *state,
124  uint32_t profileId);
125 
135  void *state,
136  uint32_t requiredPropertyIndex);
137 
144  uint32_t capacity);
145 
159  bool prefix,
160  void *state,
162 
169 
181 
194  uint32_t requiredPropertyIndex);
195 
205  uint32_t requiredPropertyIndex,
206  fiftyoneDegreesList *list);
207 
216 EXTERNAL bool fiftyoneDegreesOverridesAdd(
218  int requiredPropertyIndex,
219  const char *value);
220 
231  uint32_t requiredPropertyIndex,
233 
245  uint32_t requiredPropertyIndex);
246 
253 
261 
271  void *state,
273 
278 #endif
An array of properties and values to use when getting override values.
Definition: overrides.h:108
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:310
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:134
uint32_t requiredPropertyIndex
Index in the available properties structure.
Definition: overrides.h:84
String value which should override the value for the property indicated by the required property inde...
Definition: overrides.h:93
String structure containing its value and size.
Definition: string.h:109
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:101
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:96
Array of items of type fiftyoneDegreesPropertyAvailable used to easily access and track the size of t...
Definition: properties.h:165
Used to access the property item quickly without the need to search.
Definition: properties.h:150
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 fiftyoneDegreesOverrideValuesReset(fiftyoneDegreesOverrideValueArray *values)
Reset override array.
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:122
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:112
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:86
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...
Definition: GettingStarted.c:65
#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:83
fiftyoneDegreesOverridePropertyArray fiftyoneDegreesOverridable
Array of overridable properties.
Definition: overrides.h:108
Array of items of type fiftyoneDegreesOverrideProperty used to easily access and track the size of th...
Definition: overrides.h:103
uint32_t requiredPropertyIndex
Index in the available properties structure.
Definition: overrides.h:94