00001 // -*- C++ -*- 00002 00003 /** 00004 * @file XML_Codecs.h 00005 * 00006 * XML_Codecs.h,v 1.5 2003/07/19 19:04:10 dhinton Exp 00007 * 00008 * @author Krishnakumar B <kitty@cs.wustl.edu> 00009 * 00010 * XML_Codecs is a generic wrapper for various encoding and decoding 00011 * mechanisms used in ACEXML. Currently it includes support for handling 00012 * Base64 content transfer-encoding of ACEXML_Chars. 00013 * 00014 */ 00015 00016 #ifndef _ACEXML_XML_CODECS_H 00017 #define _ACEXML_XML_CODECS_H 00018 00019 #include /**/ "ace/pre.h" 00020 #include "ACEXML/common/ACEXML_Export.h" 00021 00022 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00023 #pragma once 00024 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00025 00026 #include "ACEXML/common/XML_Types.h" 00027 #include "ace/Codecs.h" 00028 00029 /** 00030 * @class ACEXML_Base64 00031 * 00032 * @brief Encode/Decode a stream of ACEXML_Chars according to Base64 encoding. 00033 * 00034 * This class provides methods to encode or decode a stream of ACEXML_Chars 00035 * to/from Base64 encoding. It doesn't convert the input stream to a 00036 * canonical form before encoding. 00037 * 00038 */ 00039 class ACEXML_Export ACEXML_Base64 : public ACE_Base64 00040 { 00041 public: 00042 00043 //@{ 00044 00045 /** 00046 * Encodes a stream of octets to Base64 data 00047 * 00048 * @param input Binary data in ACEXML_Char stream. 00049 * @param output_len Length of the encoded Base64 ACEXML_Char stream. 00050 * @return Encoded Base64 data in ACEXML_Char stream or NULL if input data 00051 * cannot be encoded. 00052 */ 00053 00054 static ACEXML_Char* encode (const ACEXML_Char* input, 00055 size_t* output_len); 00056 /** 00057 * Decodes a stream of Base64 to octets data 00058 * 00059 * @param input Encoded Base64 data in ACEXML_Char stream. 00060 * @param output_len Length of the binary ACEXML_Char stream. 00061 * @return Binary data in ACEXML_Char stream or NULL if input data cannot 00062 * be encoded. 00063 */ 00064 static ACEXML_Char* decode (const ACEXML_Char* input, 00065 size_t* output_len); 00066 00067 //@} 00068 }; 00069 00070 00071 #include /**/ "ace/post.h" 00072 00073 #endif /* _ACEXML_XML_CODECS_H */