32 #include <string_view>
38 : latitude(latitude_),
41 if (latitude < -90.0 || latitude > 90.0)
50 const char * ptr = serialised.data();
51 const char * end = ptr + serialised.size();
55 "Junk found at end of serialised LatLongCoord");
61 size_t len = end - *ptr;
86 string res(
"Xapian::LatLongCoord(");
97 const char * ptr = serialised.data();
98 const char * end_ptr = ptr + serialised.size();
100 while (ptr != end_ptr) {
102 coords.back().unserialise(&ptr, end_ptr);
110 for (
auto&& coord :
coords) {
119 string res(
"Xapian::LatLongCoords(");
120 for (
auto coord =
coords.begin(); coord !=
coords.end(); ++coord) {
121 if (coord !=
coords.begin()) {
125 res +=
str(coord->latitude);
127 res +=
str(coord->longitude);
InvalidArgumentError indicates an invalid parameter value was passed to the API.
std::string serialise() const
Return a serialised form of the coordinate list.
void unserialise(std::string_view serialised)
Unserialise a string and set this object to the coordinates in it.
std::string get_description() const
Return a string describing this object.
std::vector< LatLongCoord > coords
The coordinates.
Indicates an error in the std::string serialisation of an object.
Hierarchy of classes which Xapian can throw as exceptions.
Encodings for geospatial coordinates.
Geospatial search support routines.
bool encode(double lat, double lon, std::string &result)
Encode a coordinate and append it to a string.
void decode(const char *value, size_t len, double &lat_ref, double &lon_ref)
Decode a coordinate from a buffer.
string str(int value)
Convert int to std::string.
The Xapian namespace contains public interfaces for the Xapian library.
Convert types to std::string.
std::string get_description() const
Return a string describing this object.
LatLongCoord() noexcept
Construct an uninitialised coordinate.
void unserialise(std::string_view serialised)
Unserialise a string and set this object to its coordinate.
double latitude
A latitude, as decimal degrees.
double longitude
A longitude, as decimal degrees.
std::string serialise() const
Return a serialised representation of the coordinate.