• 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_TF_DECODE_DATA_H__
9 #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_TF_DECODE_DATA_H__
10 
11 #include <cstddef>
12 #include <cstdint>
13 #include <string>
14 #include <utility>
15 #include <vector>
16 
17 // Must be included last
18 #include "google/protobuf/port_def.inc"
19 
20 namespace google {
21 namespace protobuf {
22 namespace compiler {
23 namespace objectivec {
24 
25 // TODO: PROTOC_EXPORT is only used to allow the CMake build to
26 // find/link these in the unittest, this is not public api.
27 
28 // Generate decode data needed for ObjC's GPBDecodeTextFormatName() to transform
29 // the input into the expected output.
30 class PROTOC_EXPORT TextFormatDecodeData {
31  public:
32   TextFormatDecodeData() = default;
33   ~TextFormatDecodeData() = default;
34 
35   TextFormatDecodeData(const TextFormatDecodeData&) = delete;
36   TextFormatDecodeData& operator=(const TextFormatDecodeData&) = delete;
37 
38   void AddString(int32_t key, const std::string& input_for_decode,
39                  const std::string& desired_output);
num_entries()40   size_t num_entries() const { return entries_.size(); }
41   std::string Data() const;
42 
43   static std::string DecodeDataForString(const std::string& input_for_decode,
44                                          const std::string& desired_output);
45 
46  private:
47   typedef std::pair<int32_t, std::string> DataEntry;
48   std::vector<DataEntry> entries_;
49 };
50 
51 }  // namespace objectivec
52 }  // namespace compiler
53 }  // namespace protobuf
54 }  // namespace google
55 
56 #include "google/protobuf/port_undef.inc"
57 
58 #endif  // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_TF_DECODE_DATA_H__
59