\r\n

51Degrees Device Detection C/C++  4.4

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

fiftyoneDegreesString *  fiftyoneDegreesComponentGetName (fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesComponent *component, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Returns the string name of the component using the item provided. More...
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. More...
void  fiftyoneDegreesComponentInitList (fiftyoneDegreesCollection *components, fiftyoneDegreesList *list, uint32_t count, fiftyoneDegreesException *exception)
Initialises the list of components. More...
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. More...
uint32_t  fiftyoneDegreesComponentGetDefaultProfileId (fiftyoneDegreesCollection *profiles, fiftyoneDegreesComponent *component, fiftyoneDegreesException *exception)
Get the default profile id for the component provided. More...

Function Documentation

◆ fiftyoneDegreesComponentGetDefaultProfileId()

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

Get the default profile id for the component provided.

Parameters
profiles - collection containing the profiles from the same data set as the component
component - to get the default profile id for
exception - pointer 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
component - to get the pair from
index - of the pair within the component
exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
pointer to a key value pair

◆ fiftyoneDegreesComponentGetName()

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
component - structure for the name required.
stringsCollection - collection of strings retrieved by offsets.
item - used to store the resulting string in.
exception - pointer 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
components - collection containing the components to add to the list
list - to add the components to
count - number of components in the collection
exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h

◆ fiftyoneDegreesComponentReadFromFile()

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.

This method is used when creating a collection from file.

Parameters
file - collection to read from
offset - of the component in the collection
data - to store the resulting component in
exception - pointer 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
On This Page