-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathswhdbxx.hpp
149 lines (102 loc) · 2.94 KB
/
swhdbxx.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
Swephelp
Copyright 2007-2020 Stanislas Marquis <[email protected]>
Swephelp is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
Swephelp is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Swephelp. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SWHDBXX_HPP
#define SWHDBXX_HPP
#include <string>
#include "swhxx.hpp"
using namespace std;
namespace swh {
namespace db {
class User
:
public swh::ErrorBase
{
public:
User();
unsigned long idx() const;
int idx(unsigned long x);
const char* name() const;
int name(const char* s);
const char* pswd() const;
int pswd(const char* s);
const char* mail() const;
int mail(const char* s);
const char* info() const;
int info(const char* s);
int drop();
int save();
static bool infoIsValid(const char* s);
static bool mailIsValid(const char* s);
static bool nameIsValid(const char* s);
static bool pswdIsValid(const char* s);
static int root(User** p, char err[512]);
static int select(unsigned long uidx, User** p, char err[512]);
static int select(const char* name, User** p, char err[512]);
protected:
unsigned long m_idx;
string m_name;
string m_pswd;
string m_mail;
string m_info;
};
class Data
:
public swh::ErrorBase
{
public:
Data();
unsigned long idx() const;
int idx(unsigned long x);
unsigned long useridx() const;
int useridx(unsigned long x);
const char* title() const;
int title(const char* s);
double jd() const;
int jd(double t);
double latitude() const;
int latitude(double d);
double longitude() const;
int longitude(double d);
long altitude() const;
int altitude(long i);
const char* datetime() const;
int datetime(const char* s);
const char* timezone() const;
int timezone(const char* s);
long isdst() const;
int isdst(long i);
const char* location() const;
int location(const char* s);
const char* country() const;
int country(const char* s);
int owner(swh::db::User** p, char err[512]) const;
protected:
unsigned long m_idx;
unsigned long m_useridx;
string m_title;
double m_jd;
double m_latitude;
double m_longitude;
long m_altitude;
string m_datetime;
string m_timezone;
long m_isdst;
string m_location;
string m_country;
};
} // end namespace db
} // end namespace swh
#endif // SWHDBXX_HPP
/* vi: set fenc=utf-8 ff=unix et sw=4 ts=4 */