1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/utils/SkBase64.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +/* 1.5 + * Copyright 2006 The Android Open Source Project 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef SkBase64_DEFINED 1.12 +#define SkBase64_DEFINED 1.13 + 1.14 +#include "SkTypes.h" 1.15 + 1.16 +struct SkBase64 { 1.17 +public: 1.18 + enum Error { 1.19 + kNoError, 1.20 + kPadError, 1.21 + kBadCharError 1.22 + }; 1.23 + 1.24 + SkBase64(); 1.25 + Error decode(const char* src, size_t length); 1.26 + char* getData() { return fData; } 1.27 + /** 1.28 + Base64 encodes src into dst. encode is a pointer to at least 65 chars. 1.29 + encode[64] will be used as the pad character. Encodings other than the 1.30 + default encoding cannot be decoded. 1.31 + */ 1.32 + static size_t Encode(const void* src, size_t length, void* dest, const char* encode = NULL); 1.33 + 1.34 +private: 1.35 + Error decode(const void* srcPtr, size_t length, bool writeDestination); 1.36 + 1.37 + size_t fLength; 1.38 + char* fData; 1.39 + friend class SkImageBaseBitmap; 1.40 +}; 1.41 + 1.42 +#endif // SkBase64_DEFINED