51Degrees Device Detection C/C++  4.1

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 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_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 using namespace std;
32 
33 using namespace FiftyoneDegrees;
34 
35 namespace FiftyoneDegrees {
36  namespace Common {
42  protected:
43 
58  static string getString(
59  fiftyoneDegreesCollection *stringsCollection,
60  uint32_t offset) {
62  string result;
67  stringsCollection,
68  offset,
69  &item,
70  exception);
72  if (str != nullptr) {
73  result.append(&str->value);
74  }
76  stringsCollection,
77  &item);
78  return result;
79  }
80 
84  };
85  }
86 }
87 
88 #endif
#define FIFTYONE_DEGREES_EXCEPTION_CREATE
Macro used to create an exception.
Definition: exceptions.h:188
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
Meta data builder class contains static helper methods used when building meta data instances.
Definition: EntityMetaDataBuilder.hpp:41
51Degrees base namespace.
Definition: ComponentMetaDataBuilderHash.hpp:34
String structure containing its value and size.
Definition: string.h:87
#define FIFTYONE_DEGREES_EXCEPTION_THROW
Macro to print to standard error a message if an exception is set.
Definition: exceptions.h:166
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:58
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:407
fiftyoneDegreesData data
Item data including allocated memory.
Definition: collection.h:310
#define FIFTYONE_DEGREES_COLLECTION_RELEASE(c, i)
Collection release macro used to release a collection item.
Definition: collection.h:266
char value
The first character of the string.
Definition: string.h:89