WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | List of all members
WXP::DateTool Class Reference

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 NONE = 0x0
 
static const int DAY_OF_WEEK = 0x1
 

Detailed Description

This class manipulates dates.

Author
Dan Vietor

Member Function Documentation

◆ createHourLabel()

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.

Parameters
hourHour value to convert
flag1=use day values for hours < 60
strOutput string

References WXP::String::clear(), WXP::String::copy(), WXP::Const::MISS, and WXP::String::printf().

Referenced by createLabel().

◆ createLabel() [1/8]

int DateTool::createLabel ( const char *  prefix,
Date date,
Timezone tz,
int  flag,
String str 
)
static

Creates a string label for a date

Parameters
prefixA string prefix to add to label
dateThe date class to use
tzThe output timezone to use
flagA flag to alter encoding of label (NONE, DAY_OF_WEEK)
Return values
strOutput string

References WXP::String::append(), WXP::String::aprintf(), WXP::Date::changeTimezone(), WXP::String::clear(), DAY_OF_WEEK, WXP::Date::getDay(), WXP::Date::getDayOfWeek(), WXP::Date::getHour(), WXP::Date::getMinute(), WXP::Date::getMonth(), getMonth(), WXP::Timezone::getName(), WXP::Timezone::getOffset(), WXP::Timezone::getPM(), WXP::Date::getSecond(), WXP::Date::getYear00(), WXP::Date::isSet(), WXP::Timezone::isSet(), WXP::Const::MISS, WXP::String::set(), and WXP::StrLib::valid().

Referenced by WXP::NidsImage::addSite(), createLabel(), createLabel(), createLabel(), createLabel(), createLabel(), createLabel(), createLabel(), WXP::FrontPlot::draw(), WXP::HurPlot::draw(), WXP::Lev2Plot::draw(), WXP::LightPlot::draw(), WXP::MdrPlot::draw(), WXP::MeteoPlot::draw(), WXP::RawPlot::draw(), WXP::RcmPlot::draw(), WXP::RedbookPlot::draw(), WXP::WarnPlot::draw(), WXP::WatchPlot::draw(), WXP::SfcCdfFile::open(), WXP::SfcWxpFile::open(), WXP::SfcXmlFile::open(), WXP::MdrData::print(), WXP::MosData::print(), WXP::MosUData::print(), WXP::RcmData::print(), WXP::MosData::printTable(), WXP::KavradFile::read(), WXP::NowradFile::read(), WXP::MdrImage::readFile(), WXP::GiniFile::readHeader(), WXP::SatCdfFile::readHeader(), WXP::SatUniFile::readHeader(), WXP::AreaFile::readHeader(), WXP::LritFile::readHeader(), and WXP::NidsImage::setImage().

◆ createLabel() [2/8]

int DateTool::createLabel ( const char *  prefix,
Date date,
Timezone tz,
String str 
)
static

Creates a string label for a date

Parameters
prefixA string prefix to add to label
dateThe date class to use
tzThe output timezone to use
Return values
strOutput string

References createLabel().

◆ createLabel() [3/8]

int DateTool::createLabel ( Date date,
const char *  name,
float  hour,
String str 
)
static

Creates a label string from a date, forecast time and source label

Parameters
dateThe date class to use
nameThe source of data label (such as model name)
hourThe forecast time in hours
Return values
strOutput string

References createLabel().

◆ createLabel() [4/8]

int DateTool::createLabel ( Date date,
String str 
)
static

Creates a label string from a date

Parameters
dateThe date class to use
Return values
strOutput string

References createLabel().

◆ createLabel() [5/8]

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

Parameters
dateThe date class to use
tzThe timezone to offset the date
nameThe source of data label (such as model name)
hourThe forecast time in hours
Return values
strOutput string

References WXP::Date::addSeconds(), WXP::String::append(), createHourLabel(), createLabel(), DAY_OF_WEEK, WXP::String::length(), WXP::Const::MISS, WXP::String::set(), and WXP::StrLib::valid().

◆ createLabel() [6/8]

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

Parameters
dateThe date class to use
tzThe timezone to offset the date
nameThe source of data label (such as model name)
ftimeThe forecast time
Return values
strOutput string

References WXP::Date::addHours(), WXP::String::append(), createLabel(), WXP::ForeTime::getFore(), WXP::String::set(), and WXP::ForeTime::toTimeLabel().

◆ createLabel() [7/8]

int DateTool::createLabel ( Date date,
Timezone tz,
float  hour,
String str 
)
static

Creates a label string from a date adding an hour offset

Parameters
dateThe date class to use
tzThe output timezone to use
hourNumber of hours to offset date
Return values
strOutput string

References WXP::Date::addSeconds(), createLabel(), and WXP::Const::MISS.

◆ createLabel() [8/8]

int DateTool::createLabel ( Date date,
Timezone tz,
String str 
)
static

Creates a string label for a date

Parameters
dateThe date class to use
tzThe output timezone to use
Return values
strOutput string

References createLabel().

◆ decode()

int DateTool::decode ( const char *  str,
Date date 
)
static

◆ decodeMonth()

int DateTool::decodeMonth ( const char *  str)
static

Retrieves a integral month from string

Parameters
strString to decode
Returns
Integer month value (1-12)

Referenced by WXP::NameConv::decode(), decode(), and WXP::MosUFile::read().

◆ getCurrent() [1/2]

int DateTool::getCurrent ( const char *  encode,
String str 
)
static

Returns a string with the current date given a format

Parameters
encodeFormat to use
Return values
strOutput string
See also
Date::toText(char *,String &)

References WXP::StrLib::equal(), WXP::Date::set(), and WXP::Date::toText().

◆ getCurrent() [2/2]

int DateTool::getCurrent ( String str)
static

Returns a string with the current date

Return values
strString 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().

◆ getDayWeek()

const char * DateTool::getDayWeek ( int  day)
static

Returns a string for the day of week

Parameters
dayDay of week (0-6)
Returns
String value (SUN-SAT)

◆ getMinutes()

int DateTool::getMinutes ( const char *  str)
static

Computes number of minutes from string

Parameters
strThe string to convert (hhnn)
Returns
The number of minutes since midnight

Referenced by WXP::LightPlot::setFile().

◆ getMonth()

const char * DateTool::getMonth ( int  month)
static

Returns a string for the month

Parameters
monthThe month (1-12)
Returns
String value (JAN-DEC)

Referenced by createLabel(), and WXP::NameConv::encode().

◆ getMonthLong()

const char * DateTool::getMonthLong ( int  month)
static

Returns a long string for the month (mixed case)

Parameters
monthThe month (1-12)
Returns
String value (January-December)

◆ getMonthLower()

const char * DateTool::getMonthLower ( int  month)
static

Returns a string for the month (lower case)

Parameters
monthThe month (1-12)
Returns
String value (JAN-DEC)

Referenced by WXP::NameConv::encode(), and WXP::WmoIngest::setAction().

◆ getSeconds()

int DateTool::getSeconds ( const char *  str)
static

Computes number of seconds from string

Parameters
strThe string to convert (yyyymmddhhnn)
Returns
The number of seconds since 1/1/1970

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().

◆ print()

int DateTool::print ( int  secs)
static

Prints a string given time in seconds since 1/1/1970 (debug tool)

Parameters
secsNumber of seconds

References WXP::Date::print().

Member Data Documentation

◆ DAY_OF_WEEK

const int WXP::DateTool::DAY_OF_WEEK = 0x1
static

Flag to add day of week to label

Referenced by createLabel(), and createLabel().

◆ NONE

const int WXP::DateTool::NONE = 0x0
static

Null Flag


The documentation for this class was generated from the following files: