-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAddressBook.cpp
53 lines (45 loc) · 1.65 KB
/
AddressBook.cpp
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
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <fstream>
#include "../include/route4me.h"
#define KEY "11111111111111111111111111111111"
using namespace std;
int main()
{
// global init
CRoute4Me::init();
CRoute4Me route(KEY);
Json::Value props(Json::objectValue);
props["first_name"] = "John";
props["last_name"] = "Smith";
props["address_1"] = "Wall Street";
props["cached_lat"] = 100500;
props["cached_lng"] = 23450;
if (route.add_address_book_contacts(props) == 0) {
cout << "Address book:" << endl << Json::FastWriter().write(route.get_json_resp()) << endl;
}
else {
cout << "Address book not added " << Json::FastWriter().write(route.get_json_resp()) << endl;
}
if (route.get_address_book_contacts_by_text("Wall") == 0) {
cout << "Found address:" << endl << Json::FastWriter().write(route.get_json_resp()) << endl;
}
else {
cout << "Address not found: " << Json::FastWriter().write(route.get_json_resp()) << endl;
}
if (route.get_address_book_contacts("4621569") == 0) {
cout << "Found address:" << endl << Json::FastWriter().write(route.get_json_resp()) << endl;
}
else {
cout << "Address book not found : " << Json::FastWriter().write(route.get_json_resp()) << endl;
}
if (route.get_address_book_contacts("") == 0) {
cout << "All contacts:" << endl << Json::FastWriter().write(route.get_json_resp()) << endl;
}
else {
cout << "No contacts " << Json::FastWriter().write(route.get_json_resp()) << endl;
}
// global cleanup
CRoute4Me::cleanup();
return 0;
}