1 |
Douglas Thrift |
164 |
// Smersh |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _Person_hpp_ |
8 |
|
|
#define _Person_hpp_ |
9 |
|
|
|
10 |
Douglas Thrift |
253 |
#include <menes-dbi/driver.hpp> |
11 |
Douglas Thrift |
179 |
#include <menes-dbi/connection.hpp> |
12 |
|
|
#include <menes-dbi/resultset.hpp> |
13 |
|
|
|
14 |
|
|
#include "Smersh.hpp" |
15 |
Douglas Thrift |
164 |
|
16 |
|
|
class Person |
17 |
|
|
{ |
18 |
|
|
private: |
19 |
Douglas Thrift |
183 |
static string driver, host, user, password, db; |
20 |
Douglas Thrift |
166 |
string name; |
21 |
|
|
vector<Person> multiple; |
22 |
Douglas Thrift |
170 |
void query(const string& sn); |
23 |
Douglas Thrift |
164 |
public: |
24 |
|
|
Person(const string& sn = ""); |
25 |
Douglas Thrift |
166 |
Person(const Person& person) : name(person.name) {} |
26 |
Douglas Thrift |
164 |
~Person() {} |
27 |
Douglas Thrift |
172 |
static void configure(); |
28 |
Douglas Thrift |
166 |
bool isMultiple() const { return !multiple.empty(); } |
29 |
|
|
vector<Person>::const_iterator beginMultiple() const { return |
30 |
|
|
multiple.begin(); } |
31 |
|
|
vector<Person>::const_iterator endMultiple() const { return multiple.end(); |
32 |
Douglas Thrift |
173 |
} |
33 |
Douglas Thrift |
166 |
void clearMultiple() { multiple.clear(); } |
34 |
Douglas Thrift |
241 |
Person& operator=(const Person& person) { name = person.name; return *this; } |
35 |
Douglas Thrift |
167 |
bool operator==(const Person& person) const { return name == person.name; } |
36 |
|
|
bool operator<(const Person& person) const { return name < person.name; } |
37 |
Douglas Thrift |
166 |
// friends: |
38 |
|
|
friend ostream& operator<<(ostream& sout, const Person& person) { return |
39 |
|
|
sout << person.name; } |
40 |
Douglas Thrift |
164 |
}; |
41 |
|
|
|
42 |
|
|
#endif // _Person_hpp_ |