michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkBase64_DEFINED michael@0: #define SkBase64_DEFINED michael@0: michael@0: #include "SkTypes.h" michael@0: michael@0: struct SkBase64 { michael@0: public: michael@0: enum Error { michael@0: kNoError, michael@0: kPadError, michael@0: kBadCharError michael@0: }; michael@0: michael@0: SkBase64(); michael@0: Error decode(const char* src, size_t length); michael@0: char* getData() { return fData; } michael@0: /** michael@0: Base64 encodes src into dst. encode is a pointer to at least 65 chars. michael@0: encode[64] will be used as the pad character. Encodings other than the michael@0: default encoding cannot be decoded. michael@0: */ michael@0: static size_t Encode(const void* src, size_t length, void* dest, const char* encode = NULL); michael@0: michael@0: private: michael@0: Error decode(const void* srcPtr, size_t length, bool writeDestination); michael@0: michael@0: size_t fLength; michael@0: char* fData; michael@0: friend class SkImageBaseBitmap; michael@0: }; michael@0: michael@0: #endif // SkBase64_DEFINED