File: stlutil.h

package info (click to toggle)
aethera 0.9.3-7
  • links: PTS
  • area: main
  • in suites: woody
  • size: 8,588 kB
  • ctags: 7,282
  • sloc: cpp: 64,544; sh: 9,913; perl: 1,756; makefile: 1,680; python: 258
file content (60 lines) | stat: -rw-r--r-- 1,883 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/***************************************************************************
        stlutil.h  -  STL tools like split and toUpper/toLower
                             -------------------
    begin                : Thu Jul  5 17:35:17 EEST 2001
    copyright            : (C) 2001 by Eugen C.
    email                : eug@thekompany.com
 ***************************************************************************/

#ifndef __STLUtil__
#define __STLUtil__

#include <vector>
#include <list>
#include <string>

typedef vector<int> IntVect;
typedef IntVect::iterator IntVectIt;
typedef vector<unsigned long> ULongVect;
typedef ULongVect::iterator ULongVectIt;
typedef vector<string> StringVect;
typedef StringVect::iterator StringVectIt;

typedef list<int> IntList;
typedef IntList::iterator IntListIt;
typedef list<unsigned long> ULongList;
typedef ULongList::iterator ULongListIt;
typedef list<string> StringList;
typedef StringList::iterator StringListIt;

class STLUtil
{
	public:
	  enum SPLIT_TYPES {DEFAULT_SPLIT=0, WHITE_SPACES};
	
	  /** Split the string with a char delimiter.*/
		virtual vector<string> split(char, const string&);
	  /** Split the input string with a string delimiter.*/
		virtual vector<string> split(const char*, const string&);
	  /** Split the input string with some special delimiters.*/
		virtual vector<string> split(const int, const string&);
		
    /**
      * Skip the spaces from line begining with uPos.
      */
    virtual unsigned skipSpaces(string& line, unsigned uPos=0) const;

    /**
      * Parse the first word from the line begining with uPos.
      * For IMAP the word delimiter is the space char.
      */
    virtual unsigned parseNextWord(string &strWord, string &line, unsigned uPos=0);

    /** To Upper.*/
    virtual void toUpper(string &strWord);
    /** To Lower.*/
    virtual void toLower(string &strWord);
};

#endif