• 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_OBJECTIVEC_LINE_CONSUMER_H__
9 #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_LINE_CONSUMER_H__
10 
11 #include <string>
12 
13 #include "absl/strings/string_view.h"
14 #include "google/protobuf/io/zero_copy_stream.h"
15 
16 // Must be included last
17 #include "google/protobuf/port_def.inc"
18 
19 namespace google {
20 namespace protobuf {
21 namespace compiler {
22 namespace objectivec {
23 
24 // TODO: PROTOC_EXPORT is only used to allow the CMake build to
25 // find/link these in the unittest, this is not public api.
26 
27 // Helper for parsing simple files.
28 class PROTOC_EXPORT LineConsumer {
29  public:
30   LineConsumer() = default;
31   virtual ~LineConsumer() = default;
32   virtual bool ConsumeLine(absl::string_view line, std::string* out_error) = 0;
33 };
34 
35 bool PROTOC_EXPORT ParseSimpleFile(absl::string_view path,
36                                    LineConsumer* line_consumer,
37                                    std::string* out_error);
38 
39 bool PROTOC_EXPORT ParseSimpleStream(io::ZeroCopyInputStream& input_stream,
40                                      absl::string_view stream_name,
41                                      LineConsumer* line_consumer,
42                                      std::string* out_error);
43 
44 }  // namespace objectivec
45 }  // namespace compiler
46 }  // namespace protobuf
47 }  // namespace google
48 
49 #include "google/protobuf/port_undef.inc"
50 
51 #endif  // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_LINE_CONSUMER_H__
52