KDbYear
#include <KDbDateTime.h>
Public Types | |
enum class | Sign { None , Plus , Minus } |
Public Member Functions | |
KDbYear () | |
KDbYear (const QByteArray &string) | |
KDbYear (Sign sign, const QByteArray &string) | |
bool | isNull () const |
bool | isValid () const |
bool | operator!= (const KDbYear &other) const |
bool | operator< (const KDbYear &other) const |
bool | operator<= (const KDbYear &other) const |
bool | operator== (const KDbYear &other) const |
bool | operator> (const KDbYear &other) const |
bool | operator>= (const KDbYear &other) const |
Sign | sign () const |
QByteArray | signString () const |
int | toIsoValue () const |
int | toQDateValue () const |
QByteArray | toString () const |
QByteArray | yearString () const |
Detailed Description
Generic year constant based on extended ISO 8601 specification.
This class as well as KDbDate, KDbTime and KDbDateTime is used as a replacement for Qt date/time value classes in case when invalid values have to be preserved. Without this, SQL parsers would not function properly because they would loose information about mistyped constants. The KDb* make it possible for the user to store the constants in SQL expressions and fix them at later time.
See this page for specifications of the date/time formats supported: https://community.kde.org/Kexi/Plugins/Queries/SQL_Constants#Date_constants
- Since
- 3.2.0
Definition at line 42 of file KDbDateTime.h.
Member Enumeration Documentation
◆ Sign
|
strong |
Specifies sign which is used to annotate year.
Definition at line 48 of file KDbDateTime.h.
Constructor & Destructor Documentation
◆ KDbYear() [1/3]
|
inline |
Constructs year based on given sign and string.
Resulting year can be invalid but the string is always preserved.
Definition at line 59 of file KDbDateTime.h.
◆ KDbYear() [2/3]
|
inlineexplicit |
Constructs yea based on given string, with sign set to Sign::None.
Resulting year can be invalid but the string is always preserved.
Definition at line 68 of file KDbDateTime.h.
◆ KDbYear() [3/3]
|
inline |
Contructs a null year.
Definition at line 75 of file KDbDateTime.h.
Member Function Documentation
◆ isNull()
bool KDbYear::isNull | ( | ) | const |
Returns true
if the year is null.
A year is null if its sign is equal to Sign::None and string is empty.
Definition at line 71 of file KDbDateTime.cpp.
◆ isValid()
bool KDbYear::isValid | ( | ) | const |
Returns true
if the year is valid.
Year is invalid if it is null or if the supplied string is invalid according to specification.
Definition at line 66 of file KDbDateTime.cpp.
◆ operator!=()
|
inline |
Definition at line 81 of file KDbDateTime.h.
◆ operator<()
bool KDbYear::operator< | ( | const KDbYear & | other | ) | const |
Definition at line 61 of file KDbDateTime.cpp.
◆ operator<=()
|
inline |
Definition at line 85 of file KDbDateTime.h.
◆ operator==()
bool KDbYear::operator== | ( | const KDbYear & | other | ) | const |
Definition at line 56 of file KDbDateTime.cpp.
◆ operator>()
|
inline |
Definition at line 89 of file KDbDateTime.h.
◆ operator>=()
|
inline |
Definition at line 87 of file KDbDateTime.h.
◆ sign()
|
inline |
Returns the sign which is used to annotate year.
Definition at line 108 of file KDbDateTime.h.
◆ signString()
QByteArray KDbYear::signString | ( | ) | const |
Definition at line 76 of file KDbDateTime.cpp.
◆ toIsoValue()
int KDbYear::toIsoValue | ( | ) | const |
Returns the integer year value as defined by extended ISO 8601.
0 is returned for invalid year.
Definition at line 130 of file KDbDateTime.cpp.
◆ toQDateValue()
int KDbYear::toQDateValue | ( | ) | const |
Returns the integer year value as defined by the QDate API.
0 is returned for invalid year.
Definition at line 135 of file KDbDateTime.cpp.
◆ toString()
QByteArray KDbYear::toString | ( | ) | const |
Returns entire year value (with sign) converted to string even if it is invalid.
Definition at line 119 of file KDbDateTime.cpp.
◆ yearString()
|
inline |
Returns the string representation of year value even if it is invalid.
Definition at line 115 of file KDbDateTime.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.