bincimap

Log | Files | Refs | LICENSE

mailbox.cc (3857B)


      1 /* -*- Mode: c++; -*- */
      2 /*  --------------------------------------------------------------------
      3  *  Filename:
      4  *    mailbox.cc
      5  *  
      6  *  Description:
      7  *    Implementation of the Mailbox class.
      8  *
      9  *  Authors:
     10  *    Andreas Aardal Hanssen <andreas-binc curly bincimap spot org>
     11  *
     12  *  Bugs:
     13  *
     14  *  ChangeLog:
     15  *
     16  *  --------------------------------------------------------------------
     17  *  Copyright 2002-2005 Andreas Aardal Hanssen
     18  *
     19  *  This program is free software; you can redistribute it and/or modify
     20  *  it under the terms of the GNU General Public License as published by
     21  *  the Free Software Foundation; either version 2 of the License, or
     22  *  (at your option) any later version.
     23  *
     24  *  This program is distributed in the hope that it will be useful,
     25  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     26  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     27  *  GNU General Public License for more details.
     28  *
     29  *  You should have received a copy of the GNU General Public License
     30  *  along with this program; if not, write to the Free Software
     31  *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
     32  *  --------------------------------------------------------------------
     33  */
     34 #ifdef HAVE_CONFIG_H
     35 #include <config.h>
     36 #endif
     37 
     38 #include <string>
     39 
     40 #include "mailbox.h"
     41 #include "message.h"
     42 #include "io.h"
     43 
     44 using namespace ::std;
     45 using namespace Binc;
     46 
     47 //------------------------------------------------------------------------
     48 Mailbox::BaseIterator::BaseIterator(int sqn)
     49 {
     50   sqnr = sqn;
     51 }
     52 
     53 //------------------------------------------------------------------------
     54 Mailbox::BaseIterator::~BaseIterator(void)
     55 {
     56 }
     57 
     58 //------------------------------------------------------------------------
     59 Mailbox::Mailbox(void) : readOnly(false)
     60 {
     61 }
     62 
     63 //------------------------------------------------------------------------
     64 Mailbox::~Mailbox(void)
     65 {
     66 }
     67 
     68 //------------------------------------------------------------------------
     69 bool Mailbox::isReadOnly(void) const
     70 {
     71   return readOnly;
     72 }
     73 
     74 //------------------------------------------------------------------------
     75 void Mailbox::setReadOnly(bool readOnly)
     76 {
     77   this->readOnly = readOnly;
     78 }
     79 
     80 //------------------------------------------------------------------------
     81 Mailbox::iterator::iterator(BaseIterator &i)
     82   : realIterator(i)
     83 {
     84 }
     85 
     86 //------------------------------------------------------------------------
     87 Message &Mailbox::iterator::operator *(void)
     88 {
     89   return *realIterator;
     90 }
     91 
     92 //------------------------------------------------------------------------
     93 void Mailbox::iterator::operator ++(void)
     94 {
     95   ++realIterator;
     96 }
     97 
     98 //------------------------------------------------------------------------
     99 bool Mailbox::iterator::operator ==(const iterator &i) const
    100 {
    101   return realIterator == i.realIterator;
    102 }
    103 
    104 //------------------------------------------------------------------------
    105 bool Mailbox::iterator::operator !=(const iterator &i) const
    106 {
    107   return realIterator != i.realIterator;
    108 }
    109 
    110 //------------------------------------------------------------------------
    111 void Mailbox::iterator::erase(void)
    112 {
    113   realIterator.erase();
    114 }
    115 
    116 //------------------------------------------------------------------------
    117 unsigned int Mailbox::iterator::getSqnr(void) const
    118 {
    119   return realIterator.sqnr;
    120 }
    121 
    122 //------------------------------------------------------------------------
    123 void Mailbox::setName(const string &name)
    124 {
    125   this->name = name;
    126 }
    127 
    128 //------------------------------------------------------------------------
    129 const string Mailbox::getName(void) const
    130 {
    131   return name;
    132 }
    133 
    134 //------------------------------------------------------------------------
    135 const string &Mailbox::getLastError(void) const
    136 {
    137   return lastError;
    138 }
    139 
    140 //------------------------------------------------------------------------
    141 void Mailbox::setLastError(const string &error) const
    142 {
    143   lastError = error;
    144 }