Skip to content

Commit 4687e2f

Browse files
Googlera-maurice
authored andcommitted
LSC: Add std:: qualifications to all references to std::string and std::basic_string.
Adding these qualifications will make google3 C++ more portable, allow the global using std::string declarations in the google3 copy of the C++ standard library to be deleted, and bring google3 C++ in line with how the rest of the world uses C++. This completes the work started in go/lsc-add-std and go/std-type-qualification. LSC documentation: go/lsc-std-string Tested: TAP --sample ran all affected tests and none failed http://test/OCL:313239073:BASE:313584011:1590681338292:a463c165 PiperOrigin-RevId: 313781227
1 parent 86339a2 commit 4687e2f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

functions/samples/src/doc_samples.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// Stub functions to allow sample functions to compile.
2727
void DisplayError(firebase::functions::Error code, const char *message) {}
2828
void DisplayResult(int result) {}
29-
void DisplayResult(const string& result) {}
29+
void DisplayResult(const std::string& result) {}
3030

3131
// [START define_functions_instance]
3232
firebase::functions::Functions* functions;
@@ -56,7 +56,7 @@ firebase::Future<firebase::functions::HttpsCallableResult> AddNumbers(int a,
5656

5757
// [START function_add_message]
5858
firebase::Future<firebase::functions::HttpsCallableResult> AddMessage(
59-
const string& text) {
59+
const std::string& text) {
6060
// Create the arguments to the callable function.
6161
firebase::Variant data = firebase::Variant::EmptyMap();
6262
data.map()["text"] = firebase::Variant(text);
@@ -119,15 +119,15 @@ void OnAddMessageCallback(
119119
const firebase::functions::HttpsCallableResult *result = future.result();
120120
firebase::Variant data = result->data();
121121
// This will assert if the result returned from the function wasn't a string.
122-
string message = data.string_value();
122+
std::string message = data.string_value();
123123
// Display the result in the UI.
124124
DisplayResult(message);
125125
}
126126

127127
// ...
128128

129129
// [START_EXCLUDE]
130-
void AddMessageAndDisplay(const string& message) {
130+
void AddMessageAndDisplay(const std::string& message) {
131131
// [END_EXCLUDE]
132132
auto future = AddMessage(message);
133133
future.OnCompletion(OnAddMessageCallback);

0 commit comments

Comments
 (0)