1 |
// Smersh |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _Person_hpp_ |
8 |
#define _Person_hpp_ |
9 |
|
10 |
#ifdef __FreeBSD__ |
11 |
#include <menes-dbi/connection.hpp> |
12 |
#include <menes-dbi/resultset.hpp> |
13 |
|
14 |
#include "Smersh.hpp" |
15 |
#else |
16 |
#include <pstream.h> |
17 |
|
18 |
using namespace redi; |
19 |
|
20 |
#include "Matcher.hpp" |
21 |
#endif |
22 |
|
23 |
class Person |
24 |
{ |
25 |
private: |
26 |
#ifdef __FreeBSD__ |
27 |
static string user, db; |
28 |
#else |
29 |
static string file; |
30 |
static vector<string> args; |
31 |
static string separator, begin, end; |
32 |
#endif |
33 |
string name; |
34 |
vector<Person> multiple; |
35 |
void query(const string& sn); |
36 |
public: |
37 |
Person(const string& sn = ""); |
38 |
Person(const Person& person) : name(person.name) {} |
39 |
~Person() {} |
40 |
static void configure(); |
41 |
bool isMultiple() const { return !multiple.empty(); } |
42 |
vector<Person>::const_iterator beginMultiple() const { return |
43 |
multiple.begin(); } |
44 |
vector<Person>::const_iterator endMultiple() const { return multiple.end(); |
45 |
} |
46 |
void clearMultiple() { multiple.clear(); } |
47 |
Person& operator=(const Person& person) { name = person.name; } |
48 |
bool operator==(const Person& person) const { return name == person.name; } |
49 |
bool operator<(const Person& person) const { return name < person.name; } |
50 |
// friends: |
51 |
friend ostream& operator<<(ostream& sout, const Person& person) { return |
52 |
sout << person.name; } |
53 |
}; |
54 |
|
55 |
#endif // _Person_hpp_ |