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

Component

Detailed Description

Component of a data set.

Introduction

A Component is stored in a components collection and contains the meta data for a specific component in a data set. Each component relates to a set of properties which a profile relating to the component will hold the values for.

Get

As there are generally only a small number of components in a data set, they can be accessed via a list structure instead of fetching from the base collection. This ensures that a reference the collection item is always held open and can be used at any time.

Collaboration diagram for Component:

Structs

struct  fiftyoneDegreesComponentKeyValuePair
 Key value pair contained in each component. More...
struct  fiftyoneDegreesComponent
 A component of a data set. More...

Functions

uint32_t fiftyoneDegreesComponentGetFinalSize (const void *initial, fiftyoneDegreesException *exception)
 Gets size of Component with trailing key-value pair.
const fiftyoneDegreesString * fiftyoneDegreesComponentGetName (fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesComponent *component, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
 Returns the string name of the component using the item provided.
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 list.
void fiftyoneDegreesComponentInitList (fiftyoneDegreesCollection *components, fiftyoneDegreesList *list, uint32_t count, fiftyoneDegreesException *exception)
 Initialises the list of components.
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.
uint32_t fiftyoneDegreesComponentGetDefaultProfileId (fiftyoneDegreesCollection *profiles, fiftyoneDegreesComponent *component, fiftyoneDegreesException *exception)
 Get the default profile id for the component provided.
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 headers in the same order as the key value pairs.

Function Documentation

◆ fiftyoneDegreesComponentGetDefaultProfileId()

uint32_t fiftyoneDegreesComponentGetDefaultProfileId ( fiftyoneDegreesCollection * profiles,
fiftyoneDegreesComponent * component,
fiftyoneDegreesException * exception )

Get the default profile id for the component provided.

Parameters
profilescollection containing the profiles from the same data set as the component
componentto get the default profile id for
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h

◆ fiftyoneDegreesComponentGetFinalSize()

uint32_t fiftyoneDegreesComponentGetFinalSize ( const void * initial,
fiftyoneDegreesException * exception )

Gets size of Component with trailing key-value pair.

Parameters
initialpointer to component "head"
Returns
full (with tail) struct size

◆ fiftyoneDegreesComponentGetHeaders()

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 headers in the same order as the key value pairs.

Parameters
componentto get the headers for
headersarray to find the corresponding header in
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h

◆ fiftyoneDegreesComponentGetKeyValuePair()

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 list.

This pointer does not need to be freed by the caller.

Parameters
componentto get the pair from
indexof the pair within the component
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
pointer to a key value pair

◆ fiftyoneDegreesComponentGetName()

const fiftyoneDegreesString * fiftyoneDegreesComponentGetName ( fiftyoneDegreesCollection * stringsCollection,
fiftyoneDegreesComponent * component,
fiftyoneDegreesCollectionItem * item,
fiftyoneDegreesException * exception )

Returns the string name of the component using the item provided.

The collection item must be released when the caller is finished with the string.

Parameters
componentstructure for the name required.
stringsCollectioncollection of strings retrieved by offsets.
itemused to store the resulting string in.
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
a pointer to a string in the collection item data structure.

◆ fiftyoneDegreesComponentInitList()

void fiftyoneDegreesComponentInitList ( fiftyoneDegreesCollection * components,
fiftyoneDegreesList * list,
uint32_t count,
fiftyoneDegreesException * exception )

Initialises the list of components.

This holds a reference to the collection items so that collection get methods do not need to be called repeatedly.

Parameters
componentscollection containing the components to add to the list
listto add the components to
countnumber of components in the collection
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h

◆ fiftyoneDegreesComponentReadFromFile()

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.

This method is used when creating a collection from file.

Parameters
filecollection to read from
keyof the component in the collection
datato store the resulting component in
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
pointer to the component allocated within the data structure