result
_InputPickerPopup::Parse(const String& strDateTime, DateTime & dateTime)
{
- result r = E_SUCCESS;
-
- wchar_t* pMchar = (wchar_t*) strDateTime.GetPointer();
- wchar_t* pTmp = (wchar_t*) malloc(sizeof(wchar_t) * 10);
- SysTryReturnResult(NID_WEB_CTRL, pTmp, E_OUT_OF_MEMORY, "Memory allocation failed.");
-
std::unique_ptr<DateTimeFormatter> pDateFormatter(DateTimeFormatter::CreateDateFormatterN(DATE_TIME_STYLE_DEFAULT));
SysTryReturn(NID_WEB_CTRL, pDateFormatter.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
int hour = 0;
int minute = 0;
int week = 0;
+
+ result r = E_SUCCESS;
+
String formattedString = L"e";
String dayno;
+ const wchar_t* pMchar = static_cast< const wchar_t* >(strDateTime.GetPointer());
+ wchar_t* pTmp = static_cast< wchar_t* >(malloc(sizeof(wchar_t) * 10));
+ SysTryReturnResult(NID_WEB_CTRL, pTmp, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
switch (__inputType)
{
case EWK_INPUT_TYPE_TIME : //"HH:mm";
// hour
wcsncpy(pTmp, pMchar, 2);
pTmp[2] = L'\0';
- hour = (int) wcstol(pTmp, null, 10);
+ hour = static_cast< int >(wcstol(pTmp, null, 10));
// minute
wcsncpy(pTmp, pMchar + 3, 2);
pTmp[2] = L'\0';
- minute = (int) wcstol(pTmp, null, 10);
+ minute = static_cast< int >(wcstol(pTmp, null, 10));
dateTime.SetValue(1, 1, 1, hour,minute);
break;
wcsncpy(pTmp, pMchar, 4);
pTmp[4] = L'\0';
- year = (int) wcstol(pTmp, null, 10);
+ year = static_cast< int >(wcstol(pTmp, null, 10));
// month
wcsncpy(pTmp, pMchar + 5, 2);
pTmp[2] = L'\0';
- month = (int) wcstol(pTmp, null, 10);
+ month = static_cast< int >(wcstol(pTmp, null, 10));
// day
wcsncpy(pTmp, pMchar + 8, 2);
pTmp[2] = L'\0';
- day = (int) wcstol(pTmp, null, 10);
+ day = static_cast< int >(wcstol(pTmp, null, 10));
// hour
wcsncpy(pTmp, pMchar + 11, 2);
pTmp[2] = L'\0';
- hour = (int) wcstol(pTmp, null, 10);
+ hour = static_cast< int >(wcstol(pTmp, null, 10));
// minute
wcsncpy(pTmp, pMchar + 14, 2);
pTmp[2] = L'\0';
- minute = (int) wcstol(pTmp, null, 10);
+ minute = static_cast< int >(wcstol(pTmp, null, 10));
dateTime.SetValue(year, month, day, hour, minute);
break;
wcsncpy(pTmp, pMchar, 4);
pTmp[4] = L'\0';
- year = (int) wcstol(pTmp, null, 10);
+ year = static_cast< int >(wcstol(pTmp, null, 10));
// week
wcsncpy(pTmp, pMchar + 6, 2);
pTmp[2] = L'\0';
- week = (int) wcstol(pTmp, null, 10);
+ week = static_cast< int >(wcstol(pTmp, null, 10));
dateTime.SetValue(year,1,1);
pDateFormatter->ApplyPattern(formattedString);
// year
wcsncpy(pTmp, pMchar, 4);
pTmp[4] = L'\0';
- year = (int) wcstol(pTmp, null, 10);
+ year = static_cast< int >(wcstol(pTmp, null, 10));
// month
wcsncpy(pTmp, pMchar + 5, 2);
pTmp[2] = L'\0';
- month = (int) wcstol(pTmp, null, 10);
+ month = static_cast< int >(wcstol(pTmp, null, 10));
// day
wcsncpy(pTmp, pMchar + 8, 2);
pTmp[2] = L'\0';
- day = (int) wcstol(pTmp, null, 10);
+ day = static_cast< int >(wcstol(pTmp, null, 10));
dateTime.SetValue(year, month, day);
break;
// year
wcsncpy(pTmp, pMchar, 4);
pTmp[4] = L'\0';
- year = (int) wcstol(pTmp, null, 10);
+ year = static_cast< int >(wcstol(pTmp, null, 10));
// month
wcsncpy(pTmp, pMchar + 5, 2);
pTmp[2] = L'\0';
- month = (int) wcstol(pTmp, null, 10);
+ month = static_cast< int >(wcstol(pTmp, null, 10));
dateTime.SetValue(year, month, 1);
break;