Subversion Repositories heating

Rev

Rev 4 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4 Rev 5
Line 17... Line 17...
17
 */
17
 */
18
#ifndef __HELPER_H__
18
#ifndef __HELPER_H__
19
#define __HELPER_H__
19
#define __HELPER_H__
20
 
20
 
21
#include <iostream>
21
#include <iostream>
-
 
22
#include <iomanip>
22
#include <string>
23
#include <string>
23
#include <sstream>
24
#include <sstream>
24
 
-
 
25
#ifndef nullptr
25
#include <vector>
26
const class							// this is a const object...
-
 
27
{
-
 
28
	public:
-
 
29
		template<class T>			// convertible to any type
-
 
30
		operator T*() const			// of null non-member
-
 
31
		{ return 0; }				// pointer...
-
 
32
 
-
 
33
		template<class C, class T>	// or any type of null
-
 
34
		operator T C::*() const		// member pointer...
-
 
35
		{ return 0; }
-
 
36
 
-
 
37
	private:
-
 
38
		void operator&() const;		// whose address can't be taken
-
 
39
} nullptr = {};
-
 
40
#endif
-
 
41
 
26
 
42
class helper
27
class helper
43
{
28
{
44
	public:
29
	public:
45
		helper();
30
		helper();
Line 50... Line 35...
50
		int compare(char *str1, char *str2);
35
		int compare(char *str1, char *str2);
51
		int compcase(const char *str1, const char *str2);
36
		int compcase(const char *str1, const char *str2);
52
		int compcase(std::string str1, std::string str2);
37
		int compcase(std::string str1, std::string str2);
53
		char *findc(char *str, int len, char c);
38
		char *findc(char *str, int len, char c);
54
		int findc(std::string str, char c);
39
		int findc(std::string str, char c);
-
 
40
		std::vector<std::string> split(std::string str, char delimiter);
55
		void setPName(char *name);
41
		void setPName(char *name);
56
		std::string itostring(int i);
42
		std::string itostring(int i);
57
		char *assign(std::string str);
43
		char *assign(std::string str);
58
		void enableDebug(bool what) { dbg = what; };
44
		void enableDebug(bool what) { dbg = what; };
59
		void debug(std::string msg);
45
		void debug(std::string msg);
Line 68... Line 54...
68
			std::stringstream stream;
54
			std::stringstream stream;
69
			stream << value;
55
			stream << value;
70
			return stream.str();
56
			return stream.str();
71
		}
57
		}
72
 
58
 
-
 
59
		inline std::string doubleToString(double d, int prec)
-
 
60
		{
-
 
61
			std::stringstream stream;
-
 
62
			stream << std::setprecision(prec) << d;
-
 
63
			return stream.str();
-
 
64
		}
-
 
65
 
73
	private:
66
	private:
74
		char pname[48];
67
		char pname[48];
75
		bool dbg;
68
		bool dbg;
76
};
69
};
77
 
70