51Degrees Common C/C++  4.1

A shared functionality library that is used by 51Degrees products

overrides.h

1 /* *********************************************************************
2  * This Source Code Form 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 Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0.
8  *
9  * If a copy of the MPL was not distributed with this file, You can obtain
10  * one at http://mozilla.org/MPL/2.0/.
11  *
12  * This Source Code Form is "Incompatible With Secondary Licenses", as
13  * defined by the Mozilla Public License, v. 2.0.
14  * ******************************************************************** */
15 
16 #ifndef FIFTYONE_DEGREES_OVERRIDES_INCLUDED
17 #define FIFTYONE_DEGREES_OVERRIDES_INCLUDED
18 
63 #include <stdint.h>
64 #include <stdbool.h>
65 #include "data.h"
66 #include "string.h"
67 #include "collection.h"
68 #include "properties.h"
69 #include "evidence.h"
70 #include "array.h"
71 
75 typedef struct fiftyone_degrees_override_property_t {
80 
85 typedef struct fiftyone_degrees_override_value_t {
90 
93  bool prefix;
95 );
96 
101 
107 
115  void *state,
116  uint32_t profileId);
117 
127  void *state,
128  uint32_t requiredPropertyIndex);
129 
136  uint32_t capacity);
137 
151  bool prefix,
152  void *state,
154 
161 
173 
186  uint32_t requiredPropertyIndex);
187 
197  uint32_t requiredPropertyIndex,
198  fiftyoneDegreesList *list);
199 
210  int requiredPropertyIndex,
211  const char *value);
212 
223  uint32_t requiredPropertyIndex,
225 
237  uint32_t requiredPropertyIndex);
238 
245 
255  void *state,
257 
262 #endif
An array of properties and values to use when getting override values.
Definition: overrides.h:100
bool fiftyoneDegreesOverrideHasValueForRequiredPropertyIndex(fiftyoneDegreesOverrideValueArray *values, uint32_t requiredPropertyIndex)
Gets whether or not the override values contain an override relating to the property identified by th...
Definition: overrides.c:292
Used to store a handle to the underlying item that could be used to release the item when it's finish...
Definition: collection.h:302
int fiftyoneDegreesOverridesGetOverridingRequiredPropertyIndex(fiftyoneDegreesPropertiesAvailable *available, uint32_t requiredPropertyIndex)
Gets the required property index of a property that MIGHT provide logic such as JavaScript or Regular...
Definition: overrides.c:347
bool(* fiftyoneDegreesOverridesFilterMethod)(void *state, uint32_t requiredPropertyIndex)
Determines if the required property index is eligible for overriding considering the configuration of...
Definition: overrides.h:126
uint32_t requiredPropertyIndex
Index in the available properties structure.
Definition: overrides.h:76
String value which should override the value for the property indicated by the required property inde...
Definition: overrides.h:85
String structure containing its value and size.
Definition: string.h:80
void fiftyoneDegreesOverrideValuesFree(fiftyoneDegreesOverrideValueArray *values)
Frees the memory used for the override values.
Definition: overrides.c:366
Data structure used for reusing memory which may have been allocated in a previous operation.
Definition: data.h:99
void fiftyoneDegreesOverrideProfileIds(fiftyoneDegreesEvidenceKeyValuePairArray *evidence, void *state, fiftyoneDegreesOverrideProfileIdMethod override)
Extracts the profile overrides from the evidence and overrides them using the override method supplie...
Definition: overrides.c:410
void fiftyoneDegreesOverridePropertiesFree(fiftyoneDegreesOverridePropertyArray *properties)
Frees the resources used by the override properties.
Definition: overrides.c:242
uint32_t fiftyoneDegreesOverridesExtractFromEvidence(fiftyoneDegreesOverridePropertyArray *properties, fiftyoneDegreesOverrideValueArray *values, fiftyoneDegreesEvidenceKeyValuePairArray *evidence)
Extracts override values from evidence.
Definition: overrides.c:247
fiftyoneDegreesData string
Overridden value.
Definition: overrides.h:88
Array of items of type fiftyoneDegreesPropertyAvailable used to easily access and track the size of t...
Definition: properties.h:140
Used to access the property item quickly without the need to search.
Definition: properties.h:134
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.
Definition: overrides.c:225
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:114
uint32_t fiftyoneDegreesOverrideValuesAdd(fiftyoneDegreesOverrideValueArray *values, uint32_t requiredPropertyIndex, fiftyoneDegreesList *list)
Adds values from the overrides data structure into the results.
Definition: overrides.c:310
List structure which contains a list of collection items.
Definition: list.h:110
Array of items of type fiftyoneDegreesEvidenceKeyValuePair used to easily access and track the size o...
Definition: evidence.h:165
fiftyoneDegreesOverrideValueArray * fiftyoneDegreesOverrideValuesCreate(uint32_t capacity)
Creates a fresh array of override values with the given capacity.
Definition: overrides.c:209
bool fiftyoneDegreesOverridesAdd(fiftyoneDegreesOverrideValueArray *values, int requiredPropertyIndex, const char *value)
Add an value override to the override values array.
Definition: overrides.c:122
fiftyoneDegreesPropertyAvailable * available
Pointer to the property.
Definition: overrides.h:78
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: overrides.c:266
#define FIFTYONE_DEGREES_ARRAY_TYPE(t, m)
Simple array structure definition macro used for generic types.
Definition: array.h:41
Index and pointer to a property which can be overridden.
Definition: overrides.h:75
fiftyoneDegreesOverridePropertyArray fiftyoneDegreesOverridable
Array of overridable properties.
Definition: overrides.h:100
Array of items of type fiftyoneDegreesOverrideProperty used to easily access and track the size of th...
Definition: overrides.h:95
uint32_t requiredPropertyIndex
Index in the available properties structure.
Definition: overrides.h:86