[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Codecs.h
blob2c4227dd0ad346a2fe542fcbfcd0f2778013891e
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Codecs.h
7 * $Id: Codecs.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Krishnakumar B <kitty@cs.wustl.edu>
11 * Codecs is a generic wrapper for various encoding and decoding
12 * mechanisms. Currently it includes Base64 content transfer-encoding as
13 * specified by RFC 2045, Multipurpose Internet Mail Extensions (MIME) Part
14 * One: Format of Internet Message Bodies.
17 //=============================================================================
19 #ifndef ACE_CODECS_H
20 #define ACE_CODECS_H
22 #include /**/ "ace/pre.h"
24 #include /**/ "ace/ACE_export.h"
26 #if !defined (ACE_LACKS_PRAGMA_ONCE)
27 # pragma once
28 #endif /* ACE_LACKS_PRAGMA_ONCE */
30 #include "ace/Basic_Types.h"
31 #include "ace/Global_Macros.h"
34 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
36 /**
37 * @class ACE_Base64
39 * @brief Encode/Decode a stream of bytes according to Base64 encoding.
41 * This class provides methods to encode or decode a stream of bytes
42 * to/from Base64 encoding. It doesn't convert the input stream to a
43 * canonical form before encoding.
46 class ACE_Export ACE_Base64
48 public:
50 //@{
52 /**
53 * Encodes a stream of bytes to Base64 data
55 * @param input Binary data in byte stream.
56 * @param input_len Length of the byte stream.
57 * @param output_len Length of the encoded Base64 byte stream.
58 * @param is_chunked If true, terminate 72 character blocks with newline
59 * @return Encoded Base64 data in byte stream or NULL if input data cannot
60 * be encoded.
63 static ACE_Byte* encode (const ACE_Byte* input,
64 const size_t input_len,
65 size_t* output_len,
66 bool is_chunked = true);
67 /**
68 * Decodes a stream of Base64 to bytes data
70 * @param input Encoded Base64 data in byte stream.
71 * @param output_len Length of the binary byte stream.
72 * @return Binary data in byte stream or NULL if input data cannot
73 * be encoded.
75 static ACE_Byte* decode (const ACE_Byte* input,
76 size_t* output_len);
78 /**
79 * Return the length of the encoded input data
81 * @param input Encoded Base64 data in byte stream.
82 * @return Length of the encoded Base64 data.
85 static size_t length (const ACE_Byte* input);
87 //@}
89 protected:
91 // Prevent default construction.
92 ACE_Base64 (void) {}
94 private:
96 // Preventing copying and assignment.
97 ACE_Base64 (ACE_Base64 const &);
98 ACE_Base64 & operator= (ACE_Base64 const &);
100 /// Initialize the tables for encoding/decoding.
101 static void init (void);
103 private:
105 /// Alphabet used for decoding i.e decoder_[alphabet_[i = 0..63]] = i
106 static ACE_Byte decoder_[];
108 /// Alphabet used to check valid range of encoded input i.e
109 /// member_[alphabet_[0..63]] = 1
110 static ACE_Byte member_[];
112 /// Boolean to denote whether initialization is complete
113 static bool init_;
117 ACE_END_VERSIONED_NAMESPACE_DECL
119 #include /**/ "ace/post.h"
121 #endif /* ACE_CODECS_H */