Jpp  15.0.5
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
JEEP::JDate< JSeparator_t > Struct Template Reference

Auxiliary class for simple date. More...

#include <JDate.hh>

Inheritance diagram for JEEP::JDate< JSeparator_t >:
JLANG::JComparable< JFirst_t, JSecond_t >

Public Member Functions

 JDate ()
 Default constructor. More...
 
 JDate (const int year, const int month, const int day)
 Constructor. More...
 
 JDate (const std::string &date)
 Constructor. More...
 
bool less (const JDate &date) const
 Less-than method. More...
 

Static Public Member Functions

static JDate min ()
 Minimal date. More...
 
static JDate max ()
 Maximal date. More...
 

Public Attributes

int year
 year More...
 
int month
 month More...
 
int day
 day More...
 

Static Public Attributes

static const char SEPARATOR = JSeparator_t
 Separation character. More...
 

Friends

std::istream & operator>> (std::istream &in, JDate &object)
 Read date from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JDate &object)
 Write date to output stream. More...
 

Detailed Description

template<char JSeparator_t>
struct JEEP::JDate< JSeparator_t >

Auxiliary class for simple date.

The corresponding ASCII format is yyyy<separator>mm<separator>dd,
where yyyy corresponds to the year, mm to the month and dd to the day.
The separator is defined by the template parameter.

Definition at line 39 of file Jeep/JDate.hh.

Constructor & Destructor Documentation

template<char JSeparator_t>
JEEP::JDate< JSeparator_t >::JDate ( )
inline

Default constructor.

Definition at line 51 of file Jeep/JDate.hh.

51  :
52  year (0),
53  month(0),
54  day (0)
55  {}
int year
year
Definition: Jeep/JDate.hh:154
int month
month
Definition: Jeep/JDate.hh:155
int day
day
Definition: Jeep/JDate.hh:156
template<char JSeparator_t>
JEEP::JDate< JSeparator_t >::JDate ( const int  year,
const int  month,
const int  day 
)
inline

Constructor.

Parameters
yearyear
monthmonth
dayday

Definition at line 65 of file Jeep/JDate.hh.

67  :
68  year (year),
69  month(month),
70  day (day)
71  {}
int year
year
Definition: Jeep/JDate.hh:154
int month
month
Definition: Jeep/JDate.hh:155
int day
day
Definition: Jeep/JDate.hh:156
template<char JSeparator_t>
JEEP::JDate< JSeparator_t >::JDate ( const std::string &  date)
inline

Constructor.

Parameters
datedate

Definition at line 79 of file Jeep/JDate.hh.

80  {
81  std::istringstream in(date);
82 
83  in >> *this;
84  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41

Member Function Documentation

template<char JSeparator_t>
static JDate JEEP::JDate< JSeparator_t >::min ( )
inlinestatic

Minimal date.

Definition at line 87 of file Jeep/JDate.hh.

template<char JSeparator_t>
static JDate JEEP::JDate< JSeparator_t >::max ( )
inlinestatic

Maximal date.

Definition at line 88 of file Jeep/JDate.hh.

template<char JSeparator_t>
bool JEEP::JDate< JSeparator_t >::less ( const JDate< JSeparator_t > &  date) const
inline

Less-than method.

Parameters
datedate
Returns
true if this date earlier than given date; else false

Definition at line 97 of file Jeep/JDate.hh.

98  {
99  if (this->year == date.year) {
100 
101  if (this->month == date.month)
102  return this->day < date.day;
103  else
104  return this->month < date.month;
105 
106  } else {
107 
108  return this->year < date.year;
109  }
110  }
int year
year
Definition: Jeep/JDate.hh:154
int month
month
Definition: Jeep/JDate.hh:155
int day
day
Definition: Jeep/JDate.hh:156

Friends And Related Function Documentation

template<char JSeparator_t>
std::istream& operator>> ( std::istream &  in,
JDate< JSeparator_t > &  object 
)
friend

Read date from input stream.

Parameters
ininput stream
objectdate
Returns
input stream

Definition at line 120 of file Jeep/JDate.hh.

121  {
122  using namespace std;
123  using namespace JPP;
124 
125  object = JDate();
126 
127  while (isspace(in.peek())) { in.ignore(); }
128 
129  const locale loc = in.imbue(locale(in.getloc(), new JWhiteSpacesFacet(in.getloc(), JDate::SEPARATOR)));
130 
131  in >> object.year >> object.month >> object.day;
132 
133  in.imbue(loc);
134 
135  return in;
136  }
static const char SEPARATOR
Separation character.
Definition: Jeep/JDate.hh:45
JDate()
Default constructor.
Definition: Jeep/JDate.hh:51
char * loc(char *orig)
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
template<char JSeparator_t>
std::ostream& operator<< ( std::ostream &  out,
const JDate< JSeparator_t > &  object 
)
friend

Write date to output stream.

Parameters
outoutput stream
objectdate
Returns
output stream

Definition at line 146 of file Jeep/JDate.hh.

147  {
148  return out << FILL(4,'0') << object.year << JDate::SEPARATOR
149  << FILL(2,'0') << object.month << JDate::SEPARATOR
150  << FILL(2,'0') << object.day << FILL();
151  }
static const char SEPARATOR
Separation character.
Definition: Jeep/JDate.hh:45
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:328

Member Data Documentation

template<char JSeparator_t>
const char JEEP::JDate< JSeparator_t >::SEPARATOR = JSeparator_t
static

Separation character.

Definition at line 45 of file Jeep/JDate.hh.

template<char JSeparator_t>
int JEEP::JDate< JSeparator_t >::year

year

Definition at line 154 of file Jeep/JDate.hh.

template<char JSeparator_t>
int JEEP::JDate< JSeparator_t >::month

month

Definition at line 155 of file Jeep/JDate.hh.

template<char JSeparator_t>
int JEEP::JDate< JSeparator_t >::day

day

Definition at line 156 of file Jeep/JDate.hh.


The documentation for this struct was generated from the following file: