epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 1 | |
| 2 | /* |
| 3 | * Copyright 2006 The Android Open Source Project |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 9 | |
| 10 | #ifndef SkBase64_DEFINED |
| 11 | #define SkBase64_DEFINED |
| 12 | |
| 13 | #include "SkTypes.h" |
| 14 | |
| 15 | struct SkBase64 { |
| 16 | public: |
| 17 | enum Error { |
| 18 | kNoError, |
| 19 | kPadError, |
| 20 | kBadCharError |
| 21 | }; |
| 22 | |
| 23 | SkBase64(); |
| 24 | Error decode(const char* src, size_t length); |
| 25 | char* getData() { return fData; } |
| 26 | static size_t Encode(const void* src, size_t length, void* dest); |
| 27 | |
| 28 | #ifdef SK_SUPPORT_UNITTEST |
| 29 | static void UnitTest(); |
| 30 | #endif |
| 31 | private: |
| 32 | Error decode(const void* srcPtr, size_t length, bool writeDestination); |
| 33 | |
| 34 | size_t fLength; |
| 35 | char* fData; |
| 36 | friend class SkImage; |
| 37 | }; |
| 38 | |
| 39 | #endif // SkBase64_DEFINED |