This class manipulates dates. More...
#include "../include/DateTool.h"
Static Public Member Functions | |
| static int | getSeconds (const char *str) |
| static int | getMinutes (const char *str) |
| static int | getCurrent (String &str) |
| static int | getCurrent (const char *encode, String &str) |
| static int | decode (const char *str, Date &date) |
| static int | decodeMonth (const char *str) |
| static const char * | getMonthLower (int month) |
| static const char * | getMonth (int month) |
| static const char * | getMonthLong (int month) |
| static const char * | getDayWeek (int day) |
| static int | createLabel (const char *prefix, Date &date, Timezone &tz, int flag, String &str) |
| static int | createLabel (const char *prefix, Date &date, Timezone &tz, String &str) |
| static int | createLabel (Date &date, Timezone &tz, String &str) |
| static int | createLabel (Date &date, String &str) |
| static int | createLabel (Date &date, Timezone &tz, float hour, String &str) |
| static int | createLabel (Date &date, Timezone &tz, const char *name, ForeTime &ftime, String &str) |
| static int | createLabel (Date &date, Timezone &tz, const char *name, float hour, String &str) |
| static int | createLabel (Date &date, const char *name, float hour, String &str) |
| static int | createHourLabel (float hour, int flag, String &str) |
| static int | print (int secs) |
Static Public Attributes | |
| static const int | DAY_OF_WEEK = 0x1 |
This class manipulates dates.
| int DateTool::createHourLabel | ( | float | hour, | |
| int | flag, | |||
| String & | str | |||
| ) | [static] |
Creates a hour string converting hours to days if needed. Multiples of 12 go to x.5 days and multiples of 24 go to x days. Values <= 60 are left as hours unless flag set.
| hour | Hour value to convert | |
| flag | 1=use day values for hours < 60 | |
| str | Output string |
References WXP::String::clear(), WXP::String::copy(), WXP::Const::MISS, and WXP::String::printf().
Referenced by createLabel().
| int DateTool::createLabel | ( | Date & | date, | |
| Timezone & | tz, | |||
| const char * | name, | |||
| float | hour, | |||
| String & | str | |||
| ) | [static] |
Creates a label string from a date, forecast time and source label
| date | The date class to use | |
| tz | The timezone to offset the date | |
| name | The source of data label (such as model name) | |
| hour | The forecast time in hours |
| str | Output string |
References WXP::Date::addSeconds(), WXP::String::append(), createHourLabel(), createLabel(), WXP::String::length(), WXP::Const::MISS, WXP::String::set(), and WXP::StrLib::valid().
| int DateTool::createLabel | ( | Date & | date, | |
| Timezone & | tz, | |||
| const char * | name, | |||
| ForeTime & | ftime, | |||
| String & | str | |||
| ) | [static] |
Creates a label string from a date, forecast time and source label
| date | The date class to use | |
| tz | The timezone to offset the date | |
| name | The source of data label (such as model name) | |
| ftime | The forecast time |
| str | Output string |
References WXP::Date::addHours(), WXP::String::append(), createLabel(), WXP::ForeTime::getFore(), WXP::String::set(), and WXP::ForeTime::toTimeLabel().
Creates a label string from a date adding an hour offset
| date | The date class to use | |
| tz | The output timezone to use | |
| hour | Number of hours to offset date |
| str | Output string |
References WXP::Date::addSeconds(), createLabel(), and WXP::Const::MISS.
Creates a label string from a date
| date | The date class to use |
| str | Output string |
References createLabel().
| int DateTool::createLabel | ( | const char * | prefix, | |
| Date & | date, | |||
| Timezone & | tz, | |||
| int | flag, | |||
| String & | str | |||
| ) | [static] |
Creates a string label for a date
| date | The date class to use | |
| tz | The output timezone to use |
| str | Output string |
References WXP::String::append(), WXP::String::aprintf(), WXP::Date::changeTimezone(), WXP::String::clear(), WXP::Date::getDay(), WXP::Date::getDayOfWeek(), WXP::Date::getHour(), WXP::Date::getMinute(), getMonth(), WXP::Date::getMonth(), WXP::Date::getSecond(), WXP::Date::getYear00(), WXP::Date::isSet(), WXP::Const::MISS, WXP::String::set(), and WXP::StrLib::valid().
Referenced by createLabel(), WXP::WatchPlot::draw(), WXP::RedbookPlot::draw(), WXP::RcmPlot::draw(), WXP::RawPlot::draw(), WXP::MeteoPlot::draw(), WXP::MdrPlot::draw(), WXP::LightPlot::draw(), WXP::Lev2Plot::draw(), WXP::FrontPlot::draw(), WXP::SfcXmlFile::open(), WXP::SfcWxpFile::open(), WXP::SfcCdfFile::open(), WXP::MosUData::print(), WXP::MosData::print(), WXP::MosData::printTable(), WXP::NowradFile::read(), WXP::KavradFile::read(), WXP::SatUniFile::readHeader(), WXP::GiniFile::readHeader(), WXP::AreaFile::readHeader(), and WXP::NidsImage::setImage().
| int DateTool::decode | ( | const char * | str, | |
| Date & | date | |||
| ) | [static] |
Attempts to decode a string which contains a date and output a Date class
| str | String to decode |
| date | Date class to put result |
References WXP::DateVal::day, decodeMonth(), WXP::DateVal::hour, WXP::Date::init(), WXP::DateVal::min, WXP::Const::MISS, WXP::DateVal::month, WXP::DateVal::sec, WXP::Date::set(), and WXP::DateVal::year.
Referenced by WXP::SfcXmlFile::open(), WXP::SfcWxpFile::open(), WXP::SfcUniFile::open(), WXP::SfcCdfFile::open(), and WXP::ImgWxpFile::readHeader().
| int DateTool::decodeMonth | ( | const char * | str | ) | [static] |
Retrieves a integral month from string
| str | String to decode |
Referenced by WXP::NameConv::decode(), decode(), and WXP::MosUFile::read().
| int DateTool::getCurrent | ( | const char * | encode, | |
| String & | str | |||
| ) | [static] |
Returns a string with the current date given a format
| encode | Format to use |
| str | Output string |
References WXP::StrLib::equal(), WXP::Date::set(), and WXP::Date::toText().
| int DateTool::getCurrent | ( | String & | str | ) | [static] |
Returns a string with the current date
| str | String with current date "yyyy mmm dd hh:mm:ssZ" |
References WXP::Date::set(), and WXP::Date::toText().
Referenced by WXP::Message::print(), and WXP::PngFile::write().
| const char * DateTool::getDayWeek | ( | int | day | ) | [static] |
Returns a string for the day of week
| day | Day of week (0-6) |
| const char * DateTool::getMonth | ( | int | month | ) | [static] |
Returns a string for the month
| month | The month (1-12) |
Referenced by createLabel().
| const char * DateTool::getMonthLong | ( | int | month | ) | [static] |
Returns a long string for the month (mixed case)
| month | The month (1-12) |
| const char * DateTool::getMonthLower | ( | int | month | ) | [static] |
Returns a string for the month (lower case)
| month | The month (1-12) |
Referenced by WXP::NameConv::encode().
| int DateTool::getSeconds | ( | const char * | str | ) | [static] |
Computes number of seconds from string
| str | The string to convert |
References WXP::DateVal::day, WXP::Date::getSeconds(), WXP::DateVal::hour, WXP::DateVal::min, WXP::DateVal::month, WXP::Date::set(), and WXP::DateVal::year.
Referenced by WXP::Prog::readResrcFile().
1.6.1