blob: cf38a5bbaa33301ce40b861e28fc5de5b72ebb62 [file] [log] [blame]
deadbeeff137e972017-03-23 22:45:491/*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Steve Anton10542f22019-01-11 17:11:0011#include "rtc_base/crypt_string.h"
deadbeeff137e972017-03-23 22:45:4912
13namespace rtc {
14
15size_t EmptyCryptStringImpl::GetLength() const {
16 return 0;
17}
18
19void EmptyCryptStringImpl::CopyTo(char* dest, bool nullterminate) const {
20 if (nullterminate) {
21 *dest = '\0';
22 }
23}
24
25std::string EmptyCryptStringImpl::UrlEncode() const {
26 return "";
27}
28
29CryptStringImpl* EmptyCryptStringImpl::Copy() const {
30 return new EmptyCryptStringImpl();
31}
32
33void EmptyCryptStringImpl::CopyRawTo(std::vector<unsigned char>* dest) const {
34 dest->clear();
35}
36
Yves Gerey665174f2018-06-19 13:03:0537CryptString::CryptString() : impl_(new EmptyCryptStringImpl()) {}
deadbeeff137e972017-03-23 22:45:4938
39CryptString::CryptString(const CryptString& other)
Yves Gerey665174f2018-06-19 13:03:0540 : impl_(other.impl_->Copy()) {}
deadbeeff137e972017-03-23 22:45:4941
Yves Gerey665174f2018-06-19 13:03:0542CryptString::CryptString(const CryptStringImpl& impl) : impl_(impl.Copy()) {}
deadbeeff137e972017-03-23 22:45:4943
44CryptString::~CryptString() = default;
45
Nico Weber22f99252019-02-20 15:13:1646} // namespace rtc