\r\n

51Degrees Device Detection C/C++  4.5

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

component.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_COMPONENT_H_INCLUDED
24 #define FIFTYONE_DEGREES_COMPONENT_H_INCLUDED
25 
49 #include <stdint.h>
50 #ifdef _MSC_VER
51 #pragma warning (push)
52 #pragma warning (disable: 5105)
53 #include <windows.h>
54 #pragma warning (default: 5105)
55 #pragma warning (pop)
56 #endif
57 #include "data.h"
58 #include "exceptions.h"
59 #include "collection.h"
60 #include "list.h"
61 #include "string.h"
62 #include "common.h"
63 #include "headers.h"
64 
70 typedef struct fiftyoneDegrees_component_keyvaluepair_t {
71  uint32_t key;
72  uint32_t value;
74 
79 #pragma pack(push, 1)
80 typedef struct fiftyoneDegrees_component_t {
81  const byte componentId;
82  const int32_t nameOffset;
84  const int32_t defaultProfileOffset;
86  const uint16_t keyValuesCount;
92 #pragma pack(pop)
93 
99 EXTERNAL uint32_t fiftyoneDegreesComponentGetFinalSize(
100  const void *initial,
101  fiftyoneDegreesException *exception);
114  fiftyoneDegreesCollection *stringsCollection,
115  fiftyoneDegreesComponent *component,
117  fiftyoneDegreesException *exception);
118 
131  fiftyoneDegreesComponent *component,
132  uint16_t index,
133  fiftyoneDegreesException *exception);
134 
145  fiftyoneDegreesCollection *components,
146  fiftyoneDegreesList *list,
147  uint32_t count,
148  fiftyoneDegreesException *exception);
149 
150 #ifndef FIFTYONE_DEGREES_MEMORY_ONLY
151 
163  const fiftyoneDegreesCollectionFile *file,
164  const fiftyoneDegreesCollectionKey *key,
165  fiftyoneDegreesData *data,
166  fiftyoneDegreesException *exception);
167 
168 #endif
169 
179  fiftyoneDegreesCollection *profiles,
180  fiftyoneDegreesComponent *component,
181  fiftyoneDegreesException *exception);
182 
192  fiftyoneDegreesComponent* component,
193  fiftyoneDegreesHeaders* headers,
194  fiftyoneDegreesException* exception);
195 
200 #endif
uint32_t key
Integer key.
Definition: component.h:71
A component of a data set.
Definition: component.h:80
const int32_t nameOffset
Offset in the strings data structure to the name.
Definition: component.h:82
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 fiftyoneDegreesComponentGetFinalSize(const void *initial, fiftyoneDegreesException *exception)
Gets size of Component with trailing key-value pair.
uint32_t fiftyoneDegreesComponentGetDefaultProfileId(fiftyoneDegreesCollection *profiles, fiftyoneDegreesComponent *component, fiftyoneDegreesException *exception)
Get the default profile id for the component provided.
Type of collection where the collection is streamed from file.
Definition: collection.h:438
Key value pair contained in each component.
Definition: component.h:70
const fiftyoneDegreesComponentKeyValuePair * fiftyoneDegreesComponentGetKeyValuePair(fiftyoneDegreesComponent *component, uint16_t index, fiftyoneDegreesException *exception)
Get a pointer to the key value pair at the specified index within the component's key value pairs lis...
Definition: string.h:93
Data structure used for reusing memory which may have been allocated in a previous operation.
Definition: data.h:101
const byte componentId
The unique Id of the component.
Definition: component.h:81
uint32_t value
Integer value.
Definition: component.h:72
void fiftyoneDegreesComponentInitList(fiftyoneDegreesCollection *components, fiftyoneDegreesList *list, uint32_t count, fiftyoneDegreesException *exception)
Initialises the list of components.
const uint16_t keyValuesCount
The number of key value pairs at firstKeyValuePair.
Definition: component.h:86
Array of header indexes.
Definition: headers.h:131
Array of Headers which should always be ordered in ascending order of fullHeaderId.
Definition: headers.h:167
const fiftyoneDegreesComponentKeyValuePair firstKeyValuePair
The first key value pair.
Definition: component.h:88
fiftyoneDegreesHeaderPtrs * fiftyoneDegreesComponentGetHeaders(fiftyoneDegreesComponent *component, fiftyoneDegreesHeaders *headers, fiftyoneDegreesException *exception)
Where the component's key value pairs relate to headers creates an array of pointers to the relevant ...
List structure which contains a list of collection items.
Definition: list.h:112
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition: exceptions.h:111
const fiftyoneDegreesString * fiftyoneDegreesComponentGetName(fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesComponent *component, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Returns the string name of the component using the item provided.
Explains to a collection (or cache) what the consumer is looking for.
Definition: collectionKey.h:72
void * fiftyoneDegreesComponentReadFromFile(const fiftyoneDegreesCollectionFile *file, const fiftyoneDegreesCollectionKey *key, fiftyoneDegreesData *data, fiftyoneDegreesException *exception)
Read a component from the file collection provided and store in the data pointer.
const int32_t defaultProfileOffset
Offset in the profiles data structure to the default profile.
Definition: component.h:84
All the shared methods and fields required by file, memory and cached collections.
Definition: collection.h:402