

class Accumulator {-----------------------------------------------------

 public:

  Accumulator();
  ~Accumulator();
  
  AOffset_t   GetSize   ( void );
  AOffset_t   ReadN     ( AOffset_t position, char * buffer, AOffset_t size );
  AOffset_t   SetN      ( AOffset_t destStart, AOffset_t destSize, char * src, AOffset_t srcSize );  
  ASerial_t   GetSerialNumber ( void ); 
 
 private:
 
  CESError_t reSize        ( int64_t newBlockSize );
  CESError_t shift         ( AOffset_t offset , AOffset_t delta );
  char *     contents;
  long       contentSize;
  long       blockCount;
  ASerial_t  SerialNumber;
};

class ContentFilter {----------------------------------------------------

 public:

  ContentFilter();
  
  // setup classes
  int       SetAccumulator  ( Accumulator * accum = NULL );
  long      SelectionStart  ( long newstart ) ;
  long      SelectionEnd    ( long newend   ) ;
  long      SelectionStart  ( void ) ;
  long      SelectionEnd    ( void ) ;
  long      SelectionSize   ( void ) ;
  
  // content search
  int       Seek            ( long offset, int whence );
  long      LinePos         ( void ) ;
  ChrOffset LineEnd         ( void ) ;
  ChrOffset NextLine        ( void ) ;
  ChrOffset PrevLine        ( void ) ;
  
  // content modify
  int       Putc            ( char inchar );
  int       Replace         ( char * buff ) ;
  
  // content retrieve 
  char *    Read            ( char * buff, int len );
   
  ~ContentFilter();
  
 private:
 
  int           blockStart  ;
  int           blockEnd    ;
  Accumulator * accumulator ;
  
  
};


class DisplayFilter1 {----------------------------------------------------------

  Point2D_t        ScrollLoc;
  Accumulator    * SourceData;
  ContentFilter    Dataf;
  VIF            * Display;

 public:
  
   DisplayFilter1     ( VIF * display = NULL ,  Accumulator * source = NULL, int64_t X = 0, int64_t Y = 0 );
   void    SetDisplay ( VIF * display = NULL);
	int     SetSource  ( Accumulator * source = NULL );
   void    SetScroll  ( int64_t X, int64_t Y );		
   void    ReDraw     ( void );
   int64_t LineLength ( char * Data );
   char *  LineOffset ( Accumulator * Data, int64_t LineNumber );
   ~DisplayFilter1    ( void );

};


class FileFilter1 {--------------------------------------------------------

 public:

   FileFilter1( void ); // this should have a dest buffer and filename
  ~FileFilter1();
  
   int LoadFile( Accumulator * buffer, char * fileName);
   CESError_t SaveFile( Accumulator * buffer, char * fileName); 
 
};


class Tag {-----------------------------------------------------------------
   public:
      Tag( long own =0, long ind =0, int64_t pos =0 , int t =2)
        :owner(own), index(ind), position(pos), type(t){}
      
      const int64_t getPosition() const{return position;}
      void          setPosition(int64_t pos=0){ position = pos; }
      
      const long    getOwner   ()const{return owner;}
      void          setOwner   (long own=0){owner = own;}
      
      const long    getIndex   ()const{return index;}
      void          setIndex   (long ind=0){index = ind;}
      
      const int     getType    ()const{return type;}
      void          setType    (int ty=0){type = ty;}
      
   private:    
      long     owner   ;      // unique within scope of editor 
      long     index   ;      // uniquie within scope of owner
      int64_t  position;      // first character effected 
      int      type    ;      // reference for translation of tag type
};


class PropAccum {------------------------------------------------------------

 public:
                   PropAccum();
                  ~PropAccum();
                  
 int               set (BIGNUM Owner, BIGNUM Index, BIGNUM Position, int Type);
 int               set (Tag * Data);
 Tag           *   get (BIGNUM Owner, BIGNUM Index, Tag * Dest);
 
 Tag           *   find(BIGNUM Owner, BIGNUM Index);
 bool              removeNode(BIGNUM Owner, BIGNUM Index);
 
 private:
 
  List<Tag>  propList;//double link list (currently)
 
  int              insert   (BIGNUM Owner, BIGNUM Index, BIGNUM Position, int Type);
  void             modify   (Tag * node, BIGNUM Position, BIGNUM Type);
  void             deleteAll();

};

#endif

class VIF {--------------------------------------------------------------------

 public:

  long int Height;
  long int Width;

  char *   BuffText;
  char *   BuffProp;
  int64_t  BuffPtr;
  int64_t  BUFFLEN;

  VIF();
  void     CursorPos ( XDim_t X, YDim_t Y );
  void     WriteText ( char * text );
  void     WriteText ( char * text, char * properties);

  void     BufferText( char * text, char * properties);
  void     GetBuffer ( char * text, char * properties, long int N);
  void     BufferPos ( XDim_t X, YDim_t Y );
  void     ReDraw    ( void );

  ~VIF();

};









