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

Side by Side Diff: chrome/common/libxml_utils.h

Issue 40226: Fix files with lines > 80 cols. Part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/l10n_util.cc ('k') | chrome/common/mach_ipc_mac.h » ('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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 CHROME_COMMON_LIBXML_UTILS_H__ 5 #ifndef CHROME_COMMON_LIBXML_UTILS_H__
6 #define CHROME_COMMON_LIBXML_UTILS_H__ 6 #define CHROME_COMMON_LIBXML_UTILS_H__
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "libxml/xmlreader.h" 10 #include "libxml/xmlreader.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Adds a new element with name |element_name| and content |content| 156 // Adds a new element with name |element_name| and content |content|
157 // to the buffer. Example: <|element_name|>|content|</|element_name|> 157 // to the buffer. Example: <|element_name|>|content|</|element_name|>
158 // Returns false on errors. 158 // Returns false on errors.
159 bool WriteElement(const std::string& element_name, 159 bool WriteElement(const std::string& element_name,
160 const std::string& content) { 160 const std::string& content) {
161 return xmlTextWriterWriteElement(writer_, 161 return xmlTextWriterWriteElement(writer_,
162 BAD_CAST element_name.c_str(), 162 BAD_CAST element_name.c_str(),
163 BAD_CAST content.c_str()) >= 0; 163 BAD_CAST content.c_str()) >= 0;
164 } 164 }
165 165
166 // Helper functions not provided by xmlTextWriter ---------------------------- ------ 166 // Helper functions not provided by xmlTextWriter ---------------------------
167 167
168 // Returns the string that has been written to the buffer. 168 // Returns the string that has been written to the buffer.
169 std::string GetWrittenString() { 169 std::string GetWrittenString() {
170 if (buffer_ == NULL) 170 if (buffer_ == NULL)
171 return ""; 171 return "";
172 return XmlStringToStdString(buffer_->content); 172 return XmlStringToStdString(buffer_->content);
173 } 173 }
174 174
175 private: 175 private:
176 // The underlying libxml xmlTextWriter. 176 // The underlying libxml xmlTextWriter.
177 xmlTextWriterPtr writer_; 177 xmlTextWriterPtr writer_;
178 178
179 // Stores the output. 179 // Stores the output.
180 xmlBufferPtr buffer_; 180 xmlBufferPtr buffer_;
181 }; 181 };
182 182
183 #endif // CHROME_COMMON_LIBXML_UTILS_H__ 183 #endif // CHROME_COMMON_LIBXML_UTILS_H__
184 184
OLDNEW
« no previous file with comments | « chrome/common/l10n_util.cc ('k') | chrome/common/mach_ipc_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698