Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Member Functions | Friends | List of all members
JDATABASE::JDateAndTime_t Struct Reference

Date and time. More...

#include <JDate_t.hh>

Inheritance diagram for JDATABASE::JDateAndTime_t:
JEEP::JDate< JSeparator_t > JEEP::JTime< JSeparator_t > JLANG::JMultiComparable< JClass_t, JTypelist_t > JLANG::JComparable< JFirst_t, JSecond_t > JLANG::JComparable< JFirst_t, JSecond_t > JDATABASE::JDateAndTimeUS_t

Public Member Functions

 JDateAndTime_t ()
 Default constructor;. More...
 
bool less (const JDate &date) const
 Less-than method. More...
 
bool less (const JTime &time) const
 Less-than method. More...
 

Static Public Member Functions

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

Public Attributes

int year
 year More...
 
int month
 month More...
 
int day
 day More...
 
int hour
 hour More...
 
int minute
 minute More...
 
int second
 second More...
 

Static Public Attributes

static const char SEPARATOR = '-'
 Separation character. More...
 

Static Protected Member Functions

template<class JHead_t , class JTail_t >
static bool lt (const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JTail_t > > &type)
 Less than method for composite data types. More...
 
template<class JHead_t >
static bool lt (const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JNullType > > &type)
 Less than method for composite data types. More...
 

Friends

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

Detailed Description

Date and time.

Definition at line 31 of file JDate_t.hh.

Constructor & Destructor Documentation

◆ JDateAndTime_t()

JDATABASE::JDateAndTime_t::JDateAndTime_t ( )
inline

Default constructor;.

Definition at line 45 of file JDate_t.hh.

46  {}

Member Function Documentation

◆ min() [1/2]

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

Minimal date.

Definition at line 86 of file JDate.hh.

◆ max() [1/2]

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

Maximal date.

Definition at line 87 of file JDate.hh.

◆ less() [1/2]

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

Less-than method.

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

Definition at line 96 of file JDate.hh.

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

◆ min() [2/2]

template<char JSeparator_t>
static JTime JEEP::JTime< JSeparator_t >::min ( )
inlinestaticinherited

Minimal time.

Definition at line 86 of file Jeep/JTime.hh.

◆ max() [2/2]

template<char JSeparator_t>
static JTime JEEP::JTime< JSeparator_t >::max ( )
inlinestaticinherited

Maximal time.

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

◆ less() [2/2]

template<char JSeparator_t>
bool JEEP::JTime< JSeparator_t >::less ( const JTime< JSeparator_t > &  time) const
inlineinherited

Less-than method.

Parameters
timetime
Returns
true if this time earlier than given time; else false

Definition at line 96 of file Jeep/JTime.hh.

97  {
98  if (this->hour == time.hour) {
99 
100  if (this->minute == time.minute)
101  return this->second < time.second;
102  else
103  return this->minute < time.minute;
104 
105  } else {
106 
107  return this->hour < time.hour;
108  }
109  }
int second
second
Definition: Jeep/JTime.hh:155
int minute
minute
Definition: Jeep/JTime.hh:154
int hour
hour
Definition: Jeep/JTime.hh:153

◆ lt() [1/2]

template<class JClass_t , class JTypelist_t >
template<class JHead_t , class JTail_t >
static bool JLANG::JMultiComparable< JClass_t, JTypelist_t >::lt ( const JClass_t &  first,
const JClass_t &  second,
const JType< JTypeList< JHead_t, JTail_t > > &  type 
)
inlinestaticprotectedinherited

Less than method for composite data types.

Parameters
firstfirst object
secondsecond object
typetype
Returns
true if first object is less than second object; else false

Definition at line 43 of file JMultiComparable.hh.

46  {
47  if (static_cast<const JHead_t&>(first) <
48  static_cast<const JHead_t&>(second))
49  return true;
50  else if (static_cast<const JHead_t&>(second) <
51  static_cast<const JHead_t&>(first))
52  return false;
53  else
54  return lt(first, second, JType<JTail_t>());
55  }
static bool lt(const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JTail_t > > &type)
Less than method for composite data types.
Auxiliary class for a type holder.
Definition: JType.hh:19

◆ lt() [2/2]

template<class JClass_t , class JTypelist_t >
template<class JHead_t >
static bool JLANG::JMultiComparable< JClass_t, JTypelist_t >::lt ( const JClass_t &  first,
const JClass_t &  second,
const JType< JTypeList< JHead_t, JNullType > > &  type 
)
inlinestaticprotectedinherited

Less than method for composite data types.

Parameters
firstfirst object
secondsecond object
typetype
Returns
true if first object is less than second object; else false

Definition at line 67 of file JMultiComparable.hh.

70  {
71  return (static_cast<const JHead_t&>(first) <
72  static_cast<const JHead_t&>(second));
73  }

Friends And Related Function Documentation

◆ operator>>

std::istream& operator>> ( std::istream &  in,
JDateAndTime_t object 
)
friend

Read date and time from input stream.

Parameters
ininput stream
objectdate and time
Returns
input stream

Definition at line 56 of file JDate_t.hh.

57  {
58  in >> static_cast<JDate_t&>(object);
59 
60  if (in.get() == (int) SEPARATOR) {
61  in >> static_cast<JTime_t&>(object);
62  }
63 
64  return in;
65  }
static const char SEPARATOR
Separation character.
Definition: JDate_t.hh:39
Auxiliary class for simple date.
Definition: JDate.hh:40
Auxiliary class for simple time.
Definition: Jeep/JTime.hh:40

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const JDateAndTime_t object 
)
friend

Write date and time to output stream.

Parameters
outoutput stream
objectdate and time
Returns
output stream

Definition at line 75 of file JDate_t.hh.

76  {
77  out << static_cast<const JDate_t&>(object);
78  out << SEPARATOR;
79  out << static_cast<const JTime_t&>(object);
80 
81  return out;
82  }

Member Data Documentation

◆ SEPARATOR

const char JDATABASE::JDateAndTime_t::SEPARATOR = '-'
static

Separation character.

Definition at line 39 of file JDate_t.hh.

◆ year

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

year

Definition at line 153 of file JDate.hh.

◆ month

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

month

Definition at line 154 of file JDate.hh.

◆ day

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

day

Definition at line 155 of file JDate.hh.

◆ hour

template<char JSeparator_t>
int JEEP::JTime< JSeparator_t >::hour
inherited

hour

Definition at line 153 of file Jeep/JTime.hh.

◆ minute

template<char JSeparator_t>
int JEEP::JTime< JSeparator_t >::minute
inherited

minute

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

◆ second

template<char JSeparator_t>
int JEEP::JTime< JSeparator_t >::second
inherited

second

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


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