Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

EOFStrChunk.h

00001 #ifndef _STR_EOFStrChunk_H_  // -*-c++-*-
00002 
00003 /*
00004  * Copyright 1991-2002 Eric M. Hopper <hopper@omnifarious.org>
00005  * 
00006  *     This program is free software; you can redistribute it and/or modify it
00007  *     under the terms of the GNU Lesser General Public License as published
00008  *     by the Free Software Foundation; either version 2 of the License, or
00009  *     (at your option) any later version.
00010  * 
00011  *     This program is distributed in the hope that it will be useful, but
00012  *     WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *     Lesser General Public License for more details.
00015  * 
00016  *     You should have received a copy of the GNU Lesser General Public
00017  *     License along with this program; if not, write to the Free Software
00018  *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #ifdef __GNUG__
00022 #  pragma interface
00023 #endif
00024 
00025 /* $Header: /home/hopper/src/cvs/C++/StrMod/StrMod/EOFStrChunk.h,v 1.7 2002/08/29 00:58:04 hopper Exp $ */
00026 
00027 // For a log, see ../ChangeLog
00028 
00029 // $Revision: 1.7 $
00030 
00031 #ifndef _STR_StrChunk_H_
00032 #  include <StrMod/StrChunk.h>
00033 #endif
00034 #ifndef _STR_StrChunkPtrT_H_
00035 #  include <StrMod/StrChunkPtrT.h>
00036 #endif
00037 
00038 #define _STR_EOFStrChunk_H_
00039 
00040 namespace strmod {
00041 namespace strmod {
00042 
00043 /** \class EOFStrChunk EOFStrChunk.h StrMod/EOFStrChunk.h
00044  * \brief A special 'zero length' chunk that indicates a stream EOF.
00045  *
00046  * This is mostly for a StreamFDModule to use.  It has an option for generating
00047  * them when an EOF is read, and if this chunk is written to a StreamFDModule it
00048  * invokes a special EOF handling virtual function instead of physically writing
00049  * the chunk to the file descriptor.
00050  */
00051 class EOFStrChunk : public StrChunk
00052 {
00053  public:
00054    static const STR_ClassIdent identifier;
00055 
00056    EOFStrChunk()                                       { }
00057    inline virtual ~EOFStrChunk();
00058 
00059    inline virtual int AreYouA(const lcore::ClassIdent &cid) const;
00060 
00061    virtual unsigned int Length() const                 { return(0); }
00062 
00063  protected:
00064    virtual const lcore::ClassIdent *i_GetIdent() const  { return &identifier; }
00065 
00066    virtual void acceptVisitor(ChunkVisitor &visitor)
00067       throw(ChunkVisitor::halt_visitation)             { }
00068 };
00069 
00070 typedef StrChunkPtrT<EOFStrChunk> EOFStrChunkPtr;
00071 
00072 //-----------------------------inlune functions--------------------------------
00073 
00074 inline EOFStrChunk::~EOFStrChunk()
00075 {
00076 }
00077 
00078 inline int EOFStrChunk::AreYouA(const lcore::ClassIdent &cid) const
00079 {
00080    return((identifier == cid) || StrChunk::AreYouA(cid));
00081 }
00082 
00083 }  // namespace strmod
00084 }  // namespace strmod
00085 
00086 #endif

Generated on Wed Jan 29 00:32:43 2003 for libNet by doxygen1.3-rc1