Exemplo n.º 1
0
bool XmlReader::readFraction(const char* t, Fraction* val)
      {
      if (isTag(name(), t)) {
            while (readAttribute()) {
                  if (tag() == "z")
                        val->setNumerator(realValue());
                  else if (tag() == "n")
                        val->setDenominator(realValue());
                  }
            read();
            return true;
            }
      return false;
      }
Exemplo n.º 2
0
bool XmlReader::readPoint(const char* t, QPointF* val)
      {
      if (isTag(name(), t)) {
            while (readAttribute()) {
                  if (tag() == "x")
                        val->setX(realValue());
                  else if (tag() == "y")
                        val->setY(realValue());
                  }
            read();
            return true;
            }
      return false;
      }
Exemplo n.º 3
0
bool XmlReader::readSize(const char* t, QSizeF* val)
      {
      if (isTag(name(), t)) {
            while (readAttribute()) {
                  if (tag() == "w")
                        val->setWidth(realValue());
                  else if (tag() == "h")
                        val->setHeight(realValue());
                  }
            read();
            return true;
            }
      return false;
      }
Exemplo n.º 4
0
NumberPtr Number::Read(Input &input)
{
	Integer ten(10);
	auto_ptr<Integer> intValue(new Integer);
	while(input.Current() >= '0' && input.Current() <= '9')
	{
		Integer digit(input.Current() - '0');
		intValue = intValue->Times(&ten)->Plus(&digit);
		input.Next();
	}

	// Process part after decimal separator
	if(input.Current() == '.')
	{
		// Cast the current value to float (just to prevent compiler warning)
		auto_ptr<MachineReal> realValue(new MachineReal(intValue));
		input.Next();
		auto_ptr<MachineReal> factor(new MachineReal(1.0));
		MachineReal tenth(0.1);
		while(input.Current() >= '0' && input.Current() <= '9')
		{
			MachineReal digit(input.Current() - '0');
			factor = factor->Times(&tenth);
			realValue = realValue->Plus(factor->Times(&digit).get());
			input.Next();
		}
		return NumberPtr(realValue);
	}
	else
		return NumberPtr(intValue);
}
Exemplo n.º 5
0
void MSWidgetResourceMapper::MapperItem::doCallback(MSCallback *pCallback_)
{
  MSResourceChangeCallback *cb=(MSResourceChangeCallback *)pCallback_;
  cb->resourceChanged(realValue());
}