\r\n

51Degrees Device Detection C/C++  4.4

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

EntityMetaDataBuilder.hpp

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_ENTITY_META_DATA_BUILDER_HPP
24 #define FIFTYONE_DEGREES_ENTITY_META_DATA_BUILDER_HPP
25 
26 #include <string>
27 #include "Exceptions.hpp"
28 #include "collection.h"
29 #include "string.h"
30 
31 
32 using namespace FiftyoneDegrees;
33 
34 namespace FiftyoneDegrees {
35  namespace Common {
41  protected:
42 
57  static string getString(
58  fiftyoneDegreesCollection *stringsCollection,
59  uint32_t offset) {
61  string result;
66  stringsCollection,
67  offset,
68  &item,
69  exception);
71  if (str != nullptr) {
72  result.append(&str->value);
73  }
75  stringsCollection,
76  &item);
77  return result;
78  }
79 
83  };
84  }
85 }
86 
87 #endif
#define FIFTYONE_DEGREES_EXCEPTION_CREATE
Macro used to create an exception.
Definition: exceptions.h:183
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
Meta data builder class contains static helper methods used when building meta data instances.
Definition: EntityMetaDataBuilder.hpp:40
51Degrees base namespace.
Definition: ComponentMetaDataBuilderHash.hpp:33
String structure containing its value and size.
Definition: string.h:109
#define FIFTYONE_DEGREES_EXCEPTION_THROW
Macro to print to standard error a message if an exception is set.
Definition: exceptions.h:161
static string getString(fiftyoneDegreesCollection *stringsCollection, uint32_t offset)
Get a copy of a string from the strings collection at the offset provided.
Definition: EntityMetaDataBuilder.hpp:57
fiftyoneDegreesString * fiftyoneDegreesStringGet(fiftyoneDegreesCollection *strings, uint32_t offset, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Gets the string at the required offset from the collection provided.
void fiftyoneDegreesDataReset(fiftyoneDegreesData *data)
Resets the data structure ready for a new operation.
All the shared methods and fields required by file, memory and cached collections.
Definition: collection.h:410
fiftyoneDegreesData data
Item data including allocated memory.
Definition: collection.h:311
#define FIFTYONE_DEGREES_COLLECTION_RELEASE(c, i)
Collection release macro used to release a collection item.
Definition: collection.h:267
char value
The first character of the string.
Definition: string.h:111