llmime.h

Go to the documentation of this file.
00001 
00034 #ifndef LL_LLMIME_H
00035 #define LL_LLMIME_H
00036 
00037 #include <string>
00038 #include "llsd.h"
00039 
00073 class LLMimeIndex
00074 {
00075 public:
00076         /* @name Client interface.
00077          */
00079 
00098         LLSD headers() const;
00099 
00107         S32 offset() const;
00108 
00115         S32 contentLength() const;
00116 
00122         std::string contentType() const;
00123 
00130         bool isMultipart() const;
00131 
00137         S32 subPartCount() const;
00138 
00146         LLMimeIndex subPart(S32 index) const;
00148 
00149         /* @name Interface for building, testing, and helpers for typical use.
00150          */
00152 
00155         LLMimeIndex();
00156 
00165         LLMimeIndex(LLSD headers, S32 content_offset);
00166 
00172         LLMimeIndex(const LLMimeIndex& mime);
00173 
00174         // @brief Destructor.
00175         ~LLMimeIndex();
00176 
00177         /*
00178          * @breif Assignment operator.
00179          *
00180          * @param mime The other mime object.
00181          * @return Returns this after assignment.
00182          */
00183         LLMimeIndex& operator=(const LLMimeIndex& mime);
00184 
00191         bool attachSubPart(LLMimeIndex sub_part);
00193 
00194 protected:
00195         // Implementation.
00196         class Impl;
00197         Impl* mImpl;
00198 };
00199 
00200 
00207 class LLMimeParser
00208 {
00209 public:
00210         // @brief Make a new mime parser.
00211         LLMimeParser();
00212         
00213         // @brief Mime parser Destructor.
00214         ~LLMimeParser();
00215 
00216         // @brief Reset internal state of this parser.
00217         void reset();
00218 
00219         
00220         /* @name Index generation interface.
00221          */
00223 
00234         bool parseIndex(std::istream& istr, LLMimeIndex& index);
00235 
00243         bool parseIndex(const std::vector<U8>& buffer, LLMimeIndex& index);
00244 
00257         bool parseIndex(std::istream& istr, S32 limit, LLMimeIndex& index);
00258 
00267         bool parseIndex(const U8* buffer, S32 buffer_length, LLMimeIndex& index);
00269 
00275         //bool verify(std::istream& istr, LLMimeIndex& index) const;
00276 
00282         //bool verify(U8* buffer, S32 buffer_length, LLMimeIndex& index) const;
00283 
00284 protected:
00285         // Implementation.
00286         class Impl;
00287         Impl& mImpl;
00288 
00289 private:
00290         // @brief Not implemneted to prevent copy consturction.
00291         LLMimeParser(const LLMimeParser& parser);
00292 
00293         // @brief Not implemneted to prevent assignment.
00294         LLMimeParser& operator=(const LLMimeParser& mime);
00295 };
00296 
00297 #endif // LL_LLMIME_H

Generated on Thu Jul 1 06:08:53 2010 for Second Life Viewer by  doxygen 1.4.7