• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 #ifndef GOOGLE_PROTOBUF_COMPILER_PYTHON_HELPERS_H__
9 #define GOOGLE_PROTOBUF_COMPILER_PYTHON_HELPERS_H__
10 
11 #include <string>
12 
13 #include "absl/strings/str_replace.h"
14 #include "absl/strings/string_view.h"
15 #include "google/protobuf/descriptor.h"
16 #include "google/protobuf/descriptor.pb.h"
17 
18 namespace google {
19 namespace protobuf {
20 namespace compiler {
21 namespace python {
22 
23 std::string ModuleName(absl::string_view filename);
24 std::string StrippedModuleName(absl::string_view filename);
25 bool ContainsPythonKeyword(absl::string_view module_name);
26 bool IsPythonKeyword(absl::string_view name);
27 std::string ResolveKeyword(absl::string_view name);
28 std::string GetFileName(const FileDescriptor* file_des,
29                         absl::string_view suffix);
30 bool HasGenericServices(const FileDescriptor* file);
31 std::string GeneratedCodeToBase64(const GeneratedCodeInfo& annotations);
32 
33 template <typename DescriptorT>
34 std::string NamePrefixedWithNestedTypes(const DescriptorT& descriptor,
35                                         absl::string_view separator);
36 
37 }  // namespace python
38 }  // namespace compiler
39 }  // namespace protobuf
40 }  // namespace google
41 
42 #endif  // GOOGLE_PROTOBUF_COMPILER_PYTHON_HELPERS_H__
43