Example #1
0
/* SRC: classes/soapfault.php line 12 */
void c_SoapFault::t___construct(Variant v_code, Variant v_message, Variant v_actor //  = null
, Variant v_detail //  = null
, Variant v_name //  = null
, Variant v_header //  = null
) {
  INSTANCE_METHOD_INJECTION_BUILTIN(SoapFault, SoapFault::__construct);
  Variant v_fault_ns;
  Variant v_fault_code;
  int64 v_SOAP_1_1 = 0;
  int64 v_SOAP_1_2 = 0;
  String v_SOAP_1_1_ENV_NAMESPACE;
  String v_SOAP_1_2_ENV_NAMESPACE;
  int64 v_soap_version = 0;

  ObjectData *obj_tmp UNUSED;
  setNull(v_fault_ns);
  setNull(v_fault_code);
  if (x_is_string(v_code)) {
    {
      v_fault_code.assignVal(v_code);
    }
  }
  else {
    bool tmp0;
    {
      bool tmp1 = (x_is_array(v_code));
      if (tmp1) {
        int64 tmp2((x_count(v_code)));
        tmp1 = (equal(tmp2, 2L));
      }
      tmp0 = (tmp1);
    }
    if (tmp0) {
      {
        {
          const Variant &tmp0((x_array_values(v_code)));
          v_code.assignVal(tmp0);
        }
        {
          const Variant &tmp0((v_code.rvalAt(0L, AccessFlags::Error)));
          v_fault_ns.assignVal(tmp0);
        }
        {
          const Variant &tmp0((v_code.rvalAt(1L, AccessFlags::Error)));
          v_fault_code.assignVal(tmp0);
        }
        if ((!(x_is_string(v_fault_ns)) || !(x_is_string(v_fault_code)))) {
          {
            x_hphp_throw_fatal_error(NAMSTR(s_sys_ss5db5b000, "Invalid fault code"));
            return;
          }
        }
      }
    }
    else {
      {
        x_hphp_throw_fatal_error(NAMSTR(s_sys_ss5db5b000, "Invalid fault code"));
        return;
      }
    }
  }
  m_faultcodens.assignVal(v_fault_ns);
  m_faultcode.assignVal(v_fault_code);
  if (empty(m_faultcode)) {
    {
      x_hphp_throw_fatal_error(NAMSTR(s_sys_ss5db5b000, "Invalid fault code"));
      return;
    }
  }
  {
    Variant tmp0((m_message.assignVal(v_message)));
    m_faultstring.assignVal(tmp0);
  }
  m_faultactor.assignVal(v_actor);
  m_detail.assignVal(v_detail);
  m__name.assignVal(v_name);
  m_headerfault.assignVal(v_header);
  v_SOAP_1_1 = 1L;
  v_SOAP_1_2 = 2L;
  v_SOAP_1_1_ENV_NAMESPACE = NAMSTR(s_sys_ss0842226e, "http://schemas.xmlsoap.org/soap/envelope/");
  v_SOAP_1_2_ENV_NAMESPACE = NAMSTR(s_sys_ss2cc85e9b, "http://www.w3.org/2003/05/soap-envelope");
  {
    int64 tmp0((x__soap_active_version()));
    v_soap_version = tmp0;
  }
  if (empty(m_faultcodens)) {
    {
      if (equal(v_soap_version, v_SOAP_1_1)) {
        {
          if ((((equal(m_faultcode, NAMSTR(s_sys_ss129b7287, "Client")) || equal(m_faultcode, NAMSTR(s_sys_ss35d432f4, "Server"))) || equal(m_faultcode, NAMSTR(s_sys_ss4a69d66a, "VersionMismatch"))) || equal(m_faultcode, NAMSTR(s_sys_ss65decfcb, "MustUnderstand")))) {
            {
              m_faultcodens = v_SOAP_1_1_ENV_NAMESPACE;
            }
          }
        }
      }
      else if (equal(v_soap_version, v_SOAP_1_2)) {
        {
          if (equal(m_faultcode, NAMSTR(s_sys_ss129b7287, "Client"))) {
            {
              m_faultcode = NAMSTR(s_sys_ss58532c4b, "Sender");
              m_faultcodens = v_SOAP_1_2_ENV_NAMESPACE;
            }
          }
          else if (equal(m_faultcode, NAMSTR(s_sys_ss35d432f4, "Server"))) {
            {
              m_faultcode = NAMSTR(s_sys_ss722b78d7, "Receiver");
              m_faultcodens = v_SOAP_1_2_ENV_NAMESPACE;
            }
          }
          else if (((equal(m_faultcode, NAMSTR(s_sys_ss4a69d66a, "VersionMismatch")) || equal(m_faultcode, NAMSTR(s_sys_ss65decfcb, "MustUnderstand"))) || equal(m_faultcode, NAMSTR(s_sys_ss6d34f1cc, "DataEncodingUnknown")))) {
            {
              m_faultcodens = v_SOAP_1_2_ENV_NAMESPACE;
            }
          }
        }
      }
    }
  }
}
Example #2
0
/*!
    \overload

    Sets the value of the field called \a name to null. If the field
    does not exist, nothing happens.
*/
void QSqlRecord::setNull(const QString& name)
{
    setNull(indexOf(name));
}
Example #3
0
void XDateEdit::parseDate()
{
  QString dateString = text().stripWhiteSpace();
  bool    isNumeric;

  if (DEBUG)
    qDebug("%s::parseDate() with dateString %s, _currentDate %s, _allowNull %d",
           qPrintable(parent() ? parent()->objectName() : objectName()),
           qPrintable(dateString),
           qPrintable(_currentDate.toString()), _allowNull);

#ifdef OpenMFGGUIClient_h
  QDate today = ofmgThis->dbDate();
#else
  QDate today = QDate::currentDate();
#endif

  if (_parsed)
  {
    if (DEBUG)
      qDebug("%s::parseDate() looks like we've already parsed this string",
             qPrintable(parent() ? parent()->objectName() : objectName()));
    return;
  }

  _valid = false;

  if (dateString == _nullString || dateString.isEmpty())
    setNull();

  else if (dateString == "0")                           // today
    setDate(today, TRUE);

  else if (dateString.contains(QRegExp("^[+-][0-9]+"))) // offset from today
  {
    int offset = dateString.toInt(&isNumeric);
    if (isNumeric)
      setDate(today.addDays(offset), true);
  }

  else if (dateString[0] == '#')                        // julian day
  {
    int offset = dateString.right(dateString.length() - 1).toInt(&isNumeric);
    if (isNumeric)
      setDate(QDate(today.year(), 1, 1).addDays(offset - 1), TRUE);
  }

  else if (dateString.contains(QRegExp("^[0-9][0-9]?$"))) // date in month
  {
    int offset = dateString.toInt(&isNumeric, 10);
    if (isNumeric)
    {
      if (offset > today.daysInMonth())
        offset = today.daysInMonth();
 
      setDate(QDate(today.year(), today.month(), 1).addDays(offset - 1), TRUE);
    }
  }

  else                                                  // interpret with locale
  {
    QString dateFormatStr = QLocale().dateFormat(QLocale::ShortFormat);
    if (DEBUG)
      qDebug("%s::parseDate() trying to parse with %s",
             qPrintable(parent() ? parent()->objectName() : objectName()),
             qPrintable(dateFormatStr));

    QDate tmp = QDate::fromString(dateString, dateFormatStr);
    if (tmp.isValid() && dateFormatStr.indexOf(QRegExp("y{2}")) >= 0)
    {
      qDebug("%s::parseDate() found valid 2-digit year %d",
             qPrintable(parent() ? parent()->objectName() : objectName()),
             tmp.year());
      if (tmp.year() < 1950)     // Qt docs say 2-digit years are 1900-based so
      {
        tmp = tmp.addYears(100); // add backwards-compat with pre-3.0 DLineEdit
        qDebug("%s::parseDate() altered year to %d",
               qPrintable(parent() ? parent()->objectName() : objectName()),
               tmp.year());
      }
    }
    else
    {
      // try 4 digits, ignoring the possibility of '-literals in the format str
      dateFormatStr.replace(QRegExp("y{2}"), "yyyy");
      if (DEBUG)
        qDebug("%s::parseDate() rewriting format string to %s",
               qPrintable(parent() ? parent()->objectName() : objectName()),
               qPrintable(dateFormatStr));
      tmp = QDate::fromString(dateString, dateFormatStr);
    }

    setDate(QDate(tmp.year(), tmp.month(), tmp.day()), true );
  }

  if (!_valid)
    setText("");

  _parsed = true;
}
Example #4
0
/**
 * Default constructor.
 */
Probe::Probe()
{
    setNull();
    constructInfrastructure();
}
Example #5
0
void Record::setNull(string fieldName)
{
	if (Field* field = fieldByName(fieldName))
		setNull(field->getIndex());
}
Example #6
0
void XComboBox::setId(int pTarget)
{
  // reports are a special case: they should really be stored by name, not id
  if (_type == Reports)
  {
    XSqlQuery query;
    query.prepare("SELECT report_id "
                  "FROM report "
                  "WHERE (report_name IN (SELECT report_name "
                  "                       FROM report "
                  "                       WHERE (report_id=:report_id)));");
    query.bindValue(":report_id", pTarget);
    query.exec();
    while (query.next())
    {
      int id = query.value("report_id").toInt();
      for (int counter = 0; counter < count(); counter++)
      {
        if (_ids.at(counter) == id)
        {
          setCurrentItem(counter);

          if(_lastId!=id)
          {
            _lastId = id;
            emit newID(pTarget);
            emit valid(TRUE);

            if (allowNull())
              emit notNull(TRUE);
          }

          return;
        }
      }
    }
  }
  else
  {
    for (int counter = 0; counter < count(); counter++)
    {
      if (_ids.at(counter) == pTarget)
      {
        setCurrentItem(counter);

        if(_lastId!=pTarget)
        {
          _lastId = pTarget;
          emit newID(pTarget);
          emit valid(TRUE);

          if (allowNull())
            emit notNull(TRUE);
        }

        return;
      }
    }
  }

  setNull();
}
Example #7
0
template<> void ThreadLocalNoCheck<ExecutionContext>::destroy() {
  if (!isNull()) {
    getNoCheck()->sweep();
    setNull();
  }
}
Example #8
0
//=============================================================================
// CONSTRUCTOR(S) AND DESTRUCTOR
//=============================================================================
//_____________________________________________________________________________
// Default constructor.
Force::Force()
{
    setNull();
    constructProperties();
}
ContactHalfSpace::ContactHalfSpace() :
    ContactGeometry()
{
    setNull();
}
Example #10
0
void QDoubleFieldPrivate::setValue(double value)
{
    setNull(false); // The field is not null anymore
    setModified(true);
    _value = value;
}
Example #11
0
void QDoubleFieldPrivate::fromData(const QVariant &data)
{
    setNull(data.isNull());
    setModified(false);
    _value = data.toDouble();
}
Example #12
0
/* preface finishes */
Variant pm_php$$globals$$symbols$_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */, Globals *globals /* = get_globals() */) {
  PSEUDOMAIN_INJECTION_BUILTIN(run_init::globals/symbols.php, pm_php$$globals$$symbols$_php);
  LVariableTable *gVariables __attribute__((__unused__)) = (LVariableTable *)g;
  Variant &v_argc __attribute__((__unused__)) = g->GV(argc);
  Variant &v_argv __attribute__((__unused__)) = g->GV(argv);
  Variant &v__SERVER __attribute__((__unused__)) = g->GV(_SERVER);
  Variant &v__GET __attribute__((__unused__)) = g->GV(_GET);
  Variant &v__POST __attribute__((__unused__)) = g->GV(_POST);
  Variant &v__COOKIE __attribute__((__unused__)) = g->GV(_COOKIE);
  Variant &v__FILES __attribute__((__unused__)) = g->GV(_FILES);
  Variant &v__ENV __attribute__((__unused__)) = g->GV(_ENV);
  Variant &v__REQUEST __attribute__((__unused__)) = g->GV(_REQUEST);
  Variant &v__SESSION __attribute__((__unused__)) = g->GV(_SESSION);
  Variant &v_HTTP_RAW_POST_DATA __attribute__((__unused__)) = g->GV(HTTP_RAW_POST_DATA);
  Variant &v_http_response_header __attribute__((__unused__)) = g->GV(http_response_header);

  setNull(v_argc);
  setNull(v_argv);
  setNull(v__SERVER);
  setNull(v__GET);
  setNull(v__POST);
  setNull(v__COOKIE);
  setNull(v__FILES);
  setNull(v__ENV);
  setNull(v__REQUEST);
  setNull(v__SESSION);
  v__SERVER = s_sys_sa00000000;
  v__GET = s_sys_sa00000000;
  v__POST = s_sys_sa00000000;
  v__COOKIE = s_sys_sa00000000;
  v__FILES = s_sys_sa00000000;
  v__ENV = s_sys_sa00000000;
  v__REQUEST = s_sys_sa00000000;
  v__SESSION = s_sys_sa00000000;
  setNull(v_HTTP_RAW_POST_DATA);
  setNull(v_http_response_header);
  return true;
}
Example #13
0
void UI::GUI::setForm2(QWidget *Widget, Widget1 *widget1)
{
    //Извлечение данных из QLineEdit.
    l1 = ln_line1->text().toInt();
    c1 = ln_column1->text().toInt();

    table1 = new QTableWidget(Widget);
    table1->setRowCount(l1);
    table1->setColumnCount(c1);
    table1->setEditTriggers(QAbstractItemView::AnyKeyPressed|QAbstractItemView::CurrentChanged|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed);
    table1->horizontalHeader()->setDefaultSectionSize(40);
    table1->verticalHeader()->setDefaultSectionSize(40);
    //Скрывает шапки строк и столбцов.
    table1->verticalHeader()->setVisible(false);
    table1->horizontalHeader()->setVisible(false);
    //Попытка извлечь сохранённый результат вычислений.
    if (widget1->result_saved)
    {
        if (!fromFile(&l1, &c1))
            QMessageBox::critical(widget1, "Matrix", "Не удалось извлечь сохранённые данные.", QMessageBox::Ok);
    }
    else
        //Если не было сохранённого результата, заполняет таблицу нулями
        setNull(table1, &l1, &c1);

    h_layout1 = new QHBoxLayout();
    h_layout1->addWidget(table1);

    if (combo->currentText() != "Умножение на скалярное число")
    {
        //Кнопка для копирования значений из первой таблицы во вторую.
        b_move = new QPushButton(Widget);
        b_move->setMaximumSize(QSize(30, 25));
        QIcon move_icon;
        move_icon.addFile(QStringLiteral(":/res/Back_Icon.png"), QSize(), QIcon::Normal, QIcon::Off);
        b_move->setIcon(move_icon);
        h_layout1->addWidget(b_move);
    }


    if (combo->currentText() == "Сложение" || combo->currentText() == "Вычитание")
    {
        table2 = new QTableWidget;
        table2->setRowCount(l1);
        table2->setColumnCount(c1);
        table2->setEditTriggers(QAbstractItemView::AnyKeyPressed|QAbstractItemView::CurrentChanged|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed);
        table2->horizontalHeader()->setDefaultSectionSize(40);
        table2->verticalHeader()->setDefaultSectionSize(40);
        table2->verticalHeader()->setVisible(false);
        table2->horizontalHeader()->setVisible(false);
        setNull(table2, &l1, &c1);

        h_layout1->addWidget(table2);
        h_layout1->setSpacing(20);
    }
    else if(combo->currentText() == "Умножение")
    {
        l2 = ln_line2->text().toInt();
        c2 = ln_column2->text().toInt();

        table2 = new QTableWidget(Widget);
        table2->setRowCount(l2);
        table2->setColumnCount(c2);
        table2->setEditTriggers(QAbstractItemView::AnyKeyPressed|QAbstractItemView::CurrentChanged|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed);
        table2->horizontalHeader()->setDefaultSectionSize(40);
        table2->verticalHeader()->setDefaultSectionSize(40);
        table2->verticalHeader()->setVisible(false);
        table2->horizontalHeader()->setVisible(false);
        setNull(table2, &l2, &c2);

        /*Делает кнопку копирования значений активной только тогда,
        когда строки или столбцы матриц равны.*/
        if (table1->rowCount() != table2->rowCount() || table1->columnCount() != table2->columnCount())
            b_move->setEnabled(false);

        h_layout1->addWidget(table2);
        h_layout1->setSpacing(20);
    }
    b_count = new QPushButton(Widget);
    b_count->setText("Посчитать");
    b_count->setMaximumSize(QSize(114, 32));
    h_layout2 = new QHBoxLayout;
    h_layout2->addWidget(b_count);
    v_layout1 = new QVBoxLayout(Widget);
    v_layout1->addLayout(h_layout1);
    v_layout1->addLayout(h_layout2);

    if (combo->currentText() != "Умножение на скалярное число")
    {
        QObject::connect(b_move, SIGNAL(clicked()), Widget, SLOT(b_moveClicked()));
    }
    QObject::connect(b_count, SIGNAL(clicked()), widget1, SLOT(b_countClicked()));

    if (combo->currentText() == "Умножение на скалярное число")
        Widget->resize(550, 500);
    else
        Widget->resize(1000, 500);

    Widget->setLayout(v_layout1);
    Widget->setWindowTitle("Matrix");

}
ElasticFoundationForce::ContactParametersSet::ContactParametersSet()
{
    setNull();
}
Example #15
0
		void setSource(Button &initRadioButton, bool) { setNull(); radioButton = &initRadioButton;}
ContactHalfSpace::ContactHalfSpace(const SimTK::Vec3& location,
    const SimTK::Vec3& orientation, PhysicalFrame& body) :
        ContactGeometry(location, orientation, body)
{
    setNull();
}
Example #17
0
		void setSource(List &initList) { setNull(); list = &initList;}
ContactHalfSpace::ContactHalfSpace(const ContactHalfSpace& geom) :
    ContactGeometry(geom)
{
    setNull();
}
//_____________________________________________________________________________
// Default constructor.
ContactGeometry::ContactGeometry() : ModelComponent()
{
    setNull();
    constructProperties();
}
Example #20
0
HuntCrossleyForce::ContactParametersSet::ContactParametersSet()
{
    setNull();
}
Example #21
0
Id::Id()
{
    setNull();
}
Example #22
0
		void setSource(MenuBar &initMenuBar) { setNull(); menuBar = &initMenuBar;}
Example #23
0
BOOL LLUUID::set(const std::string& in_string, BOOL emit)
{
	BOOL broken_format = FALSE;

	// empty strings should make NULL uuid
	if (in_string.empty())
	{
		setNull();
		return TRUE;
	}

	if (in_string.length() != (UUID_STR_LENGTH - 1))		/* Flawfinder: ignore */
	{
		// I'm a moron.  First implementation didn't have the right UUID format.
		// Shouldn't see any of these any more
		if (in_string.length() == (UUID_STR_LENGTH - 2))	/* Flawfinder: ignore */
		{
			if(emit)
			{
				llwarns << "Warning! Using broken UUID string format" << llendl;
			}
			broken_format = TRUE;
		}
		else
		{
			// Bad UUID string.  Spam as INFO, as most cases we don't care.
			if(emit)
			{
				//don't spam the logs because a resident can't spell.
				llwarns << "Bad UUID string: " << in_string << llendl;
			}
			setNull();
			return FALSE;
		}
	}

	U8 cur_pos = 0;
	S32 i;
	for (i = 0; i < UUID_BYTES; i++)
	{
		if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
		{
			cur_pos++;
			if (broken_format && (i==10))
			{
				// Missing - in the broken format
				cur_pos--;
			}
		}

		mData[i] = 0;

		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
		{
			mData[i] += (U8)(in_string[cur_pos] - '0');
		}
		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
		{
			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
		}
		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
		{
			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
		}
		else
		{
			if(emit)
			{							
				llwarns << "Invalid UUID string character" << llendl;
			}
			setNull();
			return FALSE;
		}

		mData[i] = mData[i] << 4;
		cur_pos++;

		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
		{
			mData[i] += (U8)(in_string[cur_pos] - '0');
		}
		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
		{
			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
		}
		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
		{
			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
		}
		else
		{
			if(emit)
			{
				llwarns << "Invalid UUID string character" << llendl;
			}
			setNull();
			return FALSE;
		}
		cur_pos++;
	}

	return TRUE;
}
Example #24
0
		void setSource(Menu &initMenu) { setNull(); menu = &initMenu;}
Example #25
0
void Record::setNull(Field& field)
{
	setNull(field.getName());
}
Example #26
0
		void setSource(MenuItem &initMenuItem) { setNull(); menuItem = &initMenuItem; }
Example #27
0
void XDateEdit::parseDate()
{
    QString dateString = text().trimmed();
    bool    isNumeric;

    if (DEBUG)
        qDebug("%s::parseDate() with dateString %s, _currentDate %s, _allowNull %d",
               qPrintable(parent() ? parent()->objectName() : objectName()),
               qPrintable(dateString),
               qPrintable(_currentDate.toString()), _allowNull);

#ifdef GUIClient_h
    QDate today = ofmgThis->dbDate();
#else
    QDate today = QDate::currentDate();
#endif

    if (_parsed)
    {
        if (DEBUG)
            qDebug("%s::parseDate() looks like we've already parsed this string",
                   qPrintable(parent() ? parent()->objectName() : objectName()));
        return;
    }

    _valid = false;

    if (dateString == _nullString || dateString.isEmpty())
        setNull();

    else if (dateString == "0")                           // today
        setDate(today, TRUE);

    else if (dateString.contains(QRegExp("^[+-][0-9]+"))) // offset from today
    {
        int offset = dateString.toInt(&isNumeric);
        if (isNumeric)
            setDate(today.addDays(offset), true);
    }

    else if (dateString[0] == '#')                        // julian day
    {
        int offset = dateString.right(dateString.length() - 1).toInt(&isNumeric);
        if (isNumeric)
            setDate(QDate(today.year(), 1, 1).addDays(offset - 1), TRUE);
    }

    else if (dateString.contains(QRegExp("^[0-9][0-9]?$"))) // date in month
    {
        int offset = dateString.toInt(&isNumeric, 10);
        if (isNumeric)
        {
            if (offset > today.daysInMonth())
                offset = today.daysInMonth();

            setDate(QDate(today.year(), today.month(), 1).addDays(offset - 1), TRUE);
        }
    }

    else                                                  // interpret with locale
    {
        QString dateFormatStr = QLocale().dateFormat(QLocale::ShortFormat);
        if (DEBUG)
            qDebug("%s::parseDate() trying to parse with %s",
                   qPrintable(parent() ? parent()->objectName() : objectName()),
                   qPrintable(dateFormatStr));

        QDate tmp = QDate::fromString(dateString, dateFormatStr);
        bool twodigitformat = !(dateFormatStr.indexOf(QRegExp("y{4}")) >= 0);
        if (tmp.isValid())
        {
            if (twodigitformat && tmp.year() < 1950) // Qt docs say 2-digit years are 1900-based so
            {
                qDebug("%s::parseDate() found valid 2-digit year %d",
                       qPrintable(parent() ? parent()->objectName() : objectName()),
                       tmp.year());
                tmp = tmp.addYears(100); // add backwards-compat with pre-3.0 DLineEdit
                qDebug("%s::parseDate() altered year to %d",
                       qPrintable(parent() ? parent()->objectName() : objectName()),
                       tmp.year());
            }
        }
        else if (twodigitformat)
        {
            // try 4 digits, ignoring the possibility of '-literals in the format str
            dateFormatStr.replace(QRegExp("y{2}"), "yyyy");
            if (DEBUG)
                qDebug("%s::parseDate() rewriting 2-digit year format string to %s",
                       qPrintable(parent() ? parent()->objectName() : objectName()),
                       qPrintable(dateFormatStr));
            tmp = QDate::fromString(dateString, dateFormatStr);

            if (tmp.isValid())
            {
                if (tmp.year() < 10)
                    tmp = tmp.addYears(today.year() - today.year() % 100);
                if (DEBUG)
                    qDebug("%s::parseDate() after changing to 4-digit year, year = %d",
                           qPrintable(parent() ? parent()->objectName() : objectName()),
                           tmp.year());
            }
            else if (DEBUG)
                qDebug("%s::parseDate() after changing to 4-digit year, date still isn't valid",
                       qPrintable(parent() ? parent()->objectName() : objectName()));

        }
        else
        {
            // try 2 digits, ignoring the possibility of '-literals in the format str
            dateFormatStr.replace(QRegExp("y{4}"), "yy");
            if (DEBUG)
                qDebug("%s::parseDate() rewriting 4-digit year format string to %s",
                       qPrintable(parent() ? parent()->objectName() : objectName()),
                       qPrintable(dateFormatStr));
            tmp = QDate::fromString(dateString, dateFormatStr);
            if (tmp.isValid() && tmp.year() < 1950) // Qt docs say 2-digit years are 1900-based so
            {
                qDebug("%s::parseDate() found valid 2-digit year %d",
                       qPrintable(parent() ? parent()->objectName() : objectName()),
                       tmp.year());
                tmp = tmp.addYears(100); // add backwards-compat with pre-3.0 DLineEdit
                qDebug("%s::parseDate() altered year to %d",
                       qPrintable(parent() ? parent()->objectName() : objectName()),
                       tmp.year());
            }
        }
        if(!tmp.isValid())
        {
            // still no match -- we will decompose the format and input and
            // build a date based on that information
            QRegExp rx("(\\d+)");
            QRegExp rx2("(m+|y+|d+)");
            rx2.setCaseSensitivity(Qt::CaseInsensitive);
            QStringList numberList;
            QStringList formatList;
            int pos = 0;
            while ((pos = rx.indexIn(dateString, pos)) != -1)
            {
                numberList << rx.cap(1);
                pos += rx.matchedLength();
            }
            pos = 0;
            while((pos = rx2.indexIn(dateFormatStr, pos)) != -1)
            {
                formatList << rx2.cap(1);
                pos += rx2.matchedLength();
            }

            if (DEBUG)
                qDebug("%s::parseDate() aligning numberList %s with formatList %s",
                       qPrintable(parent() ? parent()->objectName() : objectName()),
                       qPrintable(numberList.join(":")), qPrintable(formatList.join(":")));

            // if we don't have exactly 3 and the numberList is not 2 or 3 then don't bother
            if(formatList.size() == 3 && (numberList.size() == 2 || numberList.size() == 3))
            {
                int year = today.year();
                int day = -1;
                int month = -1;

                pos = 0;
                for (int i = 0; i < formatList.size(); ++i)
                {
                    QChar ch = formatList.at(i).toLower().at(0);
                    if(ch == 'y' && numberList.size() == 3)
                    {
                        year = numberList.at(pos).toInt();
                        pos++;
                    }
                    else if(ch == 'm')
                    {
                        month = numberList.at(pos).toInt();
                        pos++;
                    }
                    else if(ch == 'd')
                    {
                        day = numberList.at(pos).toInt();
                        pos++;
                    }
                }

                // if single digit year, move it to the current century
                if (year < 10)
                    year += today.year() - today.year() % 100;

                if(day > 0 && month > 0 && year > 0)
                    tmp = QDate(year, month, day);
            }
            else if(formatList.size() == 3 && numberList.size() == 1)
            {
                QString ns = numberList.at(0);
                bool isNumber = false;
                (void)ns.toInt(&isNumber);
                if(isNumber && (ns.length() == 6 || ns.length() == 8))
                {
                    int year = today.year();
                    int day = -1;
                    int month = -1;

                    pos = 0;
                    for (int i = 0; i < formatList.size(); ++i)
                    {
                        QChar ch = formatList.at(i).toLower().at(0);
                        if(ch == 'y')
                        {
                            if(ns.length() == 8)
                            {
                                year = ns.mid(pos, 4).toInt();
                                pos+=4;
                            }
                            else
                            {
                                year = ns.mid(pos, 2).toInt(&isNumber);
                                pos+=2;
                                if(isNumber)
                                {
                                    if(year < 50)
                                        year += 2000;
                                    else
                                        year += 1900;
                                }
                            }
                        }
                        else if(ch == 'm')
                        {
                            month = ns.mid(pos, 2).toInt();
                            pos+=2;
                        }
                        else if(ch == 'd')
                        {
                            day = ns.mid(pos, 2).toInt();
                            pos+=2;
                        }
                    }

                    if(day > 0 && month > 0 && year > 0)
                        tmp = QDate(year, month, day);
                }
            }
        }

        setDate(QDate(tmp.year(), tmp.month(), tmp.day()), true );
    }

    if (!_valid)
        setText("");

    _parsed = true;
}
Example #28
0
		void setSource(Button* initButton) { setNull(); button = initButton;}
Example #29
0
/* preface finishes */
Variant pm_php$$globals$$symbols$_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */, Globals *globals /* = get_globals() */) {
  PSEUDOMAIN_INJECTION_BUILTIN(run_init::globals/symbols.php, pm_php$$globals$$symbols$_php);
  LVariableTable *gVariables ATTRIBUTE_UNUSED = (LVariableTable *)g;
  Variant &v_argc ATTRIBUTE_UNUSED = g->GV(argc);
  Variant &v_argv ATTRIBUTE_UNUSED = g->GV(argv);
  Variant &v__SERVER ATTRIBUTE_UNUSED = g->GV(_SERVER);
  Variant &v__GET ATTRIBUTE_UNUSED = g->GV(_GET);
  Variant &v__POST ATTRIBUTE_UNUSED = g->GV(_POST);
  Variant &v__COOKIE ATTRIBUTE_UNUSED = g->GV(_COOKIE);
  Variant &v__FILES ATTRIBUTE_UNUSED = g->GV(_FILES);
  Variant &v__ENV ATTRIBUTE_UNUSED = g->GV(_ENV);
  Variant &v__REQUEST ATTRIBUTE_UNUSED = g->GV(_REQUEST);
  Variant &v__SESSION ATTRIBUTE_UNUSED = g->GV(_SESSION);
  Variant &v_HTTP_RAW_POST_DATA ATTRIBUTE_UNUSED = g->GV(HTTP_RAW_POST_DATA);
  Variant &v_http_response_header ATTRIBUTE_UNUSED = g->GV(http_response_header);

  setNull(v_argc);
  setNull(v_argv);
  setNull(v__SERVER);
  setNull(v__GET);
  setNull(v__POST);
  setNull(v__COOKIE);
  setNull(v__FILES);
  setNull(v__ENV);
  setNull(v__REQUEST);
  setNull(v__SESSION);
  v__SERVER = s_sys_sa00000000;
  v__GET = s_sys_sa00000000;
  v__POST = s_sys_sa00000000;
  v__COOKIE = s_sys_sa00000000;
  v__FILES = s_sys_sa00000000;
  v__ENV = s_sys_sa00000000;
  v__REQUEST = s_sys_sa00000000;
  v__SESSION = s_sys_sa00000000;
  setNull(v_HTTP_RAW_POST_DATA);
  setNull(v_http_response_header);
  return true;
}
Example #30
0
 void MzTabBoolean::set(const bool& value)
 {
   setNull(false);
   value_ = value;
 }