Zserio C++17 runtime library  0.5.0
Built for Zserio 2.17.0
String.cpp
Go to the documentation of this file.
2 #include "zserio/String.h"
3 #include "zserio/Types.h"
4 
5 namespace zserio
6 {
7 
8 namespace detail
9 {
10 
11 void validate(std::string_view, std::string_view)
12 {
13  // always validate
14 }
15 
16 BitSize bitSizeOf(std::string_view stringValue, BitSize)
17 {
18  const VarSize stringSize = fromCheckedValue<VarSize>(convertSizeToUInt32(stringValue.size()));
19 
20  // the string consists of varsize for size followed by the UTF-8 encoded string
21  return bitSizeOf(stringSize) + stringSize * 8;
22 }
23 
24 BitSize initializeOffsets(std::string_view stringValue, BitSize bitPosition)
25 {
26  return bitSizeOf(stringValue, bitPosition);
27 }
28 
29 } // namespace detail
30 
31 } // namespace zserio
unsigned int BitSize
Definition: BitSize.h:8
uint32_t convertSizeToUInt32(size_t value)
detail::VarIntWrapper< uint32_t, detail::VarIntType::VARSIZE > VarSize
Definition: Types.h:890