| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 //#include "ErrorSupport.h" | 5 //#include "ErrorSupport.h" |
| 6 | 6 |
| 7 {% for namespace in config.protocol.namespace %} | 7 {% for namespace in config.protocol.namespace %} |
| 8 namespace {{namespace}} { | 8 namespace {{namespace}} { |
| 9 {% endfor %} | 9 {% endfor %} |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 void ErrorSupport::pop() | 25 void ErrorSupport::pop() |
| 26 { | 26 { |
| 27 m_path.pop_back(); | 27 m_path.pop_back(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void ErrorSupport::addError(const String& error) | 30 void ErrorSupport::addError(const String& error) |
| 31 { | 31 { |
| 32 StringBuilder builder; | 32 StringBuilder builder; |
| 33 for (size_t i = 0; i < m_path.size(); ++i) { | 33 for (size_t i = 0; i < m_path.size(); ++i) { |
| 34 if (i) | 34 if (i) |
| 35 builder.append('.'); | 35 StringUtil::builderAppend(builder, '.'); |
| 36 builder.append(m_path[i]); | 36 StringUtil::builderAppend(builder, m_path[i]); |
| 37 } | 37 } |
| 38 builder.append(": "); | 38 StringUtil::builderAppend(builder, ": "); |
| 39 builder.append(error); | 39 StringUtil::builderAppend(builder, error); |
| 40 m_errors.push_back(builder.toString()); | 40 m_errors.push_back(StringUtil::builderToString(builder)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool ErrorSupport::hasErrors() | 43 bool ErrorSupport::hasErrors() |
| 44 { | 44 { |
| 45 return !!m_errors.size(); | 45 return !!m_errors.size(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 String ErrorSupport::errors() | 48 String ErrorSupport::errors() |
| 49 { | 49 { |
| 50 StringBuilder builder; | 50 StringBuilder builder; |
| 51 for (size_t i = 0; i < m_errors.size(); ++i) { | 51 for (size_t i = 0; i < m_errors.size(); ++i) { |
| 52 if (i) | 52 if (i) |
| 53 builder.append("; "); | 53 StringUtil::builderAppend(builder, "; "); |
| 54 builder.append(m_errors[i]); | 54 StringUtil::builderAppend(builder, m_errors[i]); |
| 55 } | 55 } |
| 56 return builder.toString(); | 56 return StringUtil::builderToString(builder); |
| 57 } | 57 } |
| 58 | 58 |
| 59 {% for namespace in config.protocol.namespace %} | 59 {% for namespace in config.protocol.namespace %} |
| 60 } // namespace {{namespace}} | 60 } // namespace {{namespace}} |
| 61 {% endfor %} | 61 {% endfor %} |
| OLD | NEW |