OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 namespace util { | 50 namespace util { |
51 namespace converter { | 51 namespace converter { |
52 | 52 |
53 // Interface for error listener. | 53 // Interface for error listener. |
54 class LIBPROTOBUF_EXPORT ErrorListener { | 54 class LIBPROTOBUF_EXPORT ErrorListener { |
55 public: | 55 public: |
56 virtual ~ErrorListener() {} | 56 virtual ~ErrorListener() {} |
57 | 57 |
58 // Reports an invalid name at the given location. | 58 // Reports an invalid name at the given location. |
59 virtual void InvalidName(const LocationTrackerInterface& loc, | 59 virtual void InvalidName(const LocationTrackerInterface& loc, |
60 StringPiece invalid_name, StringPiece message) = 0; | 60 StringPiece unknown_name, StringPiece message) = 0; |
61 | 61 |
62 // Reports an invalid value for a field. | 62 // Reports an invalid value for a field. |
63 virtual void InvalidValue(const LocationTrackerInterface& loc, | 63 virtual void InvalidValue(const LocationTrackerInterface& loc, |
64 StringPiece type_name, StringPiece value) = 0; | 64 StringPiece type_name, StringPiece value) = 0; |
65 | 65 |
66 // Reports a missing required field. | 66 // Reports a missing required field. |
67 virtual void MissingField(const LocationTrackerInterface& loc, | 67 virtual void MissingField(const LocationTrackerInterface& loc, |
68 StringPiece missing_name) = 0; | 68 StringPiece missing_name) = 0; |
69 | 69 |
70 protected: | 70 protected: |
71 ErrorListener() {} | 71 ErrorListener() {} |
72 | 72 |
73 private: | 73 private: |
74 // Do not add any data members to this class. | 74 // Do not add any data members to this class. |
75 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ErrorListener); | 75 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ErrorListener); |
76 }; | 76 }; |
77 | 77 |
78 // An error listener that ignores all errors. | 78 // An error listener that ignores all errors. |
79 class LIBPROTOBUF_EXPORT NoopErrorListener : public ErrorListener { | 79 class LIBPROTOBUF_EXPORT NoopErrorListener : public ErrorListener { |
80 public: | 80 public: |
81 NoopErrorListener() {} | 81 NoopErrorListener() {} |
82 virtual ~NoopErrorListener() {} | 82 virtual ~NoopErrorListener() {} |
83 | 83 |
84 virtual void InvalidName(const LocationTrackerInterface& loc, | 84 virtual void InvalidName(const LocationTrackerInterface& loc, |
85 StringPiece invalid_name, StringPiece message) {} | 85 StringPiece unknown_name, StringPiece message) {} |
86 | 86 |
87 virtual void InvalidValue(const LocationTrackerInterface& loc, | 87 virtual void InvalidValue(const LocationTrackerInterface& loc, |
88 StringPiece type_name, StringPiece value) {} | 88 StringPiece type_name, StringPiece value) {} |
89 | 89 |
90 virtual void MissingField(const LocationTrackerInterface& loc, | 90 virtual void MissingField(const LocationTrackerInterface& loc, |
91 StringPiece missing_name) {} | 91 StringPiece missing_name) {} |
92 | 92 |
93 private: | 93 private: |
94 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(NoopErrorListener); | 94 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(NoopErrorListener); |
95 }; | 95 }; |
96 | 96 |
97 | 97 |
98 } // namespace converter | 98 } // namespace converter |
99 } // namespace util | 99 } // namespace util |
100 } // namespace protobuf | 100 } // namespace protobuf |
101 | 101 |
102 } // namespace google | 102 } // namespace google |
103 #endif // GOOGLE_PROTOBUF_UTIL_CONVERTER_ERROR_LISTENER_H__ | 103 #endif // GOOGLE_PROTOBUF_UTIL_CONVERTER_ERROR_LISTENER_H__ |
OLD | NEW |