51Degrees Common C/C++  4.1

A shared functionality library that is used by 51Degrees products

EntityMetaDataBuilder.hpp

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_ENTITY_META_DATA_BUILDER_HPP
17 #define FIFTYONE_DEGREES_ENTITY_META_DATA_BUILDER_HPP
18 
19 #include <string>
20 #include "Exceptions.hpp"
21 #include "collection.h"
22 #include "string.h"
23 
24 using namespace std;
25 
26 using namespace FiftyoneDegrees;
27 
28 namespace FiftyoneDegrees {
29  namespace Common {
35  protected:
36 
51  static string getString(
52  fiftyoneDegreesCollection *stringsCollection,
53  uint32_t offset) {
55  string result;
60  stringsCollection,
61  offset,
62  &item,
63  exception);
65  if (str != nullptr) {
66  result.append(&str->value);
67  }
69  stringsCollection,
70  &item);
71  return result;
72  }
73 
77  };
78  }
79 }
80 
81 #endif
void fiftyoneDegreesDataReset(fiftyoneDegreesData *data)
Resets the data structure ready for a new operation.
Definition: data.c:20
#define FIFTYONE_DEGREES_EXCEPTION_CREATE
Macro used to create an exception.
Definition: exceptions.h:181
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
Meta data builder class contains static helper methods used when building meta data instances.
Definition: EntityMetaDataBuilder.hpp:34
51Degrees base namespace.
Definition: Collection.hpp:24
String structure containing its value and size.
Definition: string.h:80
#define FIFTYONE_DEGREES_EXCEPTION_THROW
Macro to print to standard error a message if an exception is set.
Definition: exceptions.h:159
fiftyoneDegreesString * fiftyoneDegreesStringGet(fiftyoneDegreesCollection *strings, uint32_t offset, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Gets the string at the required offset from the collection provided.
Definition: string.c:44
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:51
All the shared methods and fields required by file, memory and cached collections.
Definition: collection.h:400
fiftyoneDegreesData data
Item data including allocated memory.
Definition: collection.h:303
#define FIFTYONE_DEGREES_COLLECTION_RELEASE(c, i)
Collection release macro used to release a collection item.
Definition: collection.h:259
char value
The first character of the string.
Definition: string.h:82