Exemple #1
0
//
//{--MM-DD}[TimeZone]
// 0123456
//
void TimeVal::parseMonthDay()
{
  initParser();

  if (parser_context.fBuffer[0] != DATE_SEPARATOR ||
      parser_context.fBuffer[1] != DATE_SEPARATOR ||
      parser_context.fBuffer[4] != DATE_SEPARATOR ) {
    throw TimeValXMLParseErrorException("DateTime_gMthDay_invalid", parser_context.fBuffer);
  }

  //initialize
  parser_context.fValue[CentYear] = YEAR_DEFAULT;
  parser_context.fValue[Month]    = parseInt(2, 4);
  parser_context.fValue[Day]      = parseInt(5, 7);

  if ( MONTHDAY_SIZE < parser_context.fEnd ) {
      int sign = findUTCSign(MONTHDAY_SIZE);
      if ( sign<0 ) {
	throw TimeValXMLParseErrorException("DateTime_gMthDay_invalid",parser_context.fBuffer);
      }
      else {
	getTimeZone(sign);
      }
  }

  validateDateTime();
  xmlnormalize();
}
Exemple #2
0
//
// [-]{CCYY-MM-DD}[TimeZone]
//
void TimeVal::parseDate()
{
  initParser();
  getDate();
  parseTimeZone();
  validateDateTime();
  xmlnormalize();
}
Exemple #3
0
void TimeVal::parseYearMonth()
{
  initParser();

  // get date
  getYearMonth();
  parser_context.fValue[Day] = DAY_DEFAULT;
  parseTimeZone();

  validateDateTime();
  xmlnormalize();
}
Exemple #4
0
//
// [-]{CCYY-MM-DD}'T'{HH:MM:SS.MS}[TimeZone]
//
void TimeVal::parseDateTime()
{
  initParser();
  getDate();

  //parser_context.fStart is supposed to point to 'T'
  if (parser_context.fBuffer[parser_context.fStart++] != DATETIME_SEPARATOR)
    throw TimeValXMLParseErrorException("DateTime_dt_missingT", parser_context.fBuffer);

  getTime();
  validateDateTime();
  xmlnormalize();
}
Exemple #5
0
void TimeVal::parseTime()
{
  initParser();

  // time initialize to default values
  parser_context.fValue[CentYear]= YEAR_DEFAULT;
  parser_context.fValue[Month]   = MONTH_DEFAULT;
  parser_context.fValue[Day]     = DAY_DEFAULT;

  getTime();

  validateDateTime();
  xmlnormalize();
}
/*!
 \fn validateData
 \return boolean - true, everything validated OK, false otherwise
 
 Validates data in this container. 
 */   
bool NmApiMailboxSettingsDataPrivate::validateData() const
{
    NM_FUNCTION;
    QHash<int, QVariant>::const_iterator i = mSettings->constBegin();
    while (i != mSettings->constEnd()) {
        
        bool validated = false;
        bool valid = false;        
        
        int key = i.key();
        QVariant val = i.value();
        
        ++i;
        
        valid = validateString(key ,val, validated);
        if (validated) {
            if (!valid){
                return valid;
            }
            continue;
        }
        
        valid = validateInteger(key ,val, validated);
        if (validated) {
            if (!valid){
                return valid;
            }
            continue;
        }
         
        valid = validateBool(key ,val, validated);
        if (validated) {
            if (!valid){
                return valid;
            }
            continue;
        } 
         
        valid = validateDateTime(key ,val, validated);
        if (validated) {
            if (!valid){
                return valid;
            }
            continue;
        }
     }
     return true;
}
Exemple #7
0
//
// {--MM--}[TimeZone]
// {--MM}[TimeZone]
//  012345
//
void TimeVal::parseMonth()
{
  initParser();

  if (parser_context.fBuffer[0] != DATE_SEPARATOR ||
      parser_context.fBuffer[1] != DATE_SEPARATOR  ) {
    throw TimeValXMLParseErrorException("DateTime_gMth_invalid", parser_context.fBuffer);
  }

  //set constants
  parser_context.fValue[CentYear] = YEAR_DEFAULT;
  parser_context.fValue[Day]      = DAY_DEFAULT;
  parser_context.fValue[Month]    = parseInt(2, 4);

  // REVISIT: allow both --MM and --MM-- now.
  // need to remove the following lines to disallow --MM--
  // when the errata is officially in the rec.
  parser_context.fStart = 4;
  if ( parser_context.fEnd >= parser_context.fStart+2 && parser_context.fBuffer[parser_context.fStart] == DATE_SEPARATOR && parser_context.fBuffer[parser_context.fStart+1] == DATE_SEPARATOR ) {
    parser_context.fStart += 2;
  }

  //
  // parse TimeZone if any
  //
  if ( parser_context.fStart < parser_context.fEnd ) {
    int sign = findUTCSign(parser_context.fStart);
    if ( sign < 0 )
      {
	throw TimeValXMLParseErrorException("DateTime_gMth_invalid",parser_context.fBuffer);
      }
    else {
      getTimeZone(sign);
    }
  }

  validateDateTime();
  xmlnormalize();
}
Exemple #8
0
//
//[-]{CCYY}[TimeZone]
// 0  1234
//
void TimeVal::parseYear()
{
  initParser();

  // skip the first '-' and search for timezone
  //
  int sign = findUTCSign((parser_context.fBuffer[0] == '-') ? 1 : 0);

  if (sign == NOT_FOUND) {
    parser_context.fValue[CentYear] = parseIntYear(parser_context.fEnd);
  }
  else {
    parser_context.fValue[CentYear] = parseIntYear(sign);
    getTimeZone(sign);
  }

  //initialize values
  parser_context.fValue[Month] = MONTH_DEFAULT;
  parser_context.fValue[Day]   = DAY_DEFAULT;   //java is 1

  validateDateTime();
  xmlnormalize();
}