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

StrSubChunk.h

00001 #ifndef _STR_StrSubChunk_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/StrSubChunk.h,v 1.8 2002/11/25 05:40:05 hopper Exp $ */
00026 
00027 // For a log, see ../ChangeLog
00028 //
00029 // Revision 1.1  1996/06/29 06:57:50  hopper
00030 // New class StrSubChunk used to make a part of an existing chunk look like
00031 // a full chunk to the outside world.
00032 //
00033 
00034 #include <StrMod/StrChunk.h>
00035 #include <StrMod/StrChunkPtr.h>
00036 #include <StrMod/LinearExtent.h>
00037 
00038 #define _STR_StrSubChunk_H_
00039 
00040 namespace strmod {
00041 namespace strmod {
00042 
00043 /** \class StrSubChunk StrSubChunk.h StrMod/StrSubChunk.h
00044  * A StrChunk that consists of some part of another StrChunk.
00045  *
00046  * This allows you to clip out a portion of another StrChunk without altering
00047  * the contents of the other StrChunk.
00048  */
00049 class StrSubChunk : public StrChunk
00050 {
00051  public:
00052    static const STR_ClassIdent identifier;
00053 
00054    StrSubChunk(const StrChunkPtr &chunk, const LinearExtent &extent);
00055    virtual ~StrSubChunk()                              { }
00056 
00057    inline virtual int AreYouA(const lcore::ClassIdent &cid) const;
00058 
00059    inline virtual unsigned int Length() const;
00060 
00061  protected:
00062    virtual const lcore::ClassIdent *i_GetIdent() const  { return &identifier; }
00063 
00064    //: Accept a ChunkVisitor, and maybe lead it through your children.
00065    virtual void acceptVisitor(ChunkVisitor &visitor)
00066       throw(ChunkVisitor::halt_visitation);
00067 
00068  private:
00069    StrChunkPtr subchunk_;
00070    LinearExtent subext_;
00071 };
00072 
00073 //-----------------------------inline functions--------------------------------
00074 
00075 inline int StrSubChunk::AreYouA(const lcore::ClassIdent &cid) const
00076 {
00077    return((identifier == cid) || StrChunk::AreYouA(cid));
00078 }
00079 
00080 inline unsigned int StrSubChunk::Length() const
00081 {
00082    return(subext_.Length());
00083 }
00084 
00085 }  // namespace strmod
00086 }  // namespace strmod
00087 
00088 #endif

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