本文整理汇总了C++中TimeZone::offset方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeZone::offset方法的具体用法?C++ TimeZone::offset怎么用?C++ TimeZone::offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeZone
的用法示例。
在下文中一共展示了TimeZone::offset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createVCards
//.........这里部分代码省略.........
// PROID
if(version == VCard::v3_0)
card.addLine(VCardLine("PRODID", (*addrIt).productId()));
// REV
card.addLine(VCardLine("REV", createDateTime((*addrIt).revision())));
// ROLE
VCardLine roleLine("ROLE", (*addrIt).role());
if(version == VCard::v2_1 && needsEncoding((*addrIt).role()))
{
roleLine.addParameter("charset", "UTF-8");
roleLine.addParameter("encoding", "QUOTED-PRINTABLE");
}
card.addLine(roleLine);
// SORT-STRING
if(version == VCard::v3_0)
card.addLine(VCardLine("SORT-STRING", (*addrIt).sortString()));
// SOUND
card.addLine(createSound((*addrIt).sound()));
// TEL
const PhoneNumber::List phoneNumbers = (*addrIt).phoneNumbers();
PhoneNumber::List::ConstIterator phoneIt;
for(phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt)
{
VCardLine line("TEL", (*phoneIt).number());
QMap< QString, int >::ConstIterator typeIt;
for(typeIt = mPhoneTypeMap.constBegin(); typeIt != mPhoneTypeMap.constEnd(); ++typeIt)
{
if(typeIt.data() & (*phoneIt).type())
line.addParameter("TYPE", typeIt.key());
}
card.addLine(line);
}
// TITLE
VCardLine titleLine("TITLE", (*addrIt).title());
if(version == VCard::v2_1 && needsEncoding((*addrIt).title()))
{
titleLine.addParameter("charset", "UTF-8");
titleLine.addParameter("encoding", "QUOTED-PRINTABLE");
}
card.addLine(titleLine);
// TZ
TimeZone timeZone = (*addrIt).timeZone();
if(timeZone.isValid())
{
QString str;
int neg = 1;
if(timeZone.offset() < 0)
neg = -1;
str.sprintf("%c%02d:%02d", (timeZone.offset() >= 0 ? '+' : '-'), (timeZone.offset() / 60) * neg, (timeZone.offset() % 60) * neg);
card.addLine(VCardLine("TZ", str));
}
// UID
card.addLine(VCardLine("UID", (*addrIt).uid()));
// URL
card.addLine(VCardLine("URL", (*addrIt).url().url()));
// VERSION
if(version == VCard::v2_1)
card.addLine(VCardLine("VERSION", "2.1"));
if(version == VCard::v3_0)
card.addLine(VCardLine("VERSION", "3.0"));
// X-
const QStringList customs = (*addrIt).customs();
for(strIt = customs.begin(); strIt != customs.end(); ++strIt)
{
QString identifier = "X-" + (*strIt).left((*strIt).find(":"));
QString value = (*strIt).mid((*strIt).find(":") + 1);
if(value.isEmpty())
continue;
VCardLine line(identifier, value);
if(version == VCard::v2_1 && needsEncoding(value))
{
line.addParameter("charset", "UTF-8");
line.addParameter("encoding", "QUOTED-PRINTABLE");
}
card.addLine(line);
}
vCardList.append(card);
}
return VCardParser::createVCards(vCardList);
}