c++mongodbmongo-cxx-driver

mongo-cxx-driver, where are the implementations of bson_value::view::get_string() and document::element::get_string()?


I did a grep and only see ... get_string const; declarations for both functions, no actual implementation in any hpp or cpp files in github.com/mongo-cxx-driver/src. Did anyone know where they live?


Solution

  • It's done via name decoration/mangling, hence grep for get_string in the code source did not return any function definition.

    //bsoncxx/v_noabi/bsoncxx/document/element.cpp
    #define BSONCXX_ENUM(name, val) \
        types::b_##name element::get_##name() const { \
        ...
    

    and

    //bsoncxx/v_noabi/bsoncxx/enums/type.hpp
    BSONCXX_ENUM(string, 0x02)