00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _SOCKETS_Base64_H
00033 #define _SOCKETS_Base64_H
00034
00035 #include "sockets-config.h"
00036 #ifdef _MSC_VER
00037 #pragma warning(disable:4514)
00038 #endif
00039
00040 #include <stdio.h>
00041 #include <string>
00042
00043 #ifdef SOCKETS_NAMESPACE
00044 namespace SOCKETS_NAMESPACE {
00045 #endif
00046
00047 class IFile;
00048
00053 class Base64
00054 {
00055 public:
00056 Base64();
00057
00058 void encode(FILE *, std::string& , bool add_crlf = true);
00059 void encode(IFile *, std::string& , bool add_crlf = true);
00060 void encode(const std::string&, std::string& , bool add_crlf = true);
00061 void encode(const char *, size_t, std::string& , bool add_crlf = true);
00062 void encode(const unsigned char *, size_t, std::string& , bool add_crlf = true);
00063
00064 void decode(const std::string&, std::string& );
00065 void decode(const std::string&, unsigned char *, size_t&);
00066
00067 size_t decode_length(const std::string& );
00068
00069 private:
00070 Base64(const Base64& ) {}
00071 Base64& operator=(const Base64& ) { return *this; }
00072 static const char *bstr;
00073 static const char rstr[128];
00074 };
00075
00076
00077 #ifdef SOCKETS_NAMESPACE
00078 }
00079 #endif
00080
00081 #endif // _SOCKETS_Base64_H
00082