blob: 69d256c9c2d789703b6ca568e3eb1fe53b87e18a [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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.com8a1c16f2008-12-17 15:59:43 +00009
10#ifndef SkBase64_DEFINED
11#define SkBase64_DEFINED
12
13#include "SkTypes.h"
14
15struct SkBase64 {
16public:
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
31private:
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