\r\n

51Degrees Device Detection C/C++  4.4

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 
69 typedef struct fiftyoneDegrees_component_keyvaluepair_t {
70  uint32_t key;
71  uint32_t value;
73 
78 #pragma pack(push, 1)
79 typedef struct fiftyoneDegrees_component_t {
80  const byte componentId;
81  const int32_t nameOffset;
83  const int32_t defaultProfileOffset;
85  const uint16_t keyValuesCount;
91 #pragma pack(pop)
92 
105  fiftyoneDegreesCollection *stringsCollection,
106  fiftyoneDegreesComponent *component,
108  fiftyoneDegreesException *exception);
109 
121  fiftyoneDegreesComponent *component,
122  uint16_t index,
123  fiftyoneDegreesException *exception);
124 
135  fiftyoneDegreesCollection *components,
136  fiftyoneDegreesList *list,
137  uint32_t count,
138  fiftyoneDegreesException *exception);
139 
140 #ifndef FIFTYONE_DEGREES_MEMORY_ONLY
141 
153  const fiftyoneDegreesCollectionFile *file,
154  uint32_t offset,
155  fiftyoneDegreesData *data,
156  fiftyoneDegreesException *exception);
157 
158 #endif
159 
169  fiftyoneDegreesCollection *profiles,
170  fiftyoneDegreesComponent *component,
171  fiftyoneDegreesException *exception);
172 
177 #endif
fiftyoneDegreesString * fiftyoneDegreesComponentGetName(fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesComponent *component, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Returns the string name of the component using the item provided.
uint32_t key
Integer key.
Definition: component.h:70
A component of a data set.
Definition: component.h:79
void * fiftyoneDegreesComponentReadFromFile(const fiftyoneDegreesCollectionFile *file, uint32_t offset, fiftyoneDegreesData *data, fiftyoneDegreesException *exception)
Read a component from the file collection provided and store in the data pointer.
const int32_t nameOffset
Offset in the strings data structure to the name.
Definition: component.h:81
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
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:447
Key value pair contained in each component.
Definition: component.h:69
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...
String structure containing its value and size.
Definition: string.h:109
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:80
uint32_t value
Integer value.
Definition: component.h:71
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:85
const fiftyoneDegreesComponentKeyValuePair firstKeyValuePair
The first key value pair.
Definition: component.h:87
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 int32_t defaultProfileOffset
Offset in the profiles data structure to the default profile.
Definition: component.h:83
All the shared methods and fields required by file, memory and cached collections.
Definition: collection.h:410