本文整理汇总了C++中ToIcalTime函数的典型用法代码示例。如果您正苦于以下问题:C++ ToIcalTime函数的具体用法?C++ ToIcalTime怎么用?C++ ToIcalTime使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ToIcalTime函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
calDateTime::Compare(calIDateTime * aOther, int32_t * aResult)
{
NS_ENSURE_ARG_POINTER(aOther);
NS_ENSURE_ARG_POINTER(aResult);
bool otherIsDate = false;
aOther->GetIsDate(&otherIsDate);
icaltimetype a, b;
ToIcalTime(&a);
aOther->ToIcalTime(&b);
// If either this or aOther is floating, both objects are treated
// as floating for the comparison.
if (!a.zone || !b.zone) {
a.zone = NULL;
a.is_utc = 0;
b.zone = NULL;
b.is_utc = 0;
}
if (mIsDate || otherIsDate) {
*aResult = icaltime_compare_date_only_tz(a, b, cal::getIcalTimezone(mTimezone));
} else {
*aResult = icaltime_compare(a, b);
}
return NS_OK;
}
示例2: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
calDateTime::Compare(calIDateTime * aOther, int32_t * aResult)
{
NS_ENSURE_ARG_POINTER(aOther);
NS_ENSURE_ARG_POINTER(aResult);
nsresult rv;
nsCOMPtr<calIDateTimeLibical> icalother = do_QueryInterface(aOther, &rv);
NS_ENSURE_SUCCESS(rv, rv);
bool otherIsDate = false;
aOther->GetIsDate(&otherIsDate);
icaltimetype a, b;
ToIcalTime(&a);
icalother->ToIcalTime(&b);
// If either this or aOther is floating, both objects are treated
// as floating for the comparison.
if (!a.zone || !b.zone) {
a.zone = nullptr;
a.is_utc = 0;
b.zone = nullptr;
b.is_utc = 0;
}
if (mIsDate || otherIsDate) {
*aResult = icaltime_compare_date_only_tz(a, b, cal::getIcalTimezone(mTimezone));
} else {
*aResult = icaltime_compare(a, b);
}
return NS_OK;
}
示例3: ensureTimezone
// internal Normalize():
void calDateTime::Normalize()
{
icaltimetype icalt;
ensureTimezone();
ToIcalTime(&icalt);
FromIcalTime(&icalt, mTimezone);
}
示例4: ToIcalTime
NS_IMETHODIMP
calDateTime::GetIcalString(nsACString& aResult)
{
icaltimetype t;
ToIcalTime(&t);
// note that ics is owned by libical, so we don't need to free
char const * const ics = icaltime_as_ical_string(t);
CAL_ENSURE_MEMORY(ics);
aResult.Assign(ics);
return NS_OK;
}
示例5: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
calDateTime::GetEndOfMonth(calIDateTime ** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
icaltimetype icalt;
ToIcalTime(&icalt);
icalt.day = icaltime_days_in_month(icalt.month, icalt.year);
icalt.is_date = 1;
calDateTime * const cdt = new calDateTime(&icalt, mTimezone);
CAL_ENSURE_MEMORY(cdt);
NS_ADDREF(*aResult = cdt);
return NS_OK;
}
示例6: NS_ENSURE_FALSE
NS_IMETHODIMP
calDateTime::AddDuration(calIDuration *aDuration)
{
NS_ENSURE_FALSE(mImmutable, NS_ERROR_OBJECT_IS_IMMUTABLE);
NS_ENSURE_ARG_POINTER(aDuration);
icaldurationtype idt;
aDuration->ToIcalDuration(&idt);
icaltimetype itt;
ToIcalTime(&itt);
icaltimetype const newitt = icaltime_add(itt, idt);
FromIcalTime(&newitt, mTimezone);
return NS_OK;
}
示例7: NS_ENSURE_FALSE
NS_IMETHODIMP
calDateTime::AddDuration(calIDuration *aDuration)
{
NS_ENSURE_FALSE(mImmutable, NS_ERROR_OBJECT_IS_IMMUTABLE);
NS_ENSURE_ARG_POINTER(aDuration);
ensureTimezone();
nsresult rv;
nsCOMPtr<calIDurationLibical> icaldur = do_QueryInterface(aDuration, &rv);
NS_ENSURE_SUCCESS(rv, rv);
icaldurationtype idt;
icaldur->ToIcalDuration(&idt);
icaltimetype itt;
ToIcalTime(&itt);
icaltimetype const newitt = icaltime_add(itt, idt);
FromIcalTime(&newitt, mTimezone);
return NS_OK;
}