class SvNumberformat; class SvNFLanguageData; enumclass SvNumFormatType : sal_Int16;
#define SV_MAX_COUNT_INPUT_STRINGS 20// max count of substrings in input scanner
class ImpSvNumberInputScan
{ public: explicit ImpSvNumberInputScan(SvNFLanguageData& rCurrentLanguage);
~ImpSvNumberInputScan();
/*!*/ void ChangeIntl(); // MUST be called if language changes
/// set reference date for offset calculation void ChangeNullDate( const sal_uInt16 nDay, const sal_uInt16 nMonth, const sal_Int16 nYear );
/// convert input string to number bool IsNumberFormat( const OUString& rString, /// input string
SvNumFormatType& F_Type, /// format type (in + out) double& fOutNumber, /// value determined (out) const SvNumberformat* pFormat, /// number format to which compare against const NativeNumberWrapper& rNatNum,
SvNumInputOptions eInputOptions);
/// after IsNumberFormat: get decimal position short GetDecPos() const { return nDecPos; } /// after IsNumberFormat: get count of numeric substrings in input string
sal_uInt16 GetNumericsCount() const { return nNumericsCnt; }
/// set threshold of two-digit year input void SetYear2000( sal_uInt16 nVal ) { nYear2000 = nVal; } /// get threshold of two-digit year input
sal_uInt16 GetYear2000() const { return nYear2000; }
/** Whether input can be forced to ISO 8601 format.
/** Whether 'T' separator was detected in an ISO 8601 date+time format.
*/ bool HasIso8601Tsep() const { return bIso8601Tsep; }
private:
SvNFLanguageData& mrCurrentLanguageData; const SvNumberformat* mpFormat; //* The format to compare against, if any
std::unique_ptr<OUString[]> pUpperMonthText; //* Array of month names, uppercase
std::unique_ptr<OUString[]> pUpperAbbrevMonthText; //* Array of month names, abbreviated, uppercase
std::unique_ptr<OUString[]> pUpperGenitiveMonthText; //* Array of genitive month names, uppercase
std::unique_ptr<OUString[]> pUpperGenitiveAbbrevMonthText; //* Array of genitive month names, abbreviated, uppercase
std::unique_ptr<OUString[]> pUpperPartitiveMonthText; //* Array of partitive month names, uppercase
std::unique_ptr<OUString[]> pUpperPartitiveAbbrevMonthText;//* Array of partitive month names, abbreviated, uppercase
std::unique_ptr<OUString[]> pUpperDayText; //* Array of day of week names, uppercase
std::unique_ptr<OUString[]> pUpperAbbrevDayText; //* Array of day of week names, abbreviated, uppercase
OUString aUpperCurrSymbol; //* Currency symbol, uppercase
Date maNullDate; //* 30Dec1899 bool bTextInitialized; //* Whether days and months are initialized bool bScanGenitiveMonths; //* Whether to scan an input for genitive months bool bScanPartitiveMonths; //* Whether to scan an input for partitive months // Variables for provisional results:
OUString sStrArray[SV_MAX_COUNT_INPUT_STRINGS];//* Array of scanned substrings bool IsNum[SV_MAX_COUNT_INPUT_STRINGS]; //* Whether a substring is numeric
sal_uInt16 nNums[SV_MAX_COUNT_INPUT_STRINGS]; //* Sequence of offsets to numeric strings
sal_uInt16 nStringsCnt; //* Total count of scanned substrings
sal_uInt16 nNumericsCnt; //* Count of numeric substrings bool bDecSepInDateSeps; //* True <=> DecSep in {.,-,/,DateSep}
sal_uInt8 nMatchedAllStrings; //* Scan...String() matched all substrings,
int nSign; // Sign of number int nMonth; // Month (1..x) if date // negative => short format short nMonthPos; // 1 = front, 2 = middle // 3 = end int nDayOfWeek; // Temporary (!) day of week (1..7,-1..-7) if date
sal_uInt16 nTimePos; // Index of first time separator (+1) short nDecPos; // Index of substring containing "," (+1) bool bNegCheck; // '( )' for negative short nESign; // Sign of exponent short nAmPm; // +1 AM, -1 PM, 0 if none short nLogical; // -1 => False, 1 => True bool mbEraCE; // Era if date, 0 => BCE, 1 => CE (currently only Gregorian)
sal_uInt16 nThousand; // Count of group (AKA thousand) separators
sal_uInt16 nPosThousandString; // Position of concatenated 000,000,000 string
SvNumFormatType eScannedType; // Scanned type
SvNumFormatType eSetType; // Preset Type
sal_uInt16 nStringScanNumFor; // Fixed strings recognized in // pFormat->NumFor[nNumForStringScan] short nStringScanSign; // Sign resulting of FixString
sal_uInt16 nYear2000; // Two-digit threshold // Year as 20xx // default 18 // number <= nYear2000 => 20xx // number > nYear2000 => 19xx
// Copy assignment is forbidden and not implemented.
ImpSvNumberInputScan (const ImpSvNumberInputScan &) = delete;
ImpSvNumberInputScan & operator= (const ImpSvNumberInputScan &) = delete;
void Reset(); // Reset all variables before start of analysis
void InitText(); // Init of months and days of week
// Convert string to double. // Only simple unsigned floating point values without any error detection, // decimal separator has to be '.' // If bForceFraction==true the string is taken to be the fractional part // of 0.1234 without the leading 0. (thus being just "1234"). staticdouble StringToDouble( std::u16string_view aStr, bool bForceFraction = false );
// Next number/string symbol staticbool NextNumberStringSymbol( const sal_Unicode*& pStr,
OUString& rSymbol );
// Concatenate ,000,23 blocks // in input to 000123 bool SkipThousands( const sal_Unicode*& pStr, OUString& rSymbol ) const;
// Divide numbers/strings into // arrays and variables above. // Leading blanks and blanks // after numbers are thrown away void NumberStringDivision( const OUString& rString );
// Jump over rWhat in rString at nPos staticinlinebool SkipString( const OUString& rWhat, const OUString& rString,
sal_Int32& nPos );
// Recognizes exactly ,111 as group separator inlinebool GetThousandSep( std::u16string_view rString,
sal_Int32& nPos,
sal_uInt16 nStringPos ) const; // Get boolean value short GetLogical( std::u16string_view rString ) const;
// Get month and advance string position short GetMonth( const OUString& rString,
sal_Int32& nPos );
// Get day of week and advance string position int GetDayOfWeek( const OUString& rString,
sal_Int32& nPos );
// Get currency symbol and advance string position bool GetCurrency( const OUString& rString,
sal_Int32& nPos );
// Get symbol AM or PM and advance string position bool GetTimeAmPm( const OUString& rString,
sal_Int32& nPos );
// Get decimal separator and advance string position inlinebool GetDecSep( std::u16string_view rString,
sal_Int32& nPos ) const;
// Get hundredth seconds separator and advance string position inlinebool GetTime100SecSep( std::u16string_view rString,
sal_Int32& nPos ) const;
// Get sign and advance string position // Including special case '(' int GetSign( std::u16string_view rString,
sal_Int32& nPos );
// Get sign of exponent and advance string position staticshort GetESign( std::u16string_view rString,
sal_Int32& nPos );
// Get next number as array offset inlinebool GetNextNumber( sal_uInt16& i,
sal_uInt16& j ) const;
/** Converts time -> double (only decimals)
@returnTRUEiftime,FALSEifnot(e.g.hours>12withAM/PM)
*/ bool GetTimeRef( double& fOutNumber, // result as double
sal_uInt16 nIndex, // Index of hour in input
sal_uInt16 nCnt, // Count of time substrings in input
SvNumInputOptions eInputOptions ) const;
sal_uInt16 ImplGetDay ( sal_uInt16 nIndex ) const; // Day input, 0 if no match
sal_uInt16 ImplGetMonth( sal_uInt16 nIndex ) const; // Month input, zero based return, NumberOfMonths if no match
sal_uInt16 ImplGetYear ( sal_uInt16 nIndex ); // Year input, 0 if no match
// Conversion of date to number bool GetDateRef( double& fDays, // OUT: days diff to null date
sal_uInt16& nCounter ); // Count of date substrings
// Analyze end of string bool ScanEndString( const OUString& rString );
// Compare rString to substring of array indexed by nString // nString == 0xFFFF => last substring bool ScanStringNumFor( const OUString& rString,
sal_Int32 nPos,
sal_uInt16 nString, bool bDontDetectNegation = false );
// if nMatchedAllStrings set nMatchedUsedAsReturn and return true, // else do nothing and return false bool MatchedReturn();
//! Be sure that the string to be analyzed is already converted to upper //! case and if it contained native number digits that they are already //! converted to ASCII.
// Main analyzing function bool IsNumberFormatMain( const OUString& rString, const SvNumberformat* pFormat); // number format to match against
/** Whether input matches locale dependent date acceptance pattern.
/** Returns count of numbers in accepted date pattern.
*/
sal_uInt16 GetDatePatternNumbers();
/** Whether numeric string nNumber is of type cType in accepted date pattern,'Y','M'or'D'.
*/ bool IsDatePatternNumberOfType( sal_uInt16 nNumber, sal_Unicode cType );
/** Obtain order of accepted date pattern coded as, for example, ('D'<<16)|('M'<<8)|'Y'
*/
sal_uInt32 GetDatePatternOrder();
/** Obtain date format order, from accepted date pattern if available or otherwisethelocale'sdefaultorder.
/** Whether input may be a dd-month-yy format, with month name, not number.
@seenMayBeMonthDate
*/ bool MayBeMonthDate();
/** Whether input is acceptable as ISO 8601 date format in the current NfEvalDateFormatsetting.
*/ bool IsAcceptableIso8601();
/** If month name in the middle was parsed, get the corresponding LongDateOrderinGetDateRef().
*/
LongDateOrder GetMiddleMonthLongDateOrder( bool bFormatTurn, const LocaleDataWrapper* pLoc,
DateOrder eDateOrder );
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.