diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-08-20 13:56:23 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-08-20 13:56:23 -0400 |
commit | 69fc8d805396b889b5e8c1c88e8129d93db77d29 (patch) | |
tree | 6b807bd9332c65b65066e247d4d00fd5e4118d2e /src/bounding_box.h | |
parent | 442f1ee071152be04c4184473ddfee5040795b76 (diff) | |
download | libtwittercpp-69fc8d805396b889b5e8c1c88e8129d93db77d29.tar.gz libtwittercpp-69fc8d805396b889b5e8c1c88e8129d93db77d29.tar.bz2 libtwittercpp-69fc8d805396b889b5e8c1c88e8129d93db77d29.zip |
Updated API to use exceptions and make tweet/user objects more helpful
Diffstat (limited to 'src/bounding_box.h')
-rw-r--r-- | src/bounding_box.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/src/bounding_box.h b/src/bounding_box.h new file mode 100644 index 0000000..25c7790 --- /dev/null +++ b/src/bounding_box.h | |||
@@ -0,0 +1,88 @@ | |||
1 | #ifndef BOUNDING_BOX_H_75D2077D | ||
2 | #define BOUNDING_BOX_H_75D2077D | ||
3 | |||
4 | namespace twitter { | ||
5 | |||
6 | class coordinate { | ||
7 | public: | ||
8 | |||
9 | coordinate(int degrees, int minutes = 0, int seconds = 0) : | ||
10 | _degrees(degrees), | ||
11 | _minutes(minutes), | ||
12 | _seconds(seconds) | ||
13 | { | ||
14 | } | ||
15 | |||
16 | int getDegrees() const | ||
17 | { | ||
18 | return _degrees; | ||
19 | } | ||
20 | |||
21 | int getMinutes() const | ||
22 | { | ||
23 | return _minutes; | ||
24 | } | ||
25 | |||
26 | int getSeconds() const | ||
27 | { | ||
28 | return _seconds; | ||
29 | } | ||
30 | |||
31 | operator double() const | ||
32 | { | ||
33 | return (double)_degrees + ((double)_minutes / (double)60) + ((double)_seconds / (double)3600); | ||
34 | } | ||
35 | |||
36 | private: | ||
37 | |||
38 | int _degrees; | ||
39 | int _minutes; | ||
40 | int _seconds; | ||
41 | }; | ||
42 | |||
43 | class bounding_box { | ||
44 | public: | ||
45 | |||
46 | bounding_box( | ||
47 | coordinate south_west_long, | ||
48 | coordinate south_west_lat, | ||
49 | coordinate north_east_long, | ||
50 | coordinate north_east_lat) : | ||
51 | _south_west_long(south_west_long), | ||
52 | _south_west_lat(south_west_lat), | ||
53 | _north_east_long(north_east_long), | ||
54 | _north_east_lat(north_east_lat) | ||
55 | { | ||
56 | } | ||
57 | |||
58 | const coordinate& getSouthWestLongitude() const | ||
59 | { | ||
60 | return _south_west_long; | ||
61 | } | ||
62 | |||
63 | const coordinate& getSouthWestLatitude() const | ||
64 | { | ||
65 | return _south_west_lat; | ||
66 | } | ||
67 | |||
68 | const coordinate& getNorthEastLongitude() const | ||
69 | { | ||
70 | return _north_east_long; | ||
71 | } | ||
72 | |||
73 | const coordinate& getNorthEastLatitude() const | ||
74 | { | ||
75 | return _north_east_lat; | ||
76 | } | ||
77 | |||
78 | private: | ||
79 | |||
80 | coordinate _south_west_long; | ||
81 | coordinate _south_west_lat; | ||
82 | coordinate _north_east_long; | ||
83 | coordinate _north_east_lat; | ||
84 | }; | ||
85 | |||
86 | } | ||
87 | |||
88 | #endif /* end of include guard: BOUNDING_BOX_H_75D2077D */ | ||