From 69fc8d805396b889b5e8c1c88e8129d93db77d29 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 20 Aug 2016 13:56:23 -0400 Subject: Updated API to use exceptions and make tweet/user objects more helpful --- src/bounding_box.h | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 src/bounding_box.h (limited to 'src/bounding_box.h') 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 @@ +#ifndef BOUNDING_BOX_H_75D2077D +#define BOUNDING_BOX_H_75D2077D + +namespace twitter { + + class coordinate { + public: + + coordinate(int degrees, int minutes = 0, int seconds = 0) : + _degrees(degrees), + _minutes(minutes), + _seconds(seconds) + { + } + + int getDegrees() const + { + return _degrees; + } + + int getMinutes() const + { + return _minutes; + } + + int getSeconds() const + { + return _seconds; + } + + operator double() const + { + return (double)_degrees + ((double)_minutes / (double)60) + ((double)_seconds / (double)3600); + } + + private: + + int _degrees; + int _minutes; + int _seconds; + }; + + class bounding_box { + public: + + bounding_box( + coordinate south_west_long, + coordinate south_west_lat, + coordinate north_east_long, + coordinate north_east_lat) : + _south_west_long(south_west_long), + _south_west_lat(south_west_lat), + _north_east_long(north_east_long), + _north_east_lat(north_east_lat) + { + } + + const coordinate& getSouthWestLongitude() const + { + return _south_west_long; + } + + const coordinate& getSouthWestLatitude() const + { + return _south_west_lat; + } + + const coordinate& getNorthEastLongitude() const + { + return _north_east_long; + } + + const coordinate& getNorthEastLatitude() const + { + return _north_east_lat; + } + + private: + + coordinate _south_west_long; + coordinate _south_west_lat; + coordinate _north_east_long; + coordinate _north_east_lat; + }; + +} + +#endif /* end of include guard: BOUNDING_BOX_H_75D2077D */ -- cgit 1.4.1