GeoLite2++  v0.0.1-2711
C++ API for MaxMind's GeoLite2 Database
Looking for a senior C++ dev? I'm looking for work. Hire me!
GeoLite2PP Namespace Reference

The entire GeoLite2++ library is encapsulated in the GeoLite2PP namespace to prevent namespace pollution. More...

Classes

class  DB
 The DB class is the primary class used by GeoLite2++. More...
 
class  ErrorCategory
 Error class used to return libmaxminddb error codes and messages when C++ exceptions are thrown. More...
 

Typedefs

typedef std::map< std::string, std::string > MStr
 Map of std::string to std::string. More...
 
typedef std::vector< const char * > VCStr
 Vector of C-style string pointers. More...
 

Enumerations

enum  MMDBStatus {
  MMDBStatus::success = MMDB_SUCCESS,
  MMDBStatus::file_open = MMDB_FILE_OPEN_ERROR,
  MMDBStatus::corrupt_search_tree = MMDB_CORRUPT_SEARCH_TREE_ERROR,
  MMDBStatus::invalid_metadata = MMDB_INVALID_METADATA_ERROR,
  MMDBStatus::io = MMDB_IO_ERROR,
  MMDBStatus::out_of_memory = MMDB_OUT_OF_MEMORY_ERROR,
  MMDBStatus::unknown_db_format = MMDB_UNKNOWN_DATABASE_FORMAT_ERROR,
  MMDBStatus::invalid_data = MMDB_INVALID_DATA_ERROR,
  MMDBStatus::invalid_lookup_path = MMDB_INVALID_LOOKUP_PATH_ERROR,
  MMDBStatus::lookup_path_does_not_match = MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR,
  MMDBStatus::invalid_node_number = MMDB_INVALID_NODE_NUMBER_ERROR,
  MMDBStatus::ipv6_lookup_in_ipv4_db = MMDB_IPV6_LOOKUP_IN_IPV4_DATABASE_ERROR
}
 Errors defined in maxminddb.h, converted to C++ enums. More...
 

Functions

const ErrorCategoryget_error_category (void) noexcept
 All error category objects should actually be references to the exact same object, which is provided by this function. More...
 
std::error_code make_error_code (MMDBStatus s)
 Associate an error value with the category. More...
 
std::error_condition make_error_condition (MMDBStatus s)
 Associate an error_condition with the category. More...
 

Detailed Description

The entire GeoLite2++ library is encapsulated in the GeoLite2PP namespace to prevent namespace pollution.

Note that GeoLite2++ builds on top of the existing C library "libmaxminddb". GeoLite2++ provides alternate C++ bindings, it is not a replacement! GeoLite2++ was written to provide an easier method from C++ to access MaxMind's GeoLite2 GeoIP database.

The original C libmaxminddb library is here: https://github.com/maxmind/libmaxminddb/

Typedef Documentation

◆ MStr

typedef std::map<std::string, std::string> GeoLite2PP::MStr

Map of std::string to std::string.

◆ VCStr

typedef std::vector<const char *> GeoLite2PP::VCStr

Vector of C-style string pointers.

Enumeration Type Documentation

◆ MMDBStatus

Errors defined in maxminddb.h, converted to C++ enums.

Enumerator
success 

= 0

file_open 

= 1

corrupt_search_tree 

= 2

invalid_metadata 

= 3

io 

= 4

out_of_memory 

= 5

unknown_db_format 

= 6

invalid_data 

= 7

invalid_lookup_path 

= 8

lookup_path_does_not_match 

= 9

invalid_node_number 

= 10

ipv6_lookup_in_ipv4_db 

= 11

Function Documentation

◆ get_error_category()

const GeoLite2PP::ErrorCategory & GeoLite2PP::get_error_category ( void  )
noexcept

All error category objects should actually be references to the exact same object, which is provided by this function.

Referenced by GeoLite2PP::DB::DB(), GeoLite2PP::DB::get_metadata(), GeoLite2PP::DB::lookup(), GeoLite2PP::DB::lookup_raw(), make_error_code(), and make_error_condition().

Here is the caller graph for this function:

◆ make_error_code()

std::error_code GeoLite2PP::make_error_code ( GeoLite2PP::MMDBStatus  s)

Associate an error value with the category.

References get_error_category().

Here is the call graph for this function:

◆ make_error_condition()

std::error_condition GeoLite2PP::make_error_condition ( GeoLite2PP::MMDBStatus  s)

Associate an error_condition with the category.

References get_error_category().

Here is the call graph for this function: