-
Notifications
You must be signed in to change notification settings - Fork 2
/
data.h
128 lines (96 loc) · 2.22 KB
/
data.h
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
/* Copyright (C) 2014 Stefan Helmert <[email protected]>
smartRNS content data
*/
#ifndef DATA_H_INCLUDED
#define DATA_H_INCLUDED
#include <vector>
#include <string>
#include <iostream>
#include "parse.h"
using namespace std;
typedef enum entrytype_e
{
NO_ETYPE = 0,
PHONE_NR = 1,
EMAIL = 2,
ICQ = 3,
JABBER = 4,
ETYPE_NOT_SPEC = -1
} entrytype_et;
typedef enum subtype_e
{
NO_SUBTYPE = 0,
FIXED = 1,
MOBILE = 2,
PORTABLE = 3,
SAT = 4,
SUBTYPE_NOT_SPEC = -1
} subtype_et;
typedef enum usagetype_e
{
NO_USAGETYPE = 0,
HOME = 1,
WORK = 2,
PRIVAT = 3,
PUBLIC = 4,
USAGETYPE_NOT_SPEC = -1
} usagetype_et;
typedef enum state_e
{
NO_STATE = 0,
ONLINE = 1,
OFFLINE = 2,
ACTIVE = 3,
INACTIVE = 4,
AVAILABLE = 5,
AWAY = 6,
STATE_NOT_SPEC = -1
} state_et;
typedef struct smartrns_data_entry_phone_s
{
subtype_et subtype;
usagetype_et usage;
string country;
string prefix;
string number;
string suffix;
} smartrns_data_entry_phone_t;
typedef struct smartrns_data_entry_email_s
{
string email;
} smartrns_data_entry_email_t;
typedef struct smartrns_data_entry_icq_s
{
uint64_t icq;
} smartrns_data_entry_icq_t;
typedef struct smartrns_data_entry_jabber_s
{
string jabber;
} smartrns_data_entry_jabber_t;
typedef struct smartrns_data_entry_s
{
string name;
string comment;
entrytype_et type;
state_et state;
void* entry;
} smartrns_data_entry_t;
typedef struct smartrns_data_s
{
string version;
string name;
string comment;
vector<smartrns_data_entry_t> entries;
} smartrns_data_t;
state_et str2state(string str);
string state2str(state_et sta);
entrytype_et str2entrytype(string str);
string entrytype2str(entrytype_et entr);
subtype_et str2subtype(string str);
string subtype2str(subtype_et subt);
usagetype_et str2usagetype(string str);
string usagetype2str(usagetype_et usage);
smartrns_data_t smartrnsvec2smartrnsdata(vector<keyval_t> smartrnsvec);
smartrns_data_t txtrec2smartrnsdata(string txtstr);
void print_smartrns_data(smartrns_data_t data);
#endif // DATA_H_INCLUDED