00001 /* Ratios. 00002 * 00003 * PegSoft miscellaneous library (c) 2004 PegSoft 00004 * Contact us at pegsoft@pegsoft.net 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License version 2 as 00008 * published by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this software (the COPYING file); if not, write to the 00017 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 00018 * USA. 00019 * 00020 */ 00021 00027 #ifndef MISC_RATIO_H 00028 #define MISC_RATIO_H 00029 00030 /*************************************************************************/ 00031 00032 namespace misc 00033 { 00034 00035 /*************************************************************************/ 00036 00038 00041 class Ratio 00042 { 00043 public: 00045 Ratio() : m_x(0), m_y(0) { } 00047 Ratio(int32_t x, int32_t y) : m_x(x), m_y(y) { } 00049 Ratio(Ratio const &r) : m_x(r.m_x), m_y(r.m_y) { } 00051 Ratio &operator=(Ratio const &right); 00052 00054 bool operator==(Ratio const &right); 00055 00057 int32_t x() const { return m_x; } 00059 int32_t x(int32_t x) { return (m_x = x); } 00061 int32_t y() const { return m_y; } 00063 int32_t y(int32_t y) { return (m_y = y); } 00064 private: 00065 int32_t m_x; 00066 int32_t m_y; 00067 }; 00068 00069 /*************************************************************************/ 00070 00071 } /* namespace misc */ 00072 00073 /*************************************************************************/ 00074 00075 #endif /* MISC_RATIO_H */