| 1 | < | #ifndef _STRINGUTILS_HPP_ | 
| 2 | < | #define _STRINGUTILS_HPP_ | 
| 1 | > | /** | 
| 2 | > | * @file StringUtils.hpp | 
| 3 | > | * @author Dan Gezelter | 
| 4 | > | * @date 10/18/2004 | 
| 5 | > | * @version 1.0 | 
| 6 | > | */ | 
| 7 | > |  | 
| 8 | > | #ifndef UTILS_STRINGUTILS_HPP | 
| 9 | > | #define UTILS_STRINGUTILS_HPP | 
| 10 |  | #include <string> | 
| 11 | + | #include <iostream> | 
| 12 | + | #include <fstream> | 
| 13 |  |  | 
| 14 | < | using namespace std; | 
| 6 | < | string UpperCase(const string& S); | 
| 7 | < | string LowerCase(const string& S); | 
| 14 | > | namespace oopse { | 
| 15 |  |  | 
| 16 | + | using namespace std; | 
| 17 | + |  | 
| 18 | + |  | 
| 19 | + | /** | 
| 20 | + | * Converts a string to UPPER CASE | 
| 21 | + | * @param S | 
| 22 | + | */ | 
| 23 | + | string UpperCase(const string& S); | 
| 24 | + |  | 
| 25 | + | /** | 
| 26 | + | * Converts a string to lower case | 
| 27 | + | * @param S | 
| 28 | + | */ | 
| 29 | + | string LowerCase(const string& S); | 
| 30 | + |  | 
| 31 | + | /** | 
| 32 | + | * Finds the location of the string "begin <startText>" in an input stream. | 
| 33 | + | * @param theStream | 
| 34 | + | * @param startText | 
| 35 | + | * | 
| 36 | + | * @return the line number of the block within the theStream | 
| 37 | + | */ | 
| 38 | + | int findBegin(istream theStream, char* startText ); | 
| 39 | + |  | 
| 40 | + | /** | 
| 41 | + | * Counts the number of tokens on line which are delimited by the characters | 
| 42 | + | * listed in delimiters | 
| 43 | + | * @param line | 
| 44 | + | * @param delimiters | 
| 45 | + | */ | 
| 46 | + | int countTokens(char *line, char *delimiters); | 
| 47 | + |  | 
| 48 | + | /** | 
| 49 | + | * Removes left and right spaces from a string | 
| 50 | + | * | 
| 51 | + | * @param str  String to trim | 
| 52 | + | * | 
| 53 | + | * @return  char* to the trimed string | 
| 54 | + | */ | 
| 55 | + | char* TrimSpaces(char *str); | 
| 56 | + |  | 
| 57 | + | /** | 
| 58 | + | * discovers whether or not the line contains the "end" token | 
| 59 | + | * | 
| 60 | + | * @param line  The line to test | 
| 61 | + | * | 
| 62 | + | * @return int  (==1 if the line has "end", ==0 if not). | 
| 63 | + | */ | 
| 64 | + | int isEndLine(char *line); | 
| 65 | + | } | 
| 66 | + |  | 
| 67 |  | #endif |