Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef HEADLESS_PUBLIC_UTIL_ERROR_REPORTER_H_ | |
| 6 #define HEADLESS_PUBLIC_UTIL_ERROR_REPORTER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "headless/public/headless_export.h" | |
| 12 | |
| 13 namespace headless { | |
| 14 | |
| 15 // Tracks errors which are encountered while parsing client API types. | |
| 16 class HEADLESS_EXPORT ErrorReporter { | |
| 17 public: | |
| 18 ErrorReporter(); | |
| 19 ~ErrorReporter(); | |
| 20 | |
| 21 // Enter a new nested parsing context. | |
| 22 void Push(); | |
|
altimin
2016/04/11 14:49:57
Can we merge Push and SetName?
Sami
2016/04/11 15:04:10
When parsing a large object the expected usage pat
| |
| 23 | |
| 24 // Leave the current parsing context, returning to the previous one. | |
| 25 void Pop(); | |
| 26 | |
| 27 // Set the name of the current parsing context. |name| must be a string with | |
| 28 // application lifetime. | |
| 29 void SetName(const char* name); | |
| 30 | |
| 31 // Report an error in the current parsing context. | |
| 32 void AddError(const char* description); | |
| 33 | |
| 34 // Returns true if any errors have been reported so far. | |
| 35 bool HasErrors() const; | |
| 36 | |
| 37 // Returns a list of reported errors. | |
| 38 const std::vector<std::string>& errors() const { return errors_; } | |
| 39 | |
| 40 private: | |
| 41 std::vector<const char*> path_; | |
| 42 std::vector<std::string> errors_; | |
| 43 }; | |
| 44 | |
| 45 } // namespace headless | |
| 46 | |
| 47 #endif // HEADLESS_PUBLIC_UTIL_ERROR_REPORTER_H_ | |
| OLD | NEW |