OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TOOLS_GN_ERR_H_ | 5 #ifndef TOOLS_GN_ERR_H_ |
6 #define TOOLS_GN_ERR_H_ | 6 #define TOOLS_GN_ERR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Error at a given node. | 47 // Error at a given node. |
48 Err(const ParseNode* node, | 48 Err(const ParseNode* node, |
49 const std::string& msg, | 49 const std::string& msg, |
50 const std::string& help_text = std::string()); | 50 const std::string& help_text = std::string()); |
51 | 51 |
52 // Error at a given value. | 52 // Error at a given value. |
53 Err(const Value& value, | 53 Err(const Value& value, |
54 const std::string msg, | 54 const std::string msg, |
55 const std::string& help_text = std::string()); | 55 const std::string& help_text = std::string()); |
56 | 56 |
| 57 Err(const Err& other); |
| 58 |
57 ~Err(); | 59 ~Err(); |
58 | 60 |
59 bool has_error() const { return has_error_; } | 61 bool has_error() const { return has_error_; } |
60 const Location& location() const { return location_; } | 62 const Location& location() const { return location_; } |
61 const std::string& message() const { return message_; } | 63 const std::string& message() const { return message_; } |
62 const std::string& help_text() const { return help_text_; } | 64 const std::string& help_text() const { return help_text_; } |
63 | 65 |
64 void AppendRange(const LocationRange& range) { ranges_.push_back(range); } | 66 void AppendRange(const LocationRange& range) { ranges_.push_back(range); } |
65 const RangeList& ranges() const { return ranges_; } | 67 const RangeList& ranges() const { return ranges_; } |
66 | 68 |
67 void AppendSubErr(const Err& err); | 69 void AppendSubErr(const Err& err); |
68 | 70 |
69 void PrintToStdout() const; | 71 void PrintToStdout() const; |
70 | 72 |
71 private: | 73 private: |
72 void InternalPrintToStdout(bool is_sub_err) const; | 74 void InternalPrintToStdout(bool is_sub_err) const; |
73 | 75 |
74 bool has_error_; | 76 bool has_error_; |
75 Location location_; | 77 Location location_; |
76 | 78 |
77 std::vector<LocationRange> ranges_; | 79 std::vector<LocationRange> ranges_; |
78 | 80 |
79 std::string message_; | 81 std::string message_; |
80 std::string help_text_; | 82 std::string help_text_; |
81 | 83 |
82 std::vector<Err> sub_errs_; | 84 std::vector<Err> sub_errs_; |
83 }; | 85 }; |
84 | 86 |
85 #endif // TOOLS_GN_ERR_H_ | 87 #endif // TOOLS_GN_ERR_H_ |
OLD | NEW |