Upload upstream chromium 67.0.3396
[platform/framework/web/chromium-efl.git] / url / url_canon_stdstring.cc
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "url/url_canon_stdstring.h"
6
7 namespace url {
8
9 StdStringCanonOutput::StdStringCanonOutput(std::string* str)
10     : CanonOutput(), str_(str) {
11   cur_len_ = static_cast<int>(str_->size());  // Append to existing data.
12   buffer_ = str_->empty() ? NULL : &(*str_)[0];
13   buffer_len_ = static_cast<int>(str_->size());
14 }
15
16 StdStringCanonOutput::~StdStringCanonOutput() {
17   // Nothing to do, we don't own the string.
18 }
19
20 void StdStringCanonOutput::Complete() {
21   str_->resize(cur_len_);
22   buffer_len_ = cur_len_;
23 }
24
25 void StdStringCanonOutput::Resize(int sz) {
26   str_->resize(sz);
27   buffer_ = str_->empty() ? NULL : &(*str_)[0];
28   buffer_len_ = sz;
29 }
30
31 }  // namespace url