OSDN Git Service

base64.hpp
authorMyun2 <myun2@nwhite.info>
Mon, 21 May 2012 13:53:27 +0000 (22:53 +0900)
committerMyun2 <myun2@nwhite.info>
Mon, 21 May 2012 13:53:27 +0000 (22:53 +0900)
roast/include/roast/net/base64.hpp

index 2d81775..077cad7 100644 (file)
@@ -9,21 +9,32 @@ namespace roast
 {
        struct base64
        {
+               static const char* table;
+               
                template <typename _InputIterator, typename _OutputStream>
-               void encode(const _InputIterator& it, _OutputStream& os)
+               void encode(_InputIterator it, _OutputStream& os)
                {
-               
+                       for(; it.available(); it++)
+                       {
+                               //      Check the char
+                               const _It it_work = it;
+                               _EncCheck checker;
+                               if ( checker.analyze(it_work, param) == false )
+                                       break;
+
+                               m_str.append(1,*p);
+                       }
                }
                template <typename _InputIterator, typename _OutputStream>
-               void decode(const _InputIterator& it, _OutputStream& os)
+               void decode(_InputIterator it, _OutputStream& os)
                {
                
                }
        };
+       
+       const char* base64::table =     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
 }
 
-#define _ROAST_BASE64_ENC_TABLE                "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
-
 inline void roast_base64_enc(const char* s, size_t length, char* result)
 {
        const char* p_in = s;