/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ #pragma once
/** Obtain days from zero for a given date, without normalizing.
nDay, nMonth, nYear MUST form a valid proleptic Gregorian calendar date.
*/
constexpr inline sal_Int32 convertDateToDays(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear)
{
sal_Int32 nDays = YearToDays(nYear); for (sal_uInt16 i = 1; i < nMonth; ++i)
nDays += getDaysInMonth(i, nYear);
nDays += nDay; return nDays;
}
/** Obtain days from zero for a given date, with normalizing.
nDay, nMonth, nYear may be out-of-bounds and are adjusted/normalized.
@param nYear Must be != 0, unless nMonth > 12.
*/
COMPHELPER_DLLPUBLIC sal_Int32 convertDateToDaysNormalizing(sal_uInt16 nDay, sal_uInt16 nMonth,
sal_Int16 nYear);
/** Whether date is a valid date.
*/
COMPHELPER_DLLPUBLIC bool isValidDate(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear);
/** Obtain date for a days from zero value.
*/
COMPHELPER_DLLPUBLIC void convertDaysToDate(sal_Int32 nDays, sal_uInt16& rDay, sal_uInt16& rMonth,
sal_Int16& rYear);
/** Normalize date, i.e. add days or months to form a proper proleptic Gregorian calendar date, unless all values are 0.
@param rYear Must be != 0, unless rMonth > 12.
@return <TRUE/> if date was normalized, <FALSE/> if it was valid already or empty (all values 0).
*/
COMPHELPER_DLLPUBLIC bool normalize(sal_uInt16& rDay, sal_uInt16& rMonth, sal_Int16& rYear);
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 ist noch experimentell.