1 /* 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 11 #include "rtc_base/crypt_string.h" 12 13 namespace rtc { 14 GetLength() const15size_t EmptyCryptStringImpl::GetLength() const { 16 return 0; 17 } 18 CopyTo(char * dest,bool nullterminate) const19void EmptyCryptStringImpl::CopyTo(char* dest, bool nullterminate) const { 20 if (nullterminate) { 21 *dest = '\0'; 22 } 23 } 24 UrlEncode() const25std::string EmptyCryptStringImpl::UrlEncode() const { 26 return ""; 27 } 28 Copy() const29CryptStringImpl* EmptyCryptStringImpl::Copy() const { 30 return new EmptyCryptStringImpl(); 31 } 32 CopyRawTo(std::vector<unsigned char> * dest) const33void EmptyCryptStringImpl::CopyRawTo(std::vector<unsigned char>* dest) const { 34 dest->clear(); 35 } 36 CryptString()37CryptString::CryptString() : impl_(new EmptyCryptStringImpl()) {} 38 CryptString(const CryptString & other)39CryptString::CryptString(const CryptString& other) 40 : impl_(other.impl_->Copy()) {} 41 CryptString(const CryptStringImpl & impl)42CryptString::CryptString(const CryptStringImpl& impl) : impl_(impl.Copy()) {} 43 44 CryptString::~CryptString() = default; 45 46 } // namespace rtc 47