|
<html><head><title>dlib C++ Library - base64_kernel_1.h</title></head><body bgcolor='white'><pre> |
|
<font color='#009900'>// Copyright (C) 2006 Davis E. King ([email protected]) |
|
</font><font color='#009900'>// License: Boost Software License See LICENSE.txt for the full license. |
|
</font><font color='#0000FF'>#ifndef</font> DLIB_BASE64_KERNEl_1_ |
|
<font color='#0000FF'>#define</font> DLIB_BASE64_KERNEl_1_ |
|
|
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../algs.h.html'>../algs.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='base64_kernel_abstract.h.html'>base64_kernel_abstract.h</a>" |
|
<font color='#0000FF'>#include</font> <font color='#5555FF'><</font>iosfwd<font color='#5555FF'>></font> |
|
|
|
<font color='#0000FF'>namespace</font> dlib |
|
<b>{</b> |
|
|
|
<font color='#0000FF'>class</font> <b><a name='base64'></a>base64</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
INITIAL VALUE |
|
- bad_value == 100 |
|
- encode_table == a pointer to an array of 64 chars |
|
- where x is a 6 bit value the following is true: |
|
- encode_table[x] == the base64 encoding of x |
|
- decode_table == a pointer to an array of UCHAR_MAX chars |
|
- where x is any char value: |
|
- if (x is a valid character in the base64 coding scheme) then |
|
- decode_table[x] == the 6 bit value that x encodes |
|
- else |
|
- decode_table[x] == bad_value |
|
|
|
CONVENTION |
|
- The state of this object never changes so just refer to its |
|
initial value. |
|
|
|
|
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
<font color='#009900'>// this is here for backwards compatibility with older versions of dlib. |
|
</font> <font color='#0000FF'>typedef</font> base64 kernel_1a; |
|
|
|
<font color='#0000FF'>class</font> <b><a name='decode_error'></a>decode_error</b> : <font color='#0000FF'>public</font> dlib::error <b>{</b> <font color='#0000FF'>public</font>: |
|
<b><a name='decode_error'></a>decode_error</b><font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&</font> e<font face='Lucida Console'>)</font> : error<font face='Lucida Console'>(</font>e<font face='Lucida Console'>)</font> <b>{</b><b>}</b><b>}</b>; |
|
|
|
<b><a name='base64'></a>base64</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
|
|
<font color='#0000FF'>virtual</font> ~<b><a name='base64'></a>base64</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
|
|
<font color='#0000FF'>enum</font> <b><a name='line_ending_type'></a>line_ending_type</b> |
|
<b>{</b> |
|
CR, <font color='#009900'>// i.e. "\r" |
|
</font> LF, <font color='#009900'>// i.e. "\n" |
|
</font> CRLF <font color='#009900'>// i.e. "\r\n" |
|
</font> <b>}</b>; |
|
|
|
line_ending_type <b><a name='line_ending'></a>line_ending</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='set_line_ending'></a>set_line_ending</b> <font face='Lucida Console'>(</font> |
|
line_ending_type eol_style_ |
|
<font face='Lucida Console'>)</font>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='encode'></a>encode</b> <font face='Lucida Console'>(</font> |
|
std::istream<font color='#5555FF'>&</font> in, |
|
std::ostream<font color='#5555FF'>&</font> out |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='decode'></a>decode</b> <font face='Lucida Console'>(</font> |
|
std::istream<font color='#5555FF'>&</font> in, |
|
std::ostream<font color='#5555FF'>&</font> out |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#0000FF'><u>char</u></font><font color='#5555FF'>*</font> encode_table; |
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>char</u></font><font color='#5555FF'>*</font> decode_table; |
|
<font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>char</u></font> bad_value; |
|
line_ending_type eol_style; |
|
|
|
<font color='#009900'>// restricted functions |
|
</font> <b><a name='base64'></a>base64</b><font face='Lucida Console'>(</font>base64<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// copy constructor |
|
</font> base64<font color='#5555FF'>&</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>base64<font color='#5555FF'>&</font><font face='Lucida Console'>)</font>; <font color='#009900'>// assignment operator |
|
</font> |
|
<b>}</b>; |
|
|
|
<b>}</b> |
|
|
|
<font color='#0000FF'>#ifdef</font> NO_MAKEFILE |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='base64_kernel_1.cpp.html'>base64_kernel_1.cpp</a>" |
|
<font color='#0000FF'>#endif</font> |
|
|
|
<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_BASE64_KERNEl_1_ |
|
</font> |
|
|
|
</pre></body></html> |