![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
Descriptor for a digit sequence within a text. More...
#include <qlocale_p.h>
Public Types | |
| enum class | Option { Default = 0 , AllowSign = 1 } |
Public Member Functions | |
| Q_DECLARE_FLAGS (Options, Option) | |
| Q_AUTOTEST_EXPORT | DigitSequence (QStringView text, NumericData &&numeric, DigitSequence::Options flags=DigitSequence::Option::Default, qsizetype from=0) |
| DigitSequence (const DigitSequence &)=default | |
| DigitSequence (DigitSequence &&)=default | |
| DigitSequence & | operator= (const DigitSequence &)=default |
| DigitSequence & | operator= (DigitSequence &&)=default |
| ~DigitSequence ()=default | |
| qsizetype | endIndex () const |
| qsizetype | size () const |
| Returns the number of ASCII characters describing the digit sequence. | |
| bool | isEmpty () const |
| Returns true precisely if this digit sequence represents nothing. | |
| bool | hasSign () const |
| Returns true precisely if the digit sequence parsed includes a leading sign. | |
| void | transcribeTo (CharBuff *buff) const |
| Transcribes the ASCII form of this digit sequence to buff. | |
| DigitSequence | first (qsizetype count) const |
| Returns a DigitSequence describing a prefix of this. | |
| DigitSequence | last (qsizetype count) const |
| Returns a DigitSequence describing a tail of this. | |
| DigitSequence | sliced (qsizetype from) const |
| Returns a DigitSequence describing a tail of this. | |
| DigitSequence | sliced (qsizetype from, qsizetype count) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| QStringView | used (const QStringView text, qsizetype from) const |
| QStringView | used (const QStringView text) const |
| Returns the slice of text described by this digit sequence. | |
Public Attributes | |
| QByteArray | digits |
| qsizetype | digitStart |
| qint8 | digitWidth |
| char | sign = '\0' |
Descriptor for a digit sequence within a text.
Packages the ASCII equivalent (optional sign and) digit sequence, along with a description of which parts come from where in the original text.
Supports construction or assignment by moving or copying. Modifying its members, other than by assigning a newly constructed value or a result of taking a subsequence, may lead to undefined behaviour.
Definition at line 452 of file qlocale_p.h.
|
strong |
Options to modify how digit sequences are parsed.
\value Default The null option value. \value AllowSign A leading sign character may be present.
In the numeric fields of a date, only a year field ever has a sign, all others use ungrouped digits. Zero-padding on the left of day and month fields is common (and it may also appear in year fields). The hour field of a zone-offset may also have a sign. Otherwise all numeric time fields are similar to numeric month and day fields.
In numeric fields of a time, the least-significant given (be it hour, minute or second) may have a fractional part in some formats. The handling of this is left for the caller to take care of. Likewise, the caller is expected to deal with leading and trailing space appropriately.
| Enumerator | |
|---|---|
| Default | |
| AllowSign | |
Definition at line 462 of file qlocale_p.h.
| Q_AUTOTEST_EXPORT QLocaleData::DigitSequence::DigitSequence | ( | QStringView | text, |
| NumericData && | numeric, | ||
| DigitSequence::Options | flags = DigitSequence::Option::Default, | ||
| qsizetype | from = 0 ) |
|
default |
|
default |
|
default |
|
inline |
Definition at line 479 of file qlocale_p.h.
|
inline |
Returns a DigitSequence describing a prefix of this.
The result describes the first count ASCII characters to which the sequence corresponds and their positions within the parsed text. The value of count must not be negative or exceed size().
Definition at line 503 of file qlocale_p.h.
References hasSign().
|
inline |
Returns true precisely if the digit sequence parsed includes a leading sign.
It is equivalent to {sign != '\0'}.
Definition at line 491 of file qlocale_p.h.
References sign.
Referenced by first(), and sliced().
|
inline |
Returns true precisely if this digit sequence represents nothing.
This arises when the constructor found no digits and (when allowed) not even a sign. It may also result from extracting an empty subsequence of a digit sequence that was originally parsed. It is equivalent to \l {QLocaleData::DigitSequence::}{size()} == 0. To test whether any digits were found, use {digits.isEmpty()}, which may be true even though {isEmpty()} is false. That arises when only a sign was found (making {size() == 1}).
Definition at line 490 of file qlocale_p.h.
|
inline |
Returns a DigitSequence describing a tail of this.
The result describes the last count ASCII characters to which the sequence corresponds. The value of count must not be negative or exceed size(). The result is equivalent to {sliced(size() - count)}.
Definition at line 511 of file qlocale_p.h.
|
default |
|
default |
|
inline |
Returns the number of ASCII characters describing the digit sequence.
This is the number of digits plus, if present, one for the sign. It is the number of characters \l transcribeTo() will transcribe. For the number of digits found, use {digits.size()}. Note that this may be less than the length of the text parsed, for example when the digits are surrogate pairs or the sign includes special Unicode markers, such as those for text direction.
Definition at line 485 of file qlocale_p.h.
|
inline |
Returns a DigitSequence describing a tail of this.
This skips over the text to which the first from ASCII characters of the sequence correspond, to describe the remainder and their positions within the parsed text. The value of from must not be negative or exceed size().
Definition at line 513 of file qlocale_p.h.
References hasSign().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a DigitSequence describing a subsequence of this.
This skips over the portion of the text to which first from ASCII characters correspond and describes the portion described by the next count ASCII characters. The value of from must not be negative or exceed size(). The value of count must not be negative or exceed {size() - from}. The result is equivalent to {sliced(from).first(count)}.
Definition at line 522 of file qlocale_p.h.
Transcribes the ASCII form of this digit sequence to buff.
Definition at line 493 of file qlocale_p.h.
References sign.
|
inlinenodiscard |
Returns the slice of text described by this digit sequence.
The given text should be the one passed to the constructor either of this digit sequence or of one from which it was obtained by some combination of \l first(), \l sliced() and \l last(). In the directly-constructed case, or in the case of (optionally repeatedly) applying only \l first(), from may be passed: it should be the like-named offset passed to the original constructor, or 0 if no offset was passed. In that case, the whole text parsed for this digit sequence (alibeit possibly a prefix of the text originally parsed) is returned. Otherwise, from should be omitted and this function returns the text described by just the digits of this sequence, omitting (even when relevant) the sign.
Definition at line 528 of file qlocale_p.h.
|
inlinenodiscard |
Definition at line 526 of file qlocale_p.h.
| QByteArray QLocaleData::DigitSequence::digits |
Definition at line 454 of file qlocale_p.h.
| qsizetype QLocaleData::DigitSequence::digitStart |
Definition at line 456 of file qlocale_p.h.
| qint8 QLocaleData::DigitSequence::digitWidth |
Definition at line 459 of file qlocale_p.h.
| char QLocaleData::DigitSequence::sign = '\0' |
Definition at line 460 of file qlocale_p.h.
Referenced by hasSign(), and transcribeTo().