\r\n

51Degrees Device Detection C/C++  4.3

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

profile.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_PROFILE_H_INCLUDED
24 #define FIFTYONE_DEGREES_PROFILE_H_INCLUDED
25 
66 #include <stdint.h>
67 #ifdef _MSC_VER
68 #pragma warning (push)
69 #pragma warning (disable: 5105)
70 #include <windows.h>
71 #pragma warning (default: 5105)
72 #pragma warning (pop)
73 #endif
74 #include "data.h"
75 #include "exceptions.h"
76 #include "collection.h"
77 #include "string.h"
78 #include "component.h"
79 #include "property.h"
80 #include "value.h"
81 
82 #ifdef __cplusplus
83 #define EXTERNAL extern "C"
84 #else
85 #define EXTERNAL
86 #endif
87 
92 #pragma pack(push, 1)
93 typedef struct fiftyoneDegrees_profile_t {
94  const byte componentIndex;
96  const uint32_t profileId;
97  const uint32_t valueCount;
99 #pragma pack(pop)
100 
107 #pragma pack(push, 4)
108 typedef struct fiftyoneDegrees_profile_offset_t {
109  const uint32_t profileId;
110  const uint32_t offset;
112 #pragma pack(pop)
113 
122  void *state,
124 
138  fiftyoneDegreesCollection *profileOffsets,
139  fiftyoneDegreesCollection *profiles,
140  const uint32_t profileId,
142  fiftyoneDegreesException *exception);
143 
159  fiftyoneDegreesCollection *profileOffsets,
160  fiftyoneDegreesCollection *profiles,
161  uint32_t index,
163  fiftyoneDegreesException *exception);
164 
165 #ifndef FIFTYONE_DEGREES_MEMORY_ONLY
166 
178  const fiftyoneDegreesCollectionFile *file,
179  uint32_t offset,
180  fiftyoneDegreesData *data,
181  fiftyoneDegreesException *exception);
182 #endif
183 
198  fiftyoneDegreesProfile *profile,
199  fiftyoneDegreesProperty *property,
200  void *state,
202  fiftyoneDegreesException *exception);
203 
223  fiftyoneDegreesCollection *strings,
224  fiftyoneDegreesCollection *properties,
226  fiftyoneDegreesCollection *profiles,
227  fiftyoneDegreesCollection *profileOffsets,
228  const char *propertyName,
229  const char* valueName,
230  void *state,
232  fiftyoneDegreesException *exception);
233 
245  fiftyoneDegreesCollection *profileOffsets,
246  const uint32_t profileId,
247  uint32_t *profileOffset,
248  fiftyoneDegreesException *exception);
249 
254 #endif
const byte componentIndex
The index of the component the profile relates to.
Definition: profile.h:94
const uint32_t profileId
The unique Id of the profile.
Definition: profile.h:109
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
uint32_t fiftyoneDegreesProfileIterateValuesForProperty(fiftyoneDegreesCollection *values, fiftyoneDegreesProfile *profile, fiftyoneDegreesProperty *property, void *state, fiftyoneDegreesProfileIterateMethod callback, fiftyoneDegreesException *exception)
Iterate over all values contained in the profile which relate to the specified property,...
Structure containing the unique id of the profile, and the offset needed to retrieve the actual profi...
Definition: profile.h:108
fiftyoneDegreesProfile * fiftyoneDegreesProfileGetByProfileId(fiftyoneDegreesCollection *profileOffsets, fiftyoneDegreesCollection *profiles, const uint32_t profileId, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Gets the profile associated with the profileId or NULL if there is no corresponding profile.
Type of collection where the collection is streamed from file.
Definition: collection.h:446
uint32_t fiftyoneDegreesProfileIterateProfilesForPropertyAndValue(fiftyoneDegreesCollection *strings, fiftyoneDegreesCollection *properties, fiftyoneDegreesCollection *values, fiftyoneDegreesCollection *profiles, fiftyoneDegreesCollection *profileOffsets, const char *propertyName, const char *valueName, void *state, fiftyoneDegreesProfileIterateMethod callback, fiftyoneDegreesException *exception)
Iterate all profiles which contain the specified value, calling the callback method for each.
fiftyoneDegreesProfile * fiftyoneDegreesProfileGetByIndex(fiftyoneDegreesCollection *profileOffsets, fiftyoneDegreesCollection *profiles, uint32_t index, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Gets a pointer to the profile at the index provided.
Data structure used for reusing memory which may have been allocated in a previous operation.
Definition: data.h:106
const uint32_t offset
Offset to the profile in the profiles structure.
Definition: profile.h:110
Property structure containing all the meta data relating to a property.
Definition: property.h:90
const uint32_t valueCount
The number of values within the profile.
Definition: profile.h:97
uint32_t * fiftyoneDegreesProfileGetOffsetForProfileId(fiftyoneDegreesCollection *profileOffsets, const uint32_t profileId, uint32_t *profileOffset, fiftyoneDegreesException *exception)
Gets the offset in the profiles collection for the profile with the profileId or NULL if there is no ...
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition: exceptions.h:116
void * fiftyoneDegreesProfileReadFromFile(const fiftyoneDegreesCollectionFile *file, uint32_t offset, fiftyoneDegreesData *data, fiftyoneDegreesException *exception)
Read a profile from the file collection provided and store in the data pointer.
bool(* fiftyoneDegreesProfileIterateMethod)(void *state, fiftyoneDegreesCollectionItem *item)
Definition of a callback function which is passed an item of a type determined by the iteration metho...
Definition: profile.h:121
Encapsulates a profile stored within a data set.
Definition: profile.h:93
const uint32_t profileId
Unique id of the profile.
Definition: profile.h:96
All the shared methods and fields required by file, memory and cached collections.
Definition: collection.h:409