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 2026 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
26#ifdef FIFTYONE_DEGREES_IPI_SYMBOLS
27#include "ipiSymbols.h"
28#endif
29
52
53#include <stdint.h>
54#ifdef _MSC_VER
55#pragma warning (push)
56#pragma warning (disable: 5105)
57#include <windows.h>
58#pragma warning (default: 5105)
59#pragma warning (pop)
60#endif
61#include "data.h"
62#include "exceptions.h"
63#include "collection.h"
64#include "list.h"
65#include "string.h"
66#include "common.h"
67#include "headers.h"
68
74typedef struct fiftyoneDegrees_component_keyvaluepair_t {
75 uint32_t key;
76 uint32_t value;
78
83#pragma pack(push, 1)
84typedef struct fiftyoneDegrees_component_t {
85 const byte componentId;
86 const int32_t nameOffset;
88 const int32_t defaultProfileOffset;
90 const uint16_t keyValuesCount;
96#pragma pack(pop)
97
104 const void *initial,
105 fiftyoneDegreesException *exception);
118 fiftyoneDegreesCollection *stringsCollection,
119 fiftyoneDegreesComponent *component,
121 fiftyoneDegreesException *exception);
122
135 fiftyoneDegreesComponent *component,
136 uint16_t index,
137 fiftyoneDegreesException *exception);
138
149 fiftyoneDegreesCollection *components,
151 uint32_t count,
152 fiftyoneDegreesException *exception);
153
154#ifndef FIFTYONE_DEGREES_MEMORY_ONLY
155
170 fiftyoneDegreesException *exception);
171
172#endif
173
184 fiftyoneDegreesComponent *component,
185 fiftyoneDegreesException *exception);
186
195EXTERNAL fiftyoneDegreesHeaderPtrs* fiftyoneDegreesComponentGetHeaders(
196 fiftyoneDegreesComponent* component,
197 fiftyoneDegreesHeaders* headers,
198 fiftyoneDegreesException* exception);
199
203
204#endif
uint32_t fiftyoneDegreesComponentGetFinalSize(const void *initial, fiftyoneDegreesException *exception)
Gets size of Component with trailing key-value pair.
void fiftyoneDegreesComponentInitList(fiftyoneDegreesCollection *components, fiftyoneDegreesList *list, uint32_t count, fiftyoneDegreesException *exception)
Initialises the list of components.
const fiftyoneDegreesString * fiftyoneDegreesComponentGetName(fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesComponent *component, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Returns the string name of the component using the item provided.
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.
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 ...
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...
uint32_t fiftyoneDegreesComponentGetDefaultProfileId(fiftyoneDegreesCollection *profiles, fiftyoneDegreesComponent *component, fiftyoneDegreesException *exception)
Get the default profile id for the component provided.
fiftyoneDegreesHeaderArray fiftyoneDegreesHeaders
Array of headers used to easily access and track the size of the array.
Definition headers.h:171
Type of collection where the collection is streamed from file.
Definition collection.h:456
All the shared methods and fields required by file, memory and cached collections.
Definition collection.h:408
Used to store a handle to the underlying item that could be used to release the item when it's finish...
Definition collection.h:315
Explains to a collection (or cache) what the consumer is looking for.
Definition collectionKey.h:76
A component of a data set.
Definition component.h:84
const int32_t nameOffset
Offset in the strings data structure to the name.
Definition component.h:86
const uint16_t keyValuesCount
The number of key value pairs at firstKeyValuePair.
Definition component.h:90
const byte componentId
The unique Id of the component.
Definition component.h:85
const int32_t defaultProfileOffset
Offset in the profiles data structure to the default profile.
Definition component.h:88
const fiftyoneDegreesComponentKeyValuePair firstKeyValuePair
The first key value pair.
Definition component.h:92
Key value pair contained in each component.
Definition component.h:74
uint32_t value
Integer value.
Definition component.h:76
uint32_t key
Integer key.
Definition component.h:75
Data structure used for reusing memory which may have been allocated in a previous operation.
Definition data.h:105
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition exceptions.h:115
List structure which contains a list of collection items.
Definition list.h:116
Definition string.h:97