Coverage Report

Created: 2025-06-13 06:18

/src/MapServer/src/flatgeobuf/include/flatbuffers/string.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2021 Google Inc. All rights reserved.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
#ifndef FLATBUFFERS_STRING_H_
18
#define FLATBUFFERS_STRING_H_
19
20
#include "flatbuffers/base.h"
21
#include "flatbuffers/vector.h"
22
23
namespace mapserver {
24
namespace flatbuffers {
25
26
struct String : public Vector<char> {
27
0
  const char *c_str() const { return reinterpret_cast<const char *>(Data()); }
28
0
  std::string str() const { return std::string(c_str(), size()); }
29
30
  // clang-format off
31
  #ifdef FLATBUFFERS_HAS_STRING_VIEW
32
0
  flatbuffers::string_view string_view() const {
33
0
    return flatbuffers::string_view(c_str(), size());
34
0
  }
35
  #endif // FLATBUFFERS_HAS_STRING_VIEW
36
  // clang-format on
37
38
0
  bool operator<(const String &o) const {
39
0
    return StringLessThan(this->data(), this->size(), o.data(), o.size());
40
0
  }
41
};
42
43
// Convenience function to get std::string from a String returning an empty
44
// string on null pointer.
45
0
static inline std::string GetString(const String *str) {
46
0
  return str ? str->str() : "";
47
0
}
Unexecuted instantiation: flatgeobuf_c.cpp:mapserver::flatbuffers::GetString(mapserver::flatbuffers::String const*)
Unexecuted instantiation: geometryreader.cpp:mapserver::flatbuffers::GetString(mapserver::flatbuffers::String const*)
Unexecuted instantiation: packedrtree.cpp:mapserver::flatbuffers::GetString(mapserver::flatbuffers::String const*)
48
49
// Convenience function to get char* from a String returning an empty string on
50
// null pointer.
51
0
static inline const char *GetCstring(const String *str) {
52
0
  return str ? str->c_str() : "";
53
0
}
Unexecuted instantiation: flatgeobuf_c.cpp:mapserver::flatbuffers::GetCstring(mapserver::flatbuffers::String const*)
Unexecuted instantiation: geometryreader.cpp:mapserver::flatbuffers::GetCstring(mapserver::flatbuffers::String const*)
Unexecuted instantiation: packedrtree.cpp:mapserver::flatbuffers::GetCstring(mapserver::flatbuffers::String const*)
54
55
#ifdef FLATBUFFERS_HAS_STRING_VIEW
56
// Convenience function to get string_view from a String returning an empty
57
// string_view on null pointer.
58
0
static inline flatbuffers::string_view GetStringView(const String *str) {
59
0
  return str ? str->string_view() : flatbuffers::string_view();
60
0
}
Unexecuted instantiation: flatgeobuf_c.cpp:mapserver::flatbuffers::GetStringView(mapserver::flatbuffers::String const*)
Unexecuted instantiation: geometryreader.cpp:mapserver::flatbuffers::GetStringView(mapserver::flatbuffers::String const*)
Unexecuted instantiation: packedrtree.cpp:mapserver::flatbuffers::GetStringView(mapserver::flatbuffers::String const*)
61
#endif  // FLATBUFFERS_HAS_STRING_VIEW
62
63
}  // namespace flatbuffers
64
}  // namespace mapserver
65
66
#endif  // FLATBUFFERS_STRING_H_