Source: STParserOps.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:					STParserOps.h
   Object Name: 				STParserOps
   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:      	STList.h
   Ports Used:           	None
   Title of program:			Object library
   Discription:				
=============================================================================*/

#ifndef STParserOps_included
#define STParserOps_included

#include 
#include 
//#include 

/**
 * Functionality to parse strings in to usable parts. Parts are defined as words and blocks.
 * 
 * Words: A word is a block of text that is holely alphabetic. 
 * For example " this is four words " "(this is three)" " this twoWords " " this is 2 "
 *
 *	Identifier: An identifier is a block of text that is holely alpha-numeric and not starting with a number. 
 * For example " this_is_an_Identifier " "(this_is_an_Identifier)" 
 * " this_is two_Identifiers " " this_is_2 Identifiers " " this_is 1_Identifier "
 * These would be similar to names in C and C++ for varibles and function names.
 * 
 * Blocks: A block is any amount of text containing alpha, numerics or symbols that is preseeded by a 
 * block identifier and followed by a block identifier. In C "{" and "}" are block identifiers. The text
 * code between them is the block. 
 *
 * @short Functionality to parse strings in to usable parts.
 */   
class STParserOps: public STObjectController
{
   private:
      QString ReturnString;
   protected:
      //
   public:
      /**
       * Strip unwanted chars off the front and back of a string.
       */        
      QString RemoveFrontAndBackChars(QString &TextString, QString &TheChar);

      /**
       * Compairs two strings, one containing wild cards of * or ? for 
       * sections of any thing any length represented by a * or and single 
       * char represented by ?.
       */        
      bool WildCardCompairStrings(QString &CompairString1,QString &CompairString2, bool CaseSensitive);

      /**
       * From a given string this function will return the word that is WordIndex 
       * counts in from the begining.
       */        
      QString ExtractWord(QString &SourceString, int WordIndex);

      /**
       * From a given string this function will return the entire string except the 
       * word that is WordIndex counts in from the begining.
       */        
      QString RemoveWord(QString &SourceString, int WordIndex);

      /**
       * From a given string this function will return a string with 
       * every thing from the word at WordIndex counts from the begining to the end.
       */        
      QString TrucateUpToWord(QString &SourceString, int WordIndex);

      /**
       * From a given string this function will return a string with 
       * every thing from begining untill the word at WordIndex counts from the begining.
       */        
      QString TrucateAfterWord(QString &SourceString, int WordIndex);

      /**
       * From a given string this function will return a string that is the first word in the string.
       */        
      QString FindFirstWord(QString &SourceString);

      /**
       * From a given string this function will return a string that is the next word 
       * after the word at WordIndex.
       */        
      QString FindNextWord(QString &SourceString, uint WordIndex);

      /**
       * From a given string this function will return a string that is the 
       * first identifier in the string.
       */        
      QString FindFirstIdentifier(QString &SourceString);

      /**
       * From a given string this function will return a string that is the next 
       * identifier after the identifier at IdentifierIndex.
       */        
      QString FindNextIdentifier(QString &SourceString, uint IdentifierIndex);

      /**
       * Used internaly mostly to find if a given char is alpha.
       */        
      bool IsAlpha(char TheChar);

      /**
       * Used internaly mostly to find if a given char is an ASCII number.
       */        
      bool IsNumber(char TheChar);

      /**
       * Used internaly mostly to find if a given char is a symbol.
       */        
      bool IsSymbole(char TheChar);

      /**
       * From a given string this function will return the block that is BlockIndex 
       * counts in from the begining.
       */        
      QString ExtractBlock(QString &SourceString, int BlockIndex, QString &BlockIndicators);

      /**
       * From a given string this function will return the entire string except the 
       * block that is BlockIndex counts in from the begining.
       */        
      QString RemoveBlock(QString &SourceString, int BlockIndex, QString &BlockIndicators);

      /**
       * This function will attempt to extract a number string from the midle of 
       * a give string. Any symbols like $ % or # and so on will be truncated. If more 
       * then one number is found in the string then the function will keep looking for 
       * whole numbers until it reaches WordIndex counts of numbers found. The decimal 
       * number symbol in a number like 6.43 will be included in the returned string 
       * so that floating point numbers can be grabed.
       */        
      QString ExtractNumberString(QString &SourceString, int WordIndex);

      /**
       * Constructor
       */   
      STParserOps();

      /**
       * Destructor
       */   
      ~STParserOps();      
};

#endif // STParserOps_included

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