1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "url/url_canon_stdstring.h"
9 StdStringCanonOutput::StdStringCanonOutput(std::string* str) : str_(str) {
10 cur_len_ = str_->size(); // Append to existing data.
11 buffer_ = str_->empty() ? nullptr : &(*str_)[0];
12 buffer_len_ = str_->size();
15 StdStringCanonOutput::~StdStringCanonOutput() {
16 // Nothing to do, we don't own the string.
19 void StdStringCanonOutput::Complete() {
20 str_->resize(cur_len_);
21 buffer_len_ = cur_len_;
24 void StdStringCanonOutput::Resize(size_t sz) {
26 buffer_ = str_->empty() ? nullptr : &(*str_)[0];