GeoDesk for C++
Fast and storage-efficient spatial database engine for OpenStreetMap features
Loading...
Searching...
No Matches
geodesk::StringValue Class Reference

A string pointer (used for keys, values and roles). More...

#include <StringValue.h>

Public Member Functions

 StringValue ()
 
 StringValue (const clarisma::ShortVarString *str)
 
 StringValue (const uint8_t *bytes)
 
const char * data () const noexcept
 Pointer to the characters of the string.
 
bool isEmpty () const noexcept
 true if the length of the string is 0
 
size_t size () const noexcept
 The length of the string.
 
bool startsWith (const std::string_view s) const noexcept
 
bool endsWith (const std::string_view s) const noexcept
 
bool operator== (const std::string_view sv) const noexcept
 
bool operator!= (const std::string_view sv) const noexcept
 
 operator bool () const noexcept
 
const uint8_t * rawBytes () const noexcept
 Pointer to the raw data representing this string.
 

Detailed Description

A string pointer (used for keys, values and roles).

Character data is encoded as UTF-8.

Converts implicitly to std::string and std::string_view.

Warning: A StringValue object is a lightweight wrapper around a pointer to string data, contained in a FeatureStore. It becomes invalid once that FeatureStore is closed. To use its value beyond the lifetime of its FeatureStore, assign it to a std::string (which allocates its own copy of the string).

Constructor & Destructor Documentation

◆ StringValue() [1/3]

geodesk::StringValue::StringValue ( )
inline

◆ StringValue() [2/3]

geodesk::StringValue::StringValue ( const clarisma::ShortVarString * str)
inline

◆ StringValue() [3/3]

geodesk::StringValue::StringValue ( const uint8_t * bytes)
inlineexplicit

Member Function Documentation

◆ data()

const char * geodesk::StringValue::data ( ) const
inlinenoexcept

Pointer to the characters of the string.

Returns
Pointer to the string's bytes (UTF-8 encoded, not null-terminated)

◆ endsWith()

bool geodesk::StringValue::endsWith ( const std::string_view s) const
inlinenoexcept

◆ isEmpty()

bool geodesk::StringValue::isEmpty ( ) const
inlinenoexcept

true if the length of the string is 0

◆ operator bool()

geodesk::StringValue::operator bool ( ) const
inlinenoexcept

◆ operator!=()

bool geodesk::StringValue::operator!= ( const std::string_view sv) const
inlinenoexcept

◆ operator==()

bool geodesk::StringValue::operator== ( const std::string_view sv) const
inlinenoexcept

◆ rawBytes()

const uint8_t * geodesk::StringValue::rawBytes ( ) const
inlinenoexcept

Pointer to the raw data representing this string.

Warning: This pointer becomes invalid once the FeatureStore containing its data is closed.

◆ size()

size_t geodesk::StringValue::size ( ) const
inlinenoexcept

The length of the string.

Returns
number of bytes in the string (not characters)

◆ startsWith()

bool geodesk::StringValue::startsWith ( const std::string_view s) const
inlinenoexcept

The documentation for this class was generated from the following file: