Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2218 sbetterm 1
#ifndef _Utilities_h
2
#define _Utilities_h 1
3
 
4
#include <vcl.h>
5
#include <string>
6
 
7
#define	MASSUDWriter "MASSUDWriter"
8
 
9
class Utilities
10
{
11
	public:
12
		static AnsiString EscapeString( const AnsiString & value )
13
		{
14
			AnsiString	result;
15
			char const *p       = value.c_str();
16
			const int   length  = value.Length();
17
 
18
			for ( int i=0; i<length; i++ )
19
			{
20
				if ( *p == '\'' )
21
				{
22
					result += *p;
23
				}
24
 
25
				if ( *p == '\"' )
26
				{
27
					result += "\'\'";
28
				}
29
				else
30
				{
31
					result += *p;
32
				}
33
 
34
				p++;
35
			}
36
 
37
			return ( result );
38
		}
39
 
40
		static std::string EscapeString( const std::string & value )
41
		{
42
			std::string	result;
43
			char const *p       = value.c_str();
44
			const int   length  = value.length();
45
 
46
			for ( int i=0; i<length; i++ )
47
			{
48
				if ( *p == '\'' )
49
				{
50
					result += *p;
51
				}
52
 
53
				if ( *p == '\"' )
54
				{
55
					result += "\'\'";
56
				}
57
				else
58
				{
59
					result += *p;
60
				}
61
 
62
				p++;
63
			}
64
 
65
			return ( result );
66
		}
67
};
68
#endif	// #ifndef Utilities_h
69