/*! \void XCLProcessor::performSetStart(XCLSyntaxExpression* expr, QVector<XCLProcessParameter> param,XCLParsingItem* item) * \brief Sets the startposition of the XCLSyntaxExpression \a expr to the value given by the parameter of the method. * \param expr A pointer to the XCLSyntaxExpression, the processing method will be performed on. * \param param A list of parameters for this method. * \param item A pointer to the parent XCLParsingItem. * \param state The current FileParserState&. * \exception XCLException **/ void XCLProcessor::performSetStart(XCLSyntaxExpression* expr, QVector<XCLProcessParameter> param, FileParserState& item) { XCLProcessParameter p=param.at(0); _UINT32 num; QString numstring; if (p.getValueReference().startsWith("#")) { XCLCalculator calc; numstring = calc.parseExpression(p.getValueReference(), item.index); } if(p.getListRef()) { IndexedVector* iv; if(vectorHash.contains(p.getValueReference())) { iv = vectorHash.value(p.getValueReference()); } else { iv = new IndexedVector(); iv->vector = item.index.get(p.getValueReference()); iv->index=0; vectorHash.insert( p.getValueReference(),iv); } if((_SINT32)iv->index >= iv->vector->size()) { throw XCLOutOfRangeException(); } num = iv->vector->at(iv->index++)->getInterpretedValue().toInt(); } else { num=p.getValue(item.index).toInt(); } expr->setStart(num); expr->setPositionType( XCLSyntaxExpression::FIXED ); }
BOOL XCELSetStartProcessingMethod::process( XCELReader* reader, XCLSyntaxExpression* expr, QVector<XCLProcessParameter> param, QHash<QString,IndexedVector*> vectorHash) { FileParserState* state = reader->getState(); XCLProcessParameter p=param.at(0); _UINT32 num; QString numstring; if (p.getValueReference().startsWith("#")) { XCLCalculator calc; numstring = calc.parseExpression(p.getValueReference(), state->index); } if(p.getListRef()) { // std::cout<<"Enter listRef setStart processing\n"; IndexedVector* iv; if(vectorHash.contains(p.getValueReference())) { iv = vectorHash.value(p.getValueReference()); } else { iv = new IndexedVector(); iv->vector = state->index.get(p.getValueReference()); iv->index=0; vectorHash.insert( p.getValueReference(),iv); } // ### Dieses Statement ist eigentlich quatsch, weil iv->index niemals kleiner als 0 werden kann. // if(iv->index >= iv->vector->size() || iv->index < 0 ) if((_SIZE)iv->index >= iv->vector->size()) { throw XCLOutOfRangeException("List Ref contains no more values"); } num = iv->vector->at(iv->index++)->getInterpretedValue().toInt(); #ifdef PlanetsDebug std::cout<<"NUM: "<<num<<"\n"; #endif } /*else if(p.getStackRef()) { IndexedVector* iv; if(vectorHash.contains(p.getValueReference())) { iv = vectorHash.value(p.getValueReference()); } else { iv = new IndexedVector(); iv->vector = state->index.get(p.getValueReference()); iv->index=iv->verctor.size()-1; vectorHash.insert( p.getValueReference(),iv); } if(iv->index >= iv->vector->size())throw XCLOutOfRangeException(); num=iv->vector->at(iv->index--)->getInterpretedValue().toInt(); }*/ else { //p.print(); QString value=p.getValue(state->index); num=value.toInt(); } expr->setStart(num); expr->setPositionType( XCLSyntaxExpression::FIXED ); return TRUE; }