Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Base64.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_Base64_H
00002 #define INCLUDED_Base64_H
00003 /*! @file
00004  * @brief Describes base64 namespace, which holds some functions for encoding and decoding base64 data
00005  * C_Base64 - a simple base64 encoder and decoder.
00006  *
00007  *     Copyright (c) 1999, Bob Withers - bwit@pobox.com
00008  *
00009  * This code may be freely used for any purpose, either personal
00010  * or commercial, provided the authors copyright notice remains
00011  * intact.
00012  *
00013  * Modified by Ethan Tira-Thompson:
00014  *     - changed Base64 class to base64 namespace
00015  *     - modified functions to work on char[] instead of strings
00016  *     - added doxygen comments to header
00017  *
00018  * @author Bob Withers - bwit@pobox.com (Creator)
00019  */
00020 
00021 #include <string>
00022 
00023 //! holds some functions for encoding and decoding base64 data
00024 namespace base64
00025 {
00026 
00027   //! returns a string containing the base64 encoding of @a len bytes from @a buf
00028   std::string encode(char buf[], unsigned int len);
00029 
00030   //! returns a pointer to a newly allocated region contained the binary data decoded from @a data
00031   /*! If @a data is malformed @c NULL will be returned */
00032   char* decode(const std::string& data);
00033 
00034   //! returns the number of bytes which will be decoded from @a data
00035   /*! Does not check data for correctness, just counts the fill
00036    *  characters at the end of the string */
00037   unsigned int decodeSize(const std::string& data);
00038 
00039   //! decodes @a data into @a buf, which you need to provide the size of in @a len
00040   /*! If @a buf is not large enough or @a data is malformed, @c false
00041    *  will be returned; otherwise @c true */
00042   bool decode(const std::string& data, char buf[], unsigned int len);
00043 }
00044 
00045 
00046 #endif

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:36 2016 by Doxygen 1.6.3