Home | History | Annotate | Download | only in protobuf

Lines Matching refs:proto

838   // descriptors for generated proto classes.  Each generated .pb.cc file
1338 void FileDescriptor::CopyTo(FileDescriptorProto* proto) const {
1339 proto->set_name(name());
1340 if (!package().empty()) proto->set_package(package());
1343 proto->add_dependency(dependency(i)->name());
1347 message_type(i)->CopyTo(proto->add_message_type());
1350 enum_type(i)->CopyTo(proto->add_enum_type());
1353 service(i)->CopyTo(proto->add_service());
1356 extension(i)->CopyTo(proto->add_extension());
1360 proto->mutable_options()->CopyFrom(options());
1364 void Descriptor::CopyTo(DescriptorProto* proto) const {
1365 proto->set_name(name());
1368 field(i)->CopyTo(proto->add_field());
1371 nested_type(i)->CopyTo(proto->add_nested_type());
1374 enum_type(i)->CopyTo(proto->add_enum_type());
1377 DescriptorProto::ExtensionRange* range = proto->add_extension_range();
1382 extension(i)->CopyTo(proto->add_extension());
1386 proto->mutable_options()->CopyFrom(options());
1390 void FieldDescriptor::CopyTo(FieldDescriptorProto* proto) const {
1391 proto->set_name(name());
1392 proto->set_number(number());
1396 proto->set_label(static_cast<FieldDescriptorProto::Label>(
1398 proto->set_type(static_cast<FieldDescriptorProto::Type>(
1403 proto->set_extendee(".");
1405 proto->mutable_extendee()->append(containing_type()->full_name());
1412 proto->clear_type();
1416 proto->set_type_name(".");
1418 proto->mutable_type_name()->append(message_type()->full_name());
1421 proto->set_type_name(".");
1423 proto->mutable_type_name()->append(enum_type()->full_name());
1427 proto->set_default_value(DefaultValueAsString(false));
1431 proto->mutable_options()->CopyFrom(options());
1435 void EnumDescriptor::CopyTo(EnumDescriptorProto* proto) const {
1436 proto->set_name(name());
1439 value(i)->CopyTo(proto->add_value());
1443 proto->mutable_options()->CopyFrom(options());
1447 void EnumValueDescriptor::CopyTo(EnumValueDescriptorProto* proto) const {
1448 proto->set_name(name());
1449 proto->set_number(number());
1452 proto->mutable_options()->CopyFrom(options());
1456 void ServiceDescriptor::CopyTo(ServiceDescriptorProto* proto) const {
1457 proto->set_name(name());
1460 method(i)->CopyTo(proto->add_method());
1464 proto->mutable_options()->CopyFrom(options());
1468 void MethodDescriptor::CopyTo(MethodDescriptorProto* proto) const {
1469 proto->set_name(name());
1472 proto->set_input_type(".");
1474 proto->mutable_input_type()->append(input_type()->full_name());
1477 proto->set_output_type(".");
1479 proto->mutable_output_type()->append(output_type()->full_name());
1482 proto->mutable_options()->CopyFrom(options());
1816 // one of the Options messages in descriptor.proto.
1842 const FileDescriptor* BuildFile(const FileDescriptorProto& proto);
1944 const Message& proto, Symbol symbol);
1951 void AddPackage(const string& name, const Message& proto,
1957 const Message& proto);
1973 // descriptor.proto.
1990 void BuildMessage(const DescriptorProto& proto,
1993 void BuildFieldOrExtension(const FieldDescriptorProto& proto,
1997 void BuildField(const FieldDescriptorProto& proto,
2000 BuildFieldOrExtension(proto, parent, result, false);
2002 void BuildExtension(const FieldDescriptorProto& proto,
2005 BuildFieldOrExtension(proto, parent, result, true);
2007 void BuildExtensionRange(const DescriptorProto::ExtensionRange& proto,
2010 void BuildEnum(const EnumDescriptorProto& proto,
2013 void BuildEnumValue(const EnumValueDescriptorProto& proto,
2016 void BuildService(const ServiceDescriptorProto& proto,
2019 void BuildMethod(const MethodDescriptorProto& proto,
2028 void CrossLinkFile(FileDescriptor* file, const FileDescriptorProto& proto);
2029 void CrossLinkMessage(Descriptor* message, const DescriptorProto& proto);
2031 const FieldDescriptorProto& proto);
2033 const EnumDescriptorProto& proto);
2035 const EnumValueDescriptorProto& proto);
2037 const ServiceDescriptorProto& proto);
2039 const MethodDescriptorProto& proto);
2153 // proto references are passed in only so they can be provided to calls to
2156 const FileDescriptorProto& proto);
2158 const DescriptorProto& proto);
2160 const FieldDescriptorProto& proto);
2162 const EnumDescriptorProto& proto);
2164 const EnumValueDescriptorProto& proto);
2166 const ServiceDescriptorProto& proto);
2168 const MethodDescriptorProto& proto);
2171 const FieldDescriptorProto& proto);
2175 const FileDescriptorProto& proto) {
2181 return DescriptorBuilder(this, tables_.get(), NULL).BuildFile(proto);
2185 const FileDescriptorProto& proto,
2193 error_collector).BuildFile(proto);
2197 const FileDescriptorProto& proto) const {
2200 default_error_collector_).BuildFile(proto);
2222 GOOGLE_LOG(ERROR) << "Invalid proto descriptor for file \"" << filename_
2432 tables_->AllocateString(*placeholder_full_name + ".placeholder.proto");
2518 const Message& proto, Symbol symbol) {
2536 AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME,
2539 AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME,
2546 AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME,
2555 const string& name, const Message& proto, const FileDescriptor* file) {
2561 ValidateSymbolName(name, name, proto);
2565 AddPackage(*parent_name, proto, file);
2566 ValidateSymbolName(name.substr(dot_pos + 1), name, proto);
2573 AddError(name, proto, DescriptorPool::ErrorCollector::NAME,
2582 const string& name, const string& full_name, const Message& proto) {
2584 AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME,
2593 AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME,
2656 // bootstrapping problem when building descriptors for descriptor.proto.
2657 // descriptor.proto does not contain any uninterpreted options, but
2678 const FileDescriptorProto& proto) {
2679 filename_ = proto.name();
2691 if (existing_proto.SerializeAsString() == proto.SerializeAsString()) {
2709 if (tables_->pending_files_[i] == proto.name()) {
2715 error_message.append(proto.name());
2717 AddError(proto.name(), proto, DescriptorPool::ErrorCollector::OTHER,
2727 proto.name());
2728 for (int i = 0; i < proto.dependency_size(); i++) {
2729 if (tables_->FindFile(proto.dependency(i)) == NULL &&
2731 pool_->underlay_->FindFileByName(proto.dependency(i)) == NULL)) {
2733 pool_->TryFindFileInFallbackDatabase(proto.dependency(i));
2748 if (!proto.has_name()) {
2749 AddError("", proto, DescriptorPool::ErrorCollector::OTHER,
2753 result->name_ = tables_->AllocateString(proto.name());
2754 if (proto.has_package()) {
2755 result->package_ = tables_->AllocateString(proto.package());
2757 // We cannot rely on proto.package() returning a valid string if
2758 // proto.has_package() is false, because we might be running at static
2767 AddError(proto.name(), proto, DescriptorPool::ErrorCollector::OTHER,
2775 AddPackage(result->package(), proto, result);
2780 result->dependency_count_ = proto.dependency_size();
2782 tables_->AllocateArray<const FileDescriptor*>(proto.dependency_size());
2783 for (int i = 0; i < proto.dependency_size(); i++) {
2784 if (!seen_dependencies.insert(proto.dependency(i)).second) {
2785 AddError(proto.name(), proto,
2787 "Import \"" + proto.dependency(i) + "\" was listed twice.");
2790 const FileDescriptor* dependency = tables_->FindFile(proto.dependency(i));
2792 dependency = pool_->underlay_->FindFileByName(proto.dependency(i));
2797 dependency = NewPlaceholderFile(proto.dependency(i));
2801 message = "Import \"" + proto.dependency(i) +
2804 message = "Import \"" + proto.dependency(i) +
2807 AddError(proto.name(), proto,
2817 BUILD_ARRAY(proto, result, message_type, BuildMessage , NULL);
2818 BUILD_ARRAY(proto, result, enum_type , BuildEnum , NULL);
2819 BUILD_ARRAY(proto, result, service , BuildService , NULL);
2820 BUILD_ARRAY(proto, result, extension , BuildExtension, NULL);
2823 if (!proto.has_options()) {
2826 AllocateOptions(proto.options(), result);
2832 CrossLinkFile(result, proto);
2849 ValidateFileOptions(result, proto);
2861 void DescriptorBuilder::BuildMessage(const DescriptorProto& proto,
2868 full_name->append(proto.name());
2870 ValidateSymbolName(proto.name(), *full_name, proto);
2872 result->name_ = tables_->AllocateString(proto.name());
2879 BUILD_ARRAY(proto, result, field , BuildField , result);
2880 BUILD_ARRAY(proto, result, nested_type , BuildMessage , result);
2881 BUILD_ARRAY(proto, result, enum_type , BuildEnum , result);
2882 BUILD_ARRAY(proto, result, extension_range, BuildExtensionRange, result);
2883 BUILD_ARRAY(proto, result, extension , BuildExtension , result);
2886 if (!proto.has_options()) {
2889 AllocateOptions(proto.options(), result);
2893 proto, Symbol(result));
2901 AddError(field->full_name(), proto.extension_range(j),
2917 AddError(result->full_name(), proto.extension_range(j),
2928 void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto,
2936 full_name->append(proto.name());
2938 ValidateSymbolName(proto.name(), *full_name, proto);
2940 result->name_ = tables_->AllocateString(proto.name());
2943 result->number_ = proto.number();
2946 // If .proto files follow the style guide then the name should already be
2949 string lowercase_name(proto.name());
2951 if (lowercase_name == proto.name()) {
2958 // .proto files that follow the guide shouldn't be using names in this
2960 result->camelcase_name_ = tables_->AllocateString(ToCamelCase(proto.name()));
2965 implicit_cast<int>(proto.type()));
2967 implicit_cast<int>(proto.label()));
2976 result->has_default_value_ = proto.has_default_value();
2977 if (proto.has_default_value() && result->is_repeated()) {
2978 AddError(result->full_name(), proto,
2983 if (proto.has_type()) {
2984 if (proto.has_default_value()) {
2989 strtol(proto.default_value().c_str(), &end_pos, 0);
2993 strto64(proto.default_value().c_str(), &end_pos, 0);
2997 strtoul(proto.default_value().c_str(), &end_pos, 0);
3001 strtou64(proto.default_value().c_str(), &end_pos, 0);
3004 if (proto.default_value() == "inf") {
3006 } else if (proto.default_value() == "-inf") {
3008 } else if (proto.default_value() == "nan") {
3012 NoLocaleStrtod(proto.default_value().c_str(), &end_pos);
3016 if (proto.default_value() == "inf") {
3018 } else if (proto.default_value() == "-inf") {
3020 } else if (proto.default_value() == "nan") {
3024 NoLocaleStrtod(proto.default_value().c_str(), &end_pos);
3028 if (proto.default_value() == "true") {
3030 } else if (proto.default_value() == "false") {
3033 AddError(result->full_name(), proto,
3045 UnescapeCEscapeString(proto.default_value()));
3048 tables_->AllocateString(proto.default_value());
3052 AddError(result->full_name(), proto,
3063 if (proto.default_value().empty() || *end_pos != '\0') {
3064 AddError(result->full_name(), proto,
3107 AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER,
3110 AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER,
3115 AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER,
3124 if (!proto.has_extendee()) {
3125 AddError(result->full_name(), proto,
3132 if (proto.has_extendee()) {
3133 AddError(result->full_name(), proto,
3142 if (!proto.has_options()) {
3145 AllocateOptions(proto.options(), result);
3149 proto, Symbol(result));
3153 const DescriptorProto::ExtensionRange& proto,
3156 result->start = proto.start();
3157 result->end = proto.end();
3159 AddError(parent->full_name(), proto,
3165 AddError(parent->full_name(), proto,
3172 AddError(parent->full_name(), proto,
3178 void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto,
3185 full_name->append(proto.name());
3187 ValidateSymbolName(proto.name(), *full_name, proto);
3189 result->name_ = tables_->AllocateString(proto.name());
3196 if (proto.value_size() == 0) {
3199 AddError(result->full_name(), proto,
3204 BUILD_ARRAY(proto, result, value, BuildEnumValue, result);
3207 if (!proto.has_options()) {
3210 AllocateOptions(proto.options(), result);
3214 proto, Symbol(result));
3217 void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto,
3220 result->name_ = tables_->AllocateString(proto.name());
3221 result->number_ = proto.number();
3231 ValidateSymbolName(proto.name(), *full_name, proto);
3234 if (!proto.has_options()) {
3237 AllocateOptions(proto.options(), result);
3245 proto, Symbol(result));
3271 AddError(result->full_name(), proto,
3285 void DescriptorBuilder::BuildService(const ServiceDescriptorProto& proto,
3290 full_name->append(proto.name());
3292 ValidateSymbolName(proto.name(), *full_name, proto);
3294 result->name_ = tables_->AllocateString(proto.name());
3298 BUILD_ARRAY(proto, result, method, BuildMethod, result);
3301 if (!proto.has_options()) {
3304 AllocateOptions(proto.options(), result);
3308 proto, Symbol(result));
3311 void DescriptorBuilder::BuildMethod(const MethodDescriptorProto& proto,
3314 result->name_ = tables_->AllocateString(proto.name());
3322 ValidateSymbolName(proto.name(), *full_name, proto);
3329 if (!proto.has_options()) {
3332 AllocateOptions(proto.options(), result);
3336 proto, Symbol(result));
3344 FileDescriptor* file, const FileDescriptorProto& proto) {
3350 CrossLinkMessage(&file->message_types_[i], proto.message_type(i));
3354 CrossLinkField(&file->extensions_[i], proto.extension(i));
3358 CrossLinkEnum(&file->enum_types_[i], proto.enum_type(i));
3362 CrossLinkService(&file->services_[i], proto.service(i));
3367 Descriptor* message, const DescriptorProto& proto) {
3373 CrossLinkMessage(&message->nested_types_[i], proto.nested_type(i));
3377 CrossLinkEnum(&message->enum_types_[i], proto.enum_type(i));
3381 CrossLinkField(&message->fields_[i], proto.field(i));
3385 CrossLinkField(&message->extensions_[i], proto.extension(i));
3390 FieldDescriptor* field, const FieldDescriptorProto& proto) {
3395 if (proto.has_extendee()) {
3396 Symbol extendee = LookupSymbol(proto.extendee(), field->full_name(),
3399 AddNotDefinedError(field->full_name(), proto,
3401 proto.extendee());
3404 AddError(field->full_name(), proto,
3406 "\"" + proto.extendee() + "\" is not a message type.");
3412 AddError(field->full_name(), proto,
3421 if (proto.has_type_name()) {
3422 // Assume we are expecting a message type unless the proto contains some
3425 bool expecting_enum = (proto.type() == FieldDescriptorProto::TYPE_ENUM) ||
3426 proto.has_default_value();
3429 LookupSymbol(proto.type_name(), field->full_name(),
3434 AddNotDefinedError(field->full_name(), proto,
3436 proto.type_name());
3440 if (!proto.has_type()) {
3447 AddError(field->full_name(), proto,
3449 "\"" + proto.type_name() + "\" is not a type.");
3456 AddError(field->full_name(), proto,
3458 "\"" + proto.type_name() + "\" is not a message type.");
3464 AddError(field->full_name(), proto,
3470 AddError(field->full_name(), proto,
3472 "\"" + proto.type_name() + "\" is not an enum type.");
3488 LookupSymbolNoPlaceholder(proto.default_value(),
3495 AddError(field->full_name(), proto,
3498 "\" has no value named \"" + proto.default_value() + "\".");
3507 AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE,
3513 AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE,
3526 AddError(field->full_name(), proto,
3534 AddError(field->full_name(), proto,
3555 EnumDescriptor* enum_type, const EnumDescriptorProto& proto) {
3561 CrossLinkEnumValue(&enum_type->values_[i], proto.value(i));
3566 EnumValueDescriptor* enum_value, const EnumValueDescriptorProto& proto) {
3573 ServiceDescriptor* service, const ServiceDescriptorProto& proto) {
3579 CrossLinkMethod(&service->methods_[i], proto.method(i));
3584 MethodDescriptor* method, const MethodDescriptorProto& proto) {
3589 Symbol input_type = LookupSymbol(proto.input_type(), method->full_name());
3591 AddNotDefinedError(method->full_name(), proto,
3593 proto.input_type());
3595 AddError(method->full_name(), proto,
3597 "\"" + proto.input_type() + "\" is not a message type.");
3602 Symbol output_type = LookupSymbol(proto.output_type(), method->full_name());
3604 AddNotDefinedError(method->full_name(), proto,
3606 proto.output_type());
3608 AddError(method->full_name(), proto,
3610 "\"" + proto.output_type() + "\" is not a message type.");
3621 proto.array_name(i)); \
3636 const FileDescriptorProto& proto) {
3647 file->name(), proto,
3659 const DescriptorProto& proto) {
3667 const FieldDescriptorProto& proto) {
3669 ValidateMapKey(field, proto);
3675 field->full_name(), proto,
3689 AddError(field->full_name(), proto,
3694 AddError(field->full_name(), proto,
3704 AddError(field->full_name(), proto,
3713 const EnumDescriptorProto& proto) {
3718 EnumValueDescriptor* enum_value, const EnumValueDescriptorProto& proto) {
3722 const ServiceDescriptorProto& proto) {
3724 AddError(service->full_name(), proto,
3733 const MethodDescriptorProto& proto) {
3738 const FieldDescriptorProto& proto) {
3740 AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE,
3746 AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE,
3753 AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE,
3768 AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE,
3776 AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE,
3782 AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE,
3817 << "No field named \"uninterpreted_option\" in the Options proto.";
3825 << "No field named \"uninterpreted_option\" in the Options proto.";
3878 // the file we're building imported "google/protobuf/descriptors.proto".