Skip to content

Commit 711db1d

Browse files
mbxxAdam Cozzette
authored andcommitted
Qualify uses of std::string within protobuf/compiler/ruby/...
1 parent 8c91d71 commit 711db1d

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/google/protobuf/compiler/ruby/ruby_generator.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ std::string TypeName(const FieldDescriptor* field) {
113113
}
114114
}
115115

116-
string StringifySyntax(FileDescriptor::Syntax syntax) {
116+
std::string StringifySyntax(FileDescriptor::Syntax syntax) {
117117
switch (syntax) {
118118
case FileDescriptor::SYNTAX_PROTO2:
119119
return "proto2";
@@ -147,7 +147,7 @@ std::string DefaultValueForField(const FieldDescriptor* field) {
147147
return NumberToString(field->default_value_enum()->number());
148148
case FieldDescriptor::CPPTYPE_STRING: {
149149
std::ostringstream os;
150-
string default_str = field->default_value_string();
150+
std::string default_str = field->default_value_string();
151151

152152
if (field->type() == FieldDescriptor::TYPE_STRING) {
153153
os << "\"" << default_str << "\"";
@@ -426,14 +426,14 @@ int GeneratePackageModules(const FileDescriptor* file, io::Printer* printer) {
426426
}
427427

428428
// Use the appropriate delimiter
429-
string delimiter = need_change_to_module ? "." : "::";
429+
std::string delimiter = need_change_to_module ? "." : "::";
430430
int delimiter_size = need_change_to_module ? 1 : 2;
431431

432432
// Extract each module name and indent
433433
while (!package_name.empty()) {
434434
size_t dot_index = package_name.find(delimiter);
435-
string component;
436-
if (dot_index == string::npos) {
435+
std::string component;
436+
if (dot_index == std::string::npos) {
437437
component = package_name;
438438
package_name = "";
439439
} else {
@@ -462,7 +462,7 @@ void EndPackageModules(int levels, io::Printer* printer) {
462462
}
463463

464464
bool UsesTypeFromFile(const Descriptor* message, const FileDescriptor* file,
465-
string* error) {
465+
std::string* error) {
466466
for (int i = 0; i < message->field_count(); i++) {
467467
const FieldDescriptor* field = message->field(i);
468468
if ((field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
@@ -499,7 +499,7 @@ bool UsesTypeFromFile(const Descriptor* message, const FileDescriptor* file,
499499
bool MaybeEmitDependency(const FileDescriptor* import,
500500
const FileDescriptor* from,
501501
io::Printer* printer,
502-
string* error) {
502+
std::string* error) {
503503
if (from->syntax() == FileDescriptor::SYNTAX_PROTO3 &&
504504
import->syntax() == FileDescriptor::SYNTAX_PROTO2) {
505505
for (int i = 0; i < from->message_type_count(); i++) {
@@ -524,7 +524,7 @@ bool MaybeEmitDependency(const FileDescriptor* import,
524524
}
525525

526526
bool GenerateFile(const FileDescriptor* file, io::Printer* printer,
527-
string* error) {
527+
std::string* error) {
528528
printer->Print(
529529
"# Generated by the protocol buffer compiler. DO NOT EDIT!\n"
530530
"# source: $filename$\n"
@@ -580,9 +580,9 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer,
580580

581581
bool Generator::Generate(
582582
const FileDescriptor* file,
583-
const string& parameter,
583+
const std::string& parameter,
584584
GeneratorContext* generator_context,
585-
string* error) const {
585+
std::string* error) const {
586586

587587
if (file->syntax() != FileDescriptor::SYNTAX_PROTO3 &&
588588
file->syntax() != FileDescriptor::SYNTAX_PROTO2) {

src/google/protobuf/compiler/ruby/ruby_generator.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ namespace ruby {
4949
// Ruby output, you can do so by registering an instance of this
5050
// CodeGenerator with the CommandLineInterface in your main() function.
5151
class PROTOC_EXPORT Generator : public CodeGenerator {
52-
bool Generate(const FileDescriptor* file, const string& parameter,
52+
bool Generate(const FileDescriptor* file, const std::string& parameter,
5353
GeneratorContext* generator_context,
54-
string* error) const override;
54+
std::string* error) const override;
5555
uint64_t GetSupportedFeatures() const override {
5656
return FEATURE_PROTO3_OPTIONAL;
5757
}
@@ -65,4 +65,3 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
6565
#include <google/protobuf/port_undef.inc>
6666

6767
#endif // GOOGLE_PROTOBUF_COMPILER_RUBY_GENERATOR_H__
68-

0 commit comments

Comments
 (0)