本文整理汇总了C++中Formattable::getDate方法的典型用法代码示例。如果您正苦于以下问题:C++ Formattable::getDate方法的具体用法?C++ Formattable::getDate怎么用?C++ Formattable::getDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formattable
的用法示例。
在下文中一共展示了Formattable::getDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void
FormattableStreamer::streamOut(ostream& stream, const Formattable& obj)
{
static DateFormat *defDateFormat = 0;
UnicodeString buffer;
switch(obj.getType()) {
case Formattable::kDate :
// Creates a DateFormat instance for formatting the
// Date instance.
if (defDateFormat == 0) {
defDateFormat = DateFormat::createInstance();
}
defDateFormat->format(obj.getDate(), buffer);
stream << buffer;
break;
case Formattable::kDouble :
// Output the double as is.
stream << obj.getDouble() << 'D';
break;
case Formattable::kLong :
// Output the double as is.
stream << obj.getLong() << 'L';
break;
case Formattable::kString:
// Output the double as is. Please see UnicodeString console
// I/O routine for more details.
stream << '"' << obj.getString(buffer) << '"';
break;
case Formattable::kArray:
int32_t i, count;
const Formattable* array;
array = obj.getArray(count);
stream << '[';
// Recursively calling the console I/O routine for each element in the array.
for (i=0; i<count; ++i) {
FormattableStreamer::streamOut(stream, array[i]);
stream << ( (i==(count-1)) ? "" : ", " );
}
stream << ']';
break;
default:
// Not a recognizable Formattable object.
stream << "INVALID_Formattable";
}
stream.flush();
}