51Degrees Common C/C++  4.1

A shared functionality library that is used by 51Degrees products

property.h

1 /* *********************************************************************
2  * This Source Code Form 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 Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0.
8  *
9  * If a copy of the MPL was not distributed with this file, You can obtain
10  * one at http://mozilla.org/MPL/2.0/.
11  *
12  * This Source Code Form is "Incompatible With Secondary Licenses", as
13  * defined by the Mozilla Public License, v. 2.0.
14  * ******************************************************************** */
15 
16 #ifndef FIFTYONE_DEGREES_PROPERTY_H_INCLUDED
17 #define FIFTYONE_DEGREES_PROPERTY_H_INCLUDED
18 
45 #include <stdint.h>
46 #ifdef _MSC_VER
47 #include <windows.h>
48 #endif
49 #include "data.h"
50 #include "exceptions.h"
51 #include "collection.h"
52 #include "string.h"
53 
54 #ifdef __cplusplus
55 #define EXTERNAL extern "C"
56 #else
57 #define EXTERNAL
58 #endif
59 
63 typedef enum e_fiftyone_degrees_property_value_type {
70 
74 #pragma pack(push, 1)
75 typedef struct property_t {
76  const byte componentIndex;
77  const byte displayOrder;
79  const byte isMandatory;
81  const byte isList;
83  const byte showValues;
84  const byte isObsolete;
86  const byte show;
87  const byte valueType;
88  const uint32_t defaultValueIndex;
90  const uint32_t nameOffset;
92  const uint32_t descriptionOffset;
94  const uint32_t categoryOffset;
96  const uint32_t urlOffset;
98  const uint32_t firstValueIndex;
99  const uint32_t lastValueIndex;
100  const uint32_t mapCount;
101  const uint32_t firstMapIndex;
104 #pragma pack(pop)
105 
118  fiftyoneDegreesCollection *stringsCollection,
119  fiftyoneDegreesProperty *property,
121  fiftyoneDegreesException *exception);
122 
135  fiftyoneDegreesCollection *stringsCollection,
136  fiftyoneDegreesProperty *property,
138  fiftyoneDegreesException *exception);
139 
152  fiftyoneDegreesCollection *stringsCollection,
153  fiftyoneDegreesProperty *property,
155  fiftyoneDegreesException *exception);
156 
169  fiftyoneDegreesCollection *stringsCollection,
170  fiftyoneDegreesProperty *property,
172  fiftyoneDegreesException *exception);
173 
183  fiftyoneDegreesCollection *properties,
184  uint32_t index,
185  fiftyoneDegreesException *exception);
186 
198  fiftyoneDegreesCollection *properties,
199  uint32_t index,
201  fiftyoneDegreesException *exception);
202 
215  fiftyoneDegreesCollection *properties,
216  fiftyoneDegreesCollection *strings,
217  const char *requiredPropertyName,
219  fiftyoneDegreesException *exception);
220 
225 #endif
const byte valueType
The type of value the property represents.
Definition: property.h:87
JavaScript string.
Definition: property.h:68
EXTERNAL fiftyoneDegreesProperty * fiftyoneDegreesPropertyGet(fiftyoneDegreesCollection *properties, uint32_t index, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Gets the property at the requested index from the properties collection provided.
Definition: property.c:77
Used to store a handle to the underlying item that could be used to release the item when it's finish...
Definition: collection.h:302
Double.
Definition: property.h:66
const byte componentIndex
Index of the component.
Definition: property.h:76
EXTERNAL fiftyoneDegreesString * fiftyoneDegreesPropertyGetDescription(fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesProperty *property, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Returns the string description of the property using the item provided.
Definition: property.c:41
const byte isList
True if the property is a list can return multiple values.
Definition: property.h:81
String.
Definition: property.h:64
const uint32_t urlOffset
The offset in the strings structure to the property URL.
Definition: property.h:96
const uint32_t firstValueIndex
Index of the first possible value.
Definition: property.h:98
String structure containing its value and size.
Definition: string.h:80
EXTERNAL fiftyoneDegreesProperty * fiftyoneDegreesPropertyGetByName(fiftyoneDegreesCollection *properties, fiftyoneDegreesCollection *strings, const char *requiredPropertyName, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Gets the property with the requested name from the properties collection provided.
Definition: property.c:89
fiftyoneDegreesPropertyValueType
Enum of property types.
Definition: property.h:63
const byte show
True if the property should be shown in GUIs.
Definition: property.h:86
const uint32_t firstMapIndex
The first index in the list of maps the property is associated with.
Definition: property.h:101
Integer.
Definition: property.h:65
const uint32_t descriptionOffset
The offset in the strings structure to the property description.
Definition: property.h:92
EXTERNAL fiftyoneDegreesString * fiftyoneDegreesPropertyGetCategory(fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesProperty *property, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Returns the string category of the property using the item provided.
Definition: property.c:53
const uint32_t nameOffset
The offset in the strings structure to the property name.
Definition: property.h:90
const byte isObsolete
True if the property is obsolete and will be removed from future data sets.
Definition: property.h:84
Property structure containing all the meta data relating to a property.
Definition: property.h:75
const byte isMandatory
True if the property is mandatory and must be provided.
Definition: property.h:79
const byte showValues
True if the values should be shown in GUIs.
Definition: property.h:83
EXTERNAL fiftyoneDegreesString * fiftyoneDegreesPropertyGetUrl(fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesProperty *property, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Returns the string URL of the property using the item provided.
Definition: property.c:65
EXTERNAL byte fiftyoneDegreesPropertyGetValueType(fiftyoneDegreesCollection *properties, uint32_t index, fiftyoneDegreesException *exception)
Gets the value type for the property at the index in the collection.
Definition: property.c:137
const uint32_t categoryOffset
The offset in the strings structure to the property category.
Definition: property.h:94
const uint32_t defaultValueIndex
The default value index for the property.
Definition: property.h:88
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition: exceptions.h:109
Boolean.
Definition: property.h:67
EXTERNAL fiftyoneDegreesString * fiftyoneDegreesPropertyGetName(fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesProperty *property, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Returns the string name of the property using the item provided.
Definition: property.c:29
const uint32_t lastValueIndex
Index of the last possible value.
Definition: property.h:99
const uint32_t mapCount
Number of maps the property is associated with.
Definition: property.h:100
const byte displayOrder
The order the property should be displayed in relative to other properties.
Definition: property.h:77
All the shared methods and fields required by file, memory and cached collections.
Definition: collection.h:400