1 /* 2 * Copyright 2006-2008 The FLWOR Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #pragma once 17 #ifndef ZORBA_BASE64_IMPLEMENTATION 18 #define ZORBA_BASE64_IMPLEMENTATION 19 20 #include <stdlib.h> 21 22 namespace zorba{ 23 namespace serialization{ 24 25 class Base64Impl 26 { 27 public: 28 static const char base64chars[]; 29 public: 30 static size_t Encode(const unsigned char *datain, size_t datalen, 31 char *dataout);///pre-allocated at the right size 32 static size_t Decode(const unsigned char *datain, size_t datalen, 33 unsigned char *dataout); 34 protected: 35 static unsigned char getChar6BitIndex(char c); 36 }; 37 38 }} 39 #endif 40 /* vim:set et sw=2 ts=2: */ 41