本文整理汇总了C++中Date::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Date::IsEmpty方法的具体用法?C++ Date::IsEmpty怎么用?C++ Date::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::IsEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// Stream output operator; prints in the following format:
// "(Priority tag) [Duedate Text] {Tag_1 / Tag_2 / Tag_3}
// ex: "(A) [4/17] write essay #3 {history, computer}
std::ostream& operator << (std::ostream& out, const Todo& aTodo)
{
char myPriority = aTodo.GetPriority();
Date myDueDate = aTodo.GetDate();
string todoText = aTodo.GetText();
vector<Tag> tagList = aTodo.GetTags();
// If the todo has a priority print it
if (myPriority != NULL)
{
// If priority is A, B, C, or D print colors for added emphasis
switch (myPriority)
{
case 'A':
aTodo.SetColor(Todo::YELLOW);
out << "(" << myPriority << ") ";
break;
case 'B':
aTodo.SetColor(Todo::GREEN);
out << "(" << myPriority << ") ";
break;
case 'C':
aTodo.SetColor(Todo::RED);
out << "(" << myPriority << ") ";
break;
case 'D':
aTodo.SetColor(Todo::TEAL);
out << "(" << myPriority << ") ";
break;
}
}
// If the todo has a due date print it
if ( !myDueDate.IsEmpty() )
out << myDueDate << " ";
out << todoText << " ";
// Print tags by traversing vector of tags, as long as there are tags available to print
if ( !tagList.empty() )
{
int pos = 0;
out << "{";
for (; pos < int(tagList.size()-1); pos++ )
out << tagList[pos] << ", ";
out << tagList[pos] << "}";
}
aTodo.SetColor(Todo::GRAY); // reset output color
return out;
}