Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: lib/ErrorSupport_cpp.template

Issue 2655203003: Adapt StringBuilder's append and toString methods via StringUtil helper. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/Parser_cpp.template » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 %}
OLDNEW
« no previous file with comments | « no previous file | lib/Parser_cpp.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698