| 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 |
| 11 ErrorSupport::ErrorSupport() { } | 11 ErrorSupport::ErrorSupport() { } |
| 12 ErrorSupport::~ErrorSupport() { } | 12 ErrorSupport::~ErrorSupport() { } |
| 13 | 13 |
| 14 void ErrorSupport::setName(const char* name) |
| 15 { |
| 16 setName(String(name)); |
| 17 } |
| 18 |
| 14 void ErrorSupport::setName(const String& name) | 19 void ErrorSupport::setName(const String& name) |
| 15 { | 20 { |
| 16 DCHECK(m_path.size()); | 21 DCHECK(m_path.size()); |
| 17 m_path[m_path.size() - 1] = name; | 22 m_path[m_path.size() - 1] = name; |
| 18 } | 23 } |
| 19 | 24 |
| 20 void ErrorSupport::push() | 25 void ErrorSupport::push() |
| 21 { | 26 { |
| 22 m_path.push_back(String()); | 27 m_path.push_back(String()); |
| 23 } | 28 } |
| 24 | 29 |
| 25 void ErrorSupport::pop() | 30 void ErrorSupport::pop() |
| 26 { | 31 { |
| 27 m_path.pop_back(); | 32 m_path.pop_back(); |
| 28 } | 33 } |
| 29 | 34 |
| 35 void ErrorSupport::addError(const char* error) |
| 36 { |
| 37 addError(String(error)); |
| 38 } |
| 39 |
| 30 void ErrorSupport::addError(const String& error) | 40 void ErrorSupport::addError(const String& error) |
| 31 { | 41 { |
| 32 StringBuilder builder; | 42 StringBuilder builder; |
| 33 for (size_t i = 0; i < m_path.size(); ++i) { | 43 for (size_t i = 0; i < m_path.size(); ++i) { |
| 34 if (i) | 44 if (i) |
| 35 StringUtil::builderAppend(builder, '.'); | 45 StringUtil::builderAppend(builder, '.'); |
| 36 StringUtil::builderAppend(builder, m_path[i]); | 46 StringUtil::builderAppend(builder, m_path[i]); |
| 37 } | 47 } |
| 38 StringUtil::builderAppend(builder, ": "); | 48 StringUtil::builderAppend(builder, ": "); |
| 39 StringUtil::builderAppend(builder, error); | 49 StringUtil::builderAppend(builder, error); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 52 if (i) | 62 if (i) |
| 53 StringUtil::builderAppend(builder, "; "); | 63 StringUtil::builderAppend(builder, "; "); |
| 54 StringUtil::builderAppend(builder, m_errors[i]); | 64 StringUtil::builderAppend(builder, m_errors[i]); |
| 55 } | 65 } |
| 56 return StringUtil::builderToString(builder); | 66 return StringUtil::builderToString(builder); |
| 57 } | 67 } |
| 58 | 68 |
| 59 {% for namespace in config.protocol.namespace %} | 69 {% for namespace in config.protocol.namespace %} |
| 60 } // namespace {{namespace}} | 70 } // namespace {{namespace}} |
| 61 {% endfor %} | 71 {% endfor %} |
| OLD | NEW |