Source: STStringList.h


Annotated List
Files
Globals
Hierarchy
Index
/*=============================================================================

    Copyright (C) 2001 Silicon Tao Technology Systems
    E-mail:  Support 
    Web:     www.silicontao.com

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
=============================================================================*/

/*=============================================================================
   File Name:					STStringList.h
	Object Name:				STStringList
   Programmer Name:			Roy Souther
   By Command of:				Silicon Tao Technology Systems
   License:						GNU general public license. See GNU.
   Day Zero:					02152000, Feburary 15, 2000
   Target Platform:			Linux
   Registors Used:       
   Compiler Used:        	GNU g++
   Compiled Settings:    
   Resources Used:       
   Libraries Used:       	alloc.h, stdio.h, string.h
   Ports Used:           	None
   Title of program:			Object library
   Discription:				
=============================================================================*/

#ifndef STStringList_included
#define STStringList_included

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

/**
 * String list.
 *
 * @short Simple string list.
 */   
class STStringList : public STList, public STObjectController
{
   public:
      int DiskIOBufferSize;
      QString ReturnString;
         
      /**
       * 
       */
      STStringList();
      ~STStringList();

      /**
       * Returns a string in the list.
       */   
      QString Item(int Index);

      /**
       * Removes all items from the list.
       */   
      void Clear();

      /**
       * Removes a string from the list. As a bonus it also returns the count after the 
       * string has been removed. As named after the Qt prefered name remove.
       */   
      unsigned int Remove(int IndexToRemove);

      /**
       * Replaces an existing string with a new one at the location of index. 
       */   
      unsigned int Replace(QString &NewString, int Index);

      /**
       * Removes a string from the list. As a bonus it also returns the count after the 
       * string has been removed. As named after the Delphi prefered name Delete.
       */   
      unsigned int Delete(int IndexToRemove);

      /**
       * Appends a string to the list. As a bonus it also returns the count after the 
       * new string has been added.
       */   
      unsigned int Add(QString &NewStringToAdd);
      unsigned int Add(const char *NewStringToAdd);

      /**
       * Read a text file in to the string list. All previous data
       * in the list is lost.
       */   
      void LoadFromFile(QString &FilePathAndName);
      void LoadFromFile(const char *FilePathAndName);
      
      /**
       * Saves the contents of the string list to a text file. All 
       * previos contents of the text file is lost.
       */   
      void SaveToFile(QString &FilePathAndName);   
      void SaveToFile(const char *FilePathAndName);   
      
      /**
       * For faster saving of large lists, this will save to the list as you add to
       * it and not buffer to swap memory. This is great for large lists like 100 MB 
       * text files that I have tried when my memory is 100% and the rest is in swap. 
       * After activating this you should only add to the list, do not attempt any 
       * other list actions. When done adding use DoneFractalAddSaving to return 
       * list to normal operations. This list will be empty, you will have to load it 
       * to use it again. If you planned on using the list when done you should not
       * use this feature as it will only save you speed if you intend on writing a
       * text file and then being finished with the list.
       */
      void StartFractalAddSaving(QString &FilePathAndName);
      void StartFractalAddSaving(const char *FilePathAndName);
      
      /**
       * Use this to tell terminal the FractalAddSaving and return the list to normal
       * operations. The list will be completley empty after calling this.
       */
      void DoneFractalAddSaving();
   private:
      bool FractalAddSavingOn;
      int FractalLineCount;
      char *FractalFileIOBuffer;
      unsigned int FractalFilePointer;
      QString FractalSaveFileName;
      
      void FractalSaveToFile();
      void WipeFile(QString &WipePathAndFileName);
};

#endif // STStringList_included

Generated by: root on UtopiaPlanitia.Ept on Mon Dec 10 22:55:12 2001, using kdoc 2.0a53.