"%G-W%V-%u", ///< 2014-W06-5 (1 is Monday)
"%Y-%j", ///< 2014-038
};
- return fmt[static_cast<std::underlying_type<Date::DateFormat>::type>(dateFormat_r)];
+ return fmt[static_cast<std::underlying_type<Date::DateFormat::Enum>::type>(dateFormat_r.inSwitch())];
}
inline const char * _timeFormat( Date::TimeFormat timeFormat_r )
"%H:%M", ///< 07:06
"%H", ///< 07
};
- return fmt[static_cast<std::underlying_type<Date::TimeFormat>::type>(timeFormat_r)];
+ return fmt[static_cast<std::underlying_type<Date::TimeFormat::Enum>::type>(timeFormat_r.inSwitch())];
}
inline const char * _timeZoneFormat( Date::TimeZoneFormat timeZoneFormat_r )
" %Z", ///< UTC, CET, ...
"%z", ///< +0000
};
- return fmt[static_cast<std::underlying_type<Date::TimeZoneFormat>::type>(timeZoneFormat_r)];
+ return fmt[static_cast<std::underlying_type<Date::TimeZoneFormat::Enum>::type>(timeZoneFormat_r.inSwitch())];
}
inline std::string doForm( const std::string & format_r, Date::TimeBase base_r, const Date::ValueType & date_r )
if ( dateFormat_r != DateFormat::none )
str << 'T';
str << _timeFormat( timeFormat_r );
- switch ( timeZoneFormat_r )
+ switch ( timeZoneFormat_r.inSwitch() )
{
case TimeZoneFormat::none:
break;
#include <string>
#include "zypp/base/Exception.h"
+#include "zypp/base/EnumClass.h"
///////////////////////////////////////////////////////////////////
namespace zypp
public:
/** \name Printing in various predefined formats */
//@{
- /** Date formats for printing*/
- enum class DateFormat {
+ /** Date formats for printing (use like 'enum class \ref DateFormat') */
+ struct _DateFormatDef { enum Enum {
none, ///< ""
calendar, ///< 2014-02-07
month, ///< 2014-02
week, ///< 2014-W06
weekday, ///< 2014-W06-5 (1 is Monday)
ordinal, ///< 2014-038
- };
+ };};
+ typedef base::EnumClass<_DateFormatDef> DateFormat; ///< 'enum class DateFormat'
- /** Time formats for printing */
- enum class TimeFormat {
+ /** Time formats for printing (use like 'enum class \ref TimeFormat') */
+ struct _TimeFormatDef { enum Enum {
none, ///< ""
seconds, ///< 07:06:41
minutes, ///< 07:06
hours, ///< 07
- };
+ };};
+ typedef base::EnumClass<_TimeFormatDef> TimeFormat; ///< 'enum class TimeFormat'
- /** Timezone indicator for printing */
- enum class TimeZoneFormat {
+ /** Timezone indicator for printing (use like 'enum class \ref TimeZoneFormat') */
+ struct _TimeZoneFormatDef { enum Enum {
none, ///< ""
name, ///< UTC, CET, ...
offset, ///< +00[:00]
- };
+ };};
+ typedef base::EnumClass<_TimeZoneFormatDef> TimeZoneFormat; ///< 'enum class TimeZoneFormat'
/** Default format is <tt>'2014-02-07 07:06:41 CET'</tt>
* The default is \ref DateFormat::calendar, \ref TimeFormat::seconds, \ref TimeZoneFormat::name and