Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

Folder.h

00001 //************************************************************************************************************************** 
00002 //* Blue HttpMail Extension
00003 //* Copyright (c) 2003-2004 Josh Harler
00004 //* 
00005 //* Blue - General Purpose C++ Library
00006 //* Copyright (c) 2002-2004 Josh Harler
00007 //* 
00008 //* This software is provided 'as-is', without any express or implied warranty. In no event
00009 //* will the authors be held liable for any damages arising from the use of this software.
00010 //* 
00011 //* Permission is granted to anyone to use this software for any purpose, including commercial
00012 //* applications, and to alter it and redistribute it freely, subject to the following restrictions:
00013 //* 
00014 //*     1. The origin of this software must not be misrepresented; you must not claim that you
00015 //*     wrote the original software. If you use this software in a product, an acknowledgment in the
00016 //*     product documentation would be appreciated but is not required.
00017 //* 
00018 //*     2. Altered source versions must be plainly marked as such, and must not be misrepresented as
00019 //*     being the original software.
00020 //* 
00021 //*     3. This notice may not be removed or altered from any source distribution.
00022 //*
00023 //*
00024 //* file   Blue/Extension/HttpMail/Folder.h
00025 //**
00026 
00027 #ifndef __blue_ext_httpmail_Folder_h_included__
00028 #define __blue_ext_httpmail_Folder_h_included__
00029 
00030 // Public Headers ==========================================================================================================
00031 
00032 // Extension headers
00033 #include "Blue/Extension/HttpMail/Message.h"
00034 
00035 
00036 // Public Defines/Enums/Typedefs/Etc. ======================================================================================
00037 
00038 // Public Classes/Structs ==================================================================================================
00039 
00040 namespace blue {
00041 namespace ext {
00042 namespace httpmail {
00043 
00044     /****
00045      * Forward Declaration
00046      */
00047     class Mailbox;
00048 
00049 
00062     class BLUE_EXPORT_HTTPMAIL Folder
00063     {
00064     public:
00065         // ===========================================================
00066         //  creation/destruction
00067         // ===========================================================
00068 
00070         Folder( Mailbox& mailbox, Folder* parent, String url );
00071 
00073         ~Folder();
00074 
00075 
00076         // ===========================================================
00077         //  query
00078         // ===========================================================
00079 
00081         String getUrl() const;
00082 
00084         String getName() const;
00086         String getDisplayName() const;
00087 
00089         int getMessageCount() const;
00091         int getMessageCountUnread() const;
00092 
00094         int getFolderCount() const;
00095         
00097         Folder* getFolder( int index );
00099         const Folder* getFolder( int index ) const;
00100 
00102         Folder* getFolder( String folderName );
00104         const Folder* getFolder( String folderName ) const;
00105 
00107         Array<Folder*> getFolders();
00109         const Array<Folder*> getFolders() const;
00110 
00112         Message* getMessage( int index );
00114         const Message* getMessage( int index ) const;
00115 
00117         Array<Message*> getMessages();
00119         const Array<Message*> getMessages() const;
00120 
00125         Folder* getParent();
00127         const Folder* getParent() const;
00128 
00129 
00130         // ===========================================================
00131         //  manipulation
00132         // ===========================================================
00133 
00139         void setUrl( String url );
00144         void setName( String name );
00150         void setDisplay( String display );
00156         void setMessageCount( int messageCnt );
00162         void setMessageCountUnread( int messageCntUnread );
00163 
00168         int createFolder( String folderName );
00170         void removeFolder( int index );
00172         void removeFolder( String folderName );
00173 
00177         void moveMessage( int index, Folder* to );
00179         void moveMessage( Message* message, Folder* to );
00180 
00184         void copyMessage( int index, Folder* to );
00186         void copyMessage( Message* message, Folder* to );
00187 
00191         void removeMessage( int index );
00193         void removeMessage( Message* message );
00194 
00198         void setMessageRead( int index, bool read );
00200         void setMessageRead( Message* message, bool read );
00201 
00206         void refresh();
00207 
00208 
00209     protected:
00210 
00211     private:
00216         Folder( const Folder& );
00218         const Folder& operator=( const Folder& );
00219 
00220         Mailbox& m_mailbox;
00221         Folder*  m_parent;
00222         String   m_url;
00223         String   m_name;
00224         String   m_display;
00225         int      m_msgCount;
00226         int32_t  m_msgCountUnread;
00227         
00228         Array<Folder*> m_folders;
00229         Array<Message*> m_messages;
00230     };
00231 
00232 
00233 
00239     class BLUE_EXPORT_HTTPMAIL FolderException :public HttpMailException
00240     {
00241     public:
00242         FolderException( String desc )
00243             :HttpMailException(desc) {}
00244 
00245         virtual String getException() const {
00246             return ("FolderException");
00247         }
00248     };
00249 
00250 
00251 }}} // namespaces
00252 
00253 
00254 // Public External Variables ===============================================================================================
00255 
00256 // Public Function Prototypes ==============================================================================================
00257 
00258 // Public Inline Functions =================================================================================================
00259 
00260 #endif // include guard

Generated on Wed Jun 30 14:44:26 2004 for Blue HttpMail Extension by doxygen1.3-rc3