-
Notifications
You must be signed in to change notification settings - Fork 543
CXX-1817 Rename get_utf8() to get_string() to make it more user-friendly #721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3f47436
f8008f8
2693be0
42cc656
b104fa7
eb722a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,11 +147,23 @@ class BSONCXX_API element { | |
/// | ||
/// Getter for elements of the b_utf8 type. | ||
/// | ||
/// @deprecated use document::element::get_string() instead. | ||
/// | ||
/// @throws bsoncxx::exception if this element is not a b_utf8. | ||
/// | ||
/// @return the element's value. | ||
/// | ||
BSONCXX_DEPRECATED types::b_utf8 get_utf8() const; | ||
|
||
/// | ||
/// Getter for elements of the b_utf8, or string, type. This function acts as a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The spirit of the requested change is to make it easier for users to find out how to get strings from BSON documents. There are other types / enums with utf8 in the name:
We could deprecate (1) in favor of a newly named bsoncxx::b_string struct. But I'm not aware of a portable C++11 way to deprecate enum values for (2) and (3). I think we should do one of two things:
I have a slight preference for (2). My rationale is that it is extra work for users to move from deprecated to undeprecated API. Having the Happy to chat about this further in slack/zoom. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After discussion, we'll do option 1, but as follow-up work in CXX-2109. |
||
/// wrapper for get_utf8(). | ||
/// | ||
/// @throws bsoncxx::exception if this element is not a b_utf8. | ||
/// | ||
/// @return the element's value. | ||
/// | ||
types::b_utf8 get_utf8() const; | ||
types::b_utf8 get_string() const; | ||
|
||
/// | ||
/// Getter for elements of the b_document type. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!