1 |
// Smersh |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _Smersh_hpp_ |
8 |
#define _Smersh_hpp_ |
9 |
|
10 |
#include <iostream> |
11 |
#include <string> |
12 |
#include <sstream> |
13 |
#include <vector> |
14 |
#include <map> |
15 |
#include <algorithm> |
16 |
#include <cstdlib> |
17 |
#include <cctype> |
18 |
|
19 |
#include <menes-ext/casts.hpp> |
20 |
#include <menes-xml/document.hpp> |
21 |
#include <menes-xml/nodeset.hpp> |
22 |
#include <menes-xml/parse.hpp> |
23 |
|
24 |
using namespace std; |
25 |
|
26 |
inline string sgetenv(const string& name) |
27 |
{ |
28 |
char* value = getenv(name.c_str()); |
29 |
|
30 |
return value != NULL ? value : ""; |
31 |
} |
32 |
|
33 |
inline int ssetenv(const string& name, const string& value, bool write = true) |
34 |
{ |
35 |
return setenv(name.c_str(), value.c_str(), write); |
36 |
} |
37 |
|
38 |
inline int sputenv(const string& env) |
39 |
{ |
40 |
istringstream input(env); |
41 |
string name, value; |
42 |
|
43 |
getline(input, name, '='); |
44 |
getline(input, value); |
45 |
|
46 |
return ssetenv(name, value); |
47 |
} |
48 |
|
49 |
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
50 |
|
51 |
extern string program; |
52 |
extern bool debug; |
53 |
|
54 |
class Person; |
55 |
|
56 |
class Smersh |
57 |
{ |
58 |
private: |
59 |
multimap<string, string> cgi; |
60 |
void parse(istream& sin); |
61 |
void smersh(ostream& sout); |
62 |
void output(ostream& sout, const vector<Person>& people); |
63 |
public: |
64 |
Smersh(istream& sin = cin, ostream& sout = cout); |
65 |
~Smersh() {} |
66 |
}; |
67 |
|
68 |
#endif // _Smersh_hpp_ |