Move from `count(...)` to `contains(...)`

PiperOrigin-RevId: 493346962
pull/11168/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 72b9420459
commit f1b0045dd3
  1. 2
      src/google/protobuf/compiler/objectivec/generator.cc
  2. 9
      src/google/protobuf/compiler/objectivec/names.cc

@ -303,7 +303,7 @@ bool ObjectiveCGenerator::GenerateAll(
}
// Generate m file.
if (!headers_only && skip_impls.count(file->name()) == 0) {
if (!headers_only && !skip_impls.contains(file->name())) {
std::unique_ptr<io::ZeroCopyOutputStream> output(
context->Open(filepath + ".pbobjc.m"));
io::Printer printer(output.get(), '$');

@ -219,7 +219,7 @@ bool PrefixModeStorage::is_package_exempted(const std::string& package) {
}
}
return exceptions_.count(package) != 0;
return exceptions_.contains(package);
}
PrefixModeStorage& g_prefix_mode = *new PrefixModeStorage();
@ -321,7 +321,7 @@ std::string UnderscoresToCamelCase(const std::string& input,
std::string result;
bool first_segment_forces_upper = false;
for (auto& value : values) {
bool all_upper = (UpperSegments().count(value) > 0);
bool all_upper = UpperSegments().contains(value);
if (all_upper && (result.length() == 0)) {
first_segment_forces_upper = true;
}
@ -583,9 +583,8 @@ std::string SanitizeNameForObjC(const std::string& prefix,
} else {
sanitized = prefix + input;
}
if (IsReservedCIdentifier(sanitized) ||
(ReservedWords().count(sanitized) > 0) ||
(NSObjectMethods().count(sanitized) > 0)) {
if (IsReservedCIdentifier(sanitized) || ReservedWords().contains(sanitized) ||
NSObjectMethods().contains(sanitized)) {
if (out_suffix_added) *out_suffix_added = extension;
return sanitized + extension;
}

Loading…
Cancel
Save