📄 yawpwday.h
字号:
//// C++ Implementation: yawp//// Description:////// Author: Ruan <ruans@kr8.co.za>, (C) 2008//// Copyright: Do what you want, whenever you want.////#ifndef YAWP_WDAY_H#define YAWP_WDAY_H#include <QString>//-----------------------------------------------------------------------------/** Stores the weather for a particular day.@author Ruan <ruans@kr8.co.za>*/class YaWPDay{ public: static const int IMPERIAL = 1; static const int METRIC = 0; YaWPDay() { m_high = 0; m_humid = 0; m_windSpeed = 0; m_windDirec = ""; m_high = 0; m_low = 0; m_current = 0; m_emblem = "unknown"; m_units = METRIC; }; ~YaWPDay() {} QString date() const { return m_date; } void setDate(QString date) { m_date = date; } int current() const { return m_current; } void setCurrent(int current) { m_current = current; } int low() const { return m_low; } void setLow(int low) { m_low = low; } int high() const { return m_high; } void setHigh(int high) { m_high = high; } QString description() const { return m_desc; } void setDescription(QString desc) { m_desc = desc; } QString emblem() const { return m_emblem; } void setEmblem(QString desc) { m_emblem = desc.toLower().replace(" ","-"); } int humidity() const { return m_humid; } void setHumidity(int humid) { m_humid = humid; } int windSpeed() const { return m_windSpeed; } void setWindSpeed(int speed) { m_windSpeed = speed; } QString windDirection() const { return m_windDirec; } void setWindDirection(QString direction) { m_windDirec = direction; } void setUnits(int units) { m_units = units; } int units() const { return m_units; } static int convertDegrees(int from, int to, int unit) { if(from == METRIC && to == IMPERIAL) return unit * 9 / 5 + 32; if(from == IMPERIAL && to == METRIC) return (unit - 32) * 5 / 9; return unit; } static int convertDistance(int from, int to, int unit) { if(from == IMPERIAL && to == METRIC) return ((float)unit) * 1.609344f; if(from == METRIC && to == IMPERIAL) return ((float)unit) / 1.609344f; return unit; } protected: QString m_date; int m_humid; QString m_windDirec; int m_windSpeed; int m_current; int m_high; int m_low; QString m_desc; QString m_emblem; int m_units;};#endif //YAWP_WDAY_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -