\r\n

51Degrees Device Detection C/C++  4.4

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 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 
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 #include "common.h"
134 
140 
142 
143 
148 
150 typedef struct fiftyone_degrees_property_available_t {
151  uint32_t propertyIndex;
164 
166 
167 
170 
175 EXTERNAL typedef struct fiftyone_degrees_properties_required_t {
176  const char **array;
179  int count;
180  const char *string;
186 
195 typedef fiftyoneDegreesString*(*fiftyoneDegreesPropertiesGetMethod)(
196  void *state,
197  uint32_t index,
199 
214  void* state,
216  fiftyoneDegreesEvidenceProperties* evidenceProperties);
217 
224 
244  void *state,
245  fiftyoneDegreesPropertiesGetMethod getPropertyMethod,
246  fiftyoneDegreesEvidencePropertiesGetMethod getEvidencePropertiesMethod);
247 
256  const char *propertyName);
257 
268  const char *propertyName);
269 
279  int requiredPropertyIndex);
280 
288 EXTERNAL fiftyoneDegreesString*
291  int requiredPropertyIndex);
292 
301 
307 EXTERNAL void fiftyoneDegreesPropertiesFree(
309 
314 #endif
EXTERNAL_VAR fiftyoneDegreesPropertiesRequired fiftyoneDegreesPropertiesDefault
The default properties required to make all possible properties available.
Definition: properties.h:223
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:176
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
bool delayExecution
True if the execution any JavaScript returned as a value of this property should be delayed.
Definition: properties.h:158
fiftyoneDegreesEvidenceProperties * evidenceProperties
Evidence properties which are required by this property.
Definition: properties.h:154
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:213
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:151
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:109
uint32_t fiftyoneDegreesEvidencePropertyIndex
Index in the properties collection to a property which is required to get evidence for another proper...
Definition: properties.h:139
fiftyoneDegreesCollectionItem name
Name of the property from strings.
Definition: properties.h:153
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:195
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
fiftyoneDegreesPropertiesAvailable * existing
A pointer to an existing set of property names from another instance.
Definition: properties.h:182
bool fiftyoneDegreesPropertiesIsSetHeaderAvailable(fiftyoneDegreesPropertiesAvailable *available)
Check if the 'SetHeader' properties are included in the available required properties.
Defines a set of properties which are required by a caller.
Definition: properties.h:175
int count
Number of properties in array.
Definition: properties.h:179
int fiftyoneDegreesPropertiesGetPropertyIndexFromRequiredIndex(fiftyoneDegreesPropertiesAvailable *available, int requiredPropertyIndex)
Maps the required property index to the index in the source data structure.
#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:180
Array of items of type fiftyoneDegreesEvidencePropertyIndex used to easily access and track the size ...
Definition: properties.h:141
fiftyoneDegreesPropertiesAvailable * fiftyoneDegreesPropertiesCreate(fiftyoneDegreesPropertiesRequired *properties, void *state, fiftyoneDegreesPropertiesGetMethod getPropertyMethod, fiftyoneDegreesEvidencePropertiesGetMethod getEvidencePropertiesMethod)
Creates a properties result instance for use with future property operations.