51Degrees Device Detection C/C++  4.1

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 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_COMPONENT_H_INCLUDED
24 #define FIFTYONE_DEGREES_COMPONENT_H_INCLUDED
25 
49 #include <stdint.h>
50 #ifdef _MSC_VER
51 #include <windows.h>
52 #endif
53 #include "data.h"
54 #include "exceptions.h"
55 #include "collection.h"
56 #include "list.h"
57 #include "string.h"
58 
59 #ifdef __cplusplus
60 #define EXTERNAL extern "C"
61 #else
62 #define EXTERNAL
63 #endif
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 
106  fiftyoneDegreesCollection *stringsCollection,
107  fiftyoneDegreesComponent *component,
109  fiftyoneDegreesException *exception);
110 
122  fiftyoneDegreesComponent *component,
123  uint16_t index,
124  fiftyoneDegreesException *exception);
125 
136  fiftyoneDegreesCollection *components,
137  fiftyoneDegreesList *list,
138  uint32_t count,
139  fiftyoneDegreesException *exception);
140 
141 #ifndef FIFTYONE_DEGREES_MEMORY_ONLY
142 
154  const fiftyoneDegreesCollectionFile *file,
155  uint32_t offset,
156  fiftyoneDegreesData *data,
157  fiftyoneDegreesException *exception);
158 
159 #endif
160 
170  fiftyoneDegreesCollection *profiles,
171  fiftyoneDegreesComponent *component,
172  fiftyoneDegreesException *exception);
173 
178 #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:71
A component of a data set.
Definition: component.h:80
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: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 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:444
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...
String structure containing its value and size.
Definition: string.h:87
Data structure used for reusing memory which may have been allocated in a previous operation.
Definition: data.h:106
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
const fiftyoneDegreesComponentKeyValuePair firstKeyValuePair
The first key value pair.
Definition: component.h:88
List structure which contains a list of collection items.
Definition: list.h:117
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition: exceptions.h:116
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:407