kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/cxx/indexer/proto/marked_source.h (about) 1 /* 2 * Copyright 2018 The Kythe Authors. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef KYTHE_CXX_INDEXER_PROTO_MARKED_SOURCE_H_ 18 #define KYTHE_CXX_INDEXER_PROTO_MARKED_SOURCE_H_ 19 20 #include <optional> 21 22 #include "google/protobuf/descriptor.h" 23 #include "kythe/cxx/common/indexing/KytheOutputStream.h" 24 #include "kythe/cxx/indexer/proto/proto_graph_builder.h" 25 26 namespace kythe { 27 28 // `name` is a proto-style dotted qualified name 29 // `root` is the node to turn into a (box (context) (identifier)) or an 30 // identifier, depending on the structure of `name`. 31 // If given a vname, it will be added as a definition for the identifier. 32 // Returns true if at least one token was found. 33 bool GenerateMarkedSourceForDottedName( 34 absl::string_view name, MarkedSource* root, 35 std::optional<proto::VName> vname = std::nullopt); 36 37 std::optional<MarkedSource> GenerateMarkedSourceForDescriptor( 38 const google::protobuf::Descriptor* descriptor, ProtoGraphBuilder* builder); 39 40 std::optional<MarkedSource> GenerateMarkedSourceForDescriptor( 41 const google::protobuf::EnumDescriptor* descriptor, 42 ProtoGraphBuilder* builder); 43 44 std::optional<MarkedSource> GenerateMarkedSourceForDescriptor( 45 const google::protobuf::EnumValueDescriptor* descriptor, 46 ProtoGraphBuilder* builder); 47 48 std::optional<MarkedSource> GenerateMarkedSourceForDescriptor( 49 const google::protobuf::FieldDescriptor* descriptor, 50 ProtoGraphBuilder* builder); 51 52 std::optional<MarkedSource> GenerateMarkedSourceForDescriptor( 53 const google::protobuf::ServiceDescriptor* descriptor, 54 ProtoGraphBuilder* builder); 55 56 std::optional<MarkedSource> GenerateMarkedSourceForDescriptor( 57 const google::protobuf::MethodDescriptor* descriptor, 58 ProtoGraphBuilder* builder); 59 60 std::optional<MarkedSource> GenerateMarkedSourceForDescriptor( 61 const google::protobuf::OneofDescriptor* descriptor, 62 ProtoGraphBuilder* builder); 63 64 } // namespace kythe 65 66 #endif // KYTHE_CXX_INDEXER_PROTO_MARKED_SOURCE_H_