Exemple #1
0
void Proof::traverse(ProofTraverser& trav, ClauseId goal)
{
    assert(!fp.null());

    // Switch to read mode:
    fp.setMode(READ);
    fp.seek(0);

    // Traverse proof:
    if (goal == ClauseId_NULL)
        goal = last();

    uint64  tmp;
    int     idx;
    for(ClauseId id = 0; id <= goal; id++){
        tmp = getUInt(fp);
        if ((tmp & 1) == 0){
            // Root clause:
            clause.clear();
            idx = tmp >> 1;
            clause.push(toLit(idx));
            for(;;){
                tmp = getUInt(fp);
                if (tmp == 0) break;
                idx += tmp;
                clause.push(toLit(idx));
            }
            trav.root(clause);

        }else{
Exemple #2
0
bool QDBCFile::hasFullString(quint32 field, quint32 row) const
{
    if(field < m_fieldCount && row < m_recordCount && field >= 0 && row >= 0 && m_stringSize > 1) {
        if(getUInt(field,row) < m_stringSize)
            if(getUChar(getUInt(field,row)-1)=='\0' && field > 0)
                return true;
    }
    return false;
}
Exemple #3
0
Song::Song(const std::map<std::string,std::string>& properties) : 
		properties(properties), hasVideo(false), rating(0), bitRate(0) {
	id = properties.at("Persistent ID");
	rating = std::min(getUInt(properties, "Rating") / 20, 5U);
	bitRate = getUInt(properties, "Bit Rate");
	hasVideo = properties.find("Has Video") != properties.end();

	auto locationIt = properties.find("Location");
	if (locationIt != properties.end()) {
		std::string location = uridecode(locationIt->second);
		if (boost::starts_with(location, "file://")) {
			file = location.substr(7);
		}
	}
}
Exemple #4
0
// the vr is unique only for one of the 4 base data types r,i,b,s and
// may also be fmiUndefinedValueReference = 4294967295 = 0xFFFFFFFF
// here, i means integer or enumeration
fmiValueReference getValueReference(void* scalarVariable) {
    ValueStatus vs;
    fmiValueReference vr = getUInt(scalarVariable, att_valueReference, &vs);
    assert(((Element*)scalarVariable)->type == elm_ScalarVariable);
    assert(vs==valueDefined); // this is a reqired attribute
    return vr;
}
Exemple #5
0
Inputs::Inputs() :
	Module( "Inputs" ),
	cdioDestroyTimer( new CDIODestroyTimer ),
	AudioCDPlaylist( QDir::tempPath() + "/"AudioCDName".pls" ),
	cd( QImage( ":/cd" ) ), sine( QImage( ":/sine" ) ), ray2( QImage( ":/ray2" ) )
{
	cd.setText( "Path", ":/cd" );
	sine.setText( "Path", ":/sine" );
	ray2.setText( "Path", ":/ray2" );

	init( "AudioCD/CDDB", true );
	init( "AudioCD/CDTEXT", true );
	init( "ToneGenerator/srate", 48000 );
	init( "ToneGenerator/freqs", 440 );
	init( "PCM", true );
	if ( get( "PCM/extensions" ).toStringList().isEmpty() )
		set( "PCM/extensions", standartExts.split( ';' ) );
	if ( getUInt( "PCM/format" ) >= PCM::FORMAT_COUNT )
		set( "PCM/format", 2 );
	init( "PCM/chn", 2 );
	init( "PCM/srate", 44100 );
	init( "PCM/offset", 0 );
	init( "PCM/BE", false );
	init( "Rayman2", true );
}
Exemple #6
0
int Decimal::getInt() const
{
    unsigned int value = getUInt();
    if (negative)
        return -(int) value;
    return (int) value;
}
Exemple #7
0
bool QDBCFile::hasInteger(quint32 field, quint32 row, bool isSigned) const
{
    if(field < m_fieldCount && row < m_recordCount && field >= 0 && row >= 0) {
        QVariant i;
        QVariant u;
        switch(m_fieldSize) {
        case 1:
        case 2:
        case 4:
            {
                i = getInt(field,row);
                u = getUInt(field,row);
                break;
            }
        default:
            return false;
        }
        if(isSigned) {
            if(i != u)
                return true;
        }
        else {
            if(i == u)
                return true;
        }
    }
    return false;
}
Exemple #8
0
QString QDBCFile::getString(quint32 field, quint32 row) const
{
    if(field < m_fieldCount && row < m_recordCount && field >= 0 && row >= 0) {
        if(getUInt(field,row) < (quint32)m_stringSize)
            return QString::fromUtf8(reinterpret_cast<const char*>(m_stringData.data()+getUInt(field,row)));
    }
    return QString();
}
Exemple #9
0
QString QDBCFile::getIntegerTextRepresentation(quint32 field, quint32 row, int base) const
{
    switch(fieldType(field)) {
    case FIELD_TYPE_INT:
        return QString::number(getInt(field,row),base);
    default:
        return QString::number(getUInt(field,row),base);
    }
}
Exemple #10
0
UInt64 JSON::toUInt() const
{
    ElementType type = getType();

    if (type == TYPE_NUMBER)
        return getUInt();
    else if (type == TYPE_STRING)
        return JSON(ptr_begin + 1, ptr_end, level + 1).getUInt();
    else
        throw JSONException("JSON: cannot convert value to unsigned integer.");
}
Exemple #11
0
nGpuBuffer *nGpuBuffer::copy() {
	CpuLoad();
	nGpuBuffer *c = new nGpuBuffer(type);
	if(type == Float)
		for(unsigned int i = 0; i != size(); i++) {
			c->add(getFloat(i));
		} else
		for(unsigned int i = 0; i != size(); i++) {
			c->add(getUInt(i));
		}
	return c;
}
	//-------------------------------------------------------------------------
	bool ScriptTranslator::passValidatePropertyValidUint(Ogre::ScriptCompiler* compiler, 
		Ogre::PropertyAbstractNode* prop)
	{
		Ogre::uint val = 0;
		if(getUInt(prop->values.front(), &val))
		{
			return true;
		}

		compiler->addError(Ogre::ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
			"PU Compiler: " + prop->values.front()->getValue() + " is not a valid uint");
		return false;
	}
//-------------------------------------------------------------------------
bool PUScriptTranslator::passValidatePropertyValidUint(PUScriptCompiler* compiler,
                                                     PUPropertyAbstractNode* prop)
{
    unsigned int val = 0;
    if(getUInt(*prop->values.front(), &val))
    {
        return true;
    }
    
//    compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
//                       "PU Compiler: " + prop->values.front()->getValue() + " is not a valid uint");
    return false;
}
int SNMPObject::compareValue(SNMPObject * pOther) const
{
	switch(_syntax) {		
		case SNMP_SYNTAX_OCTETS:
		case SNMP_SYNTAX_OPAQUE:
		case SNMP_SYNTAX_BITS:
		case SNMP_SYNTAX_OID:
		case SNMP_SYNTAX_NSAPADDR:
		case SNMP_SYNTAX_IPADDR:
			return getValueAsString().compare(pOther->getValueAsString());
		case SNMP_SYNTAX_INT:
			if(getInt() < pOther->getInt()) {
				return -1;
			} else if(getInt() == pOther->getInt()) {
				return 0;
			} else  {
				return 1;
			}		
		case SNMP_SYNTAX_CNTR64:
		case SNMP_SYNTAX_CNTR32:
		case SNMP_SYNTAX_GAUGE32:
		case SNMP_SYNTAX_UINT32:
		case SNMP_SYNTAX_TIMETICKS:
			if(getUInt() < pOther->getUInt()) {
				return -1;
			} else if(getUInt() == pOther->getUInt()) {
				return 0;
			} else  {
				return 1;
			}
		case SNMP_SYNTAX_NULL:
		case SNMP_SYNTAX_NOSUCHOBJECT:
		case SNMP_SYNTAX_NOSUCHINSTANCE:
		case SNMP_SYNTAX_ENDOFMIBVIEW:
			return 0;
	}
	return 0;
}
void QDropboxFileInfo::dataFromJson()
{
	if(!isValid())
		return;

	_size         = getString("size");
	_revision     = getUInt("revision");
	_thumbExists  = getBool("thumb_exists");
	_bytes        = getUInt("bytes");
	_icon         = getString("icon");
	_root         = getString("root");
	_path         = getString("path");
	_isDir        = getBool("is_dir");
	_mimeType     = getString("mime_type");
	_isDeleted    = getBool("is_deleted");
	_revisionHash = getString("rev");
	_modified     = getTimestamp("modified");
	_clientModified = getTimestamp("client_modified");
	
	// create content list
	if(_isDir)
	{
 qDebug() << "fileinfo: generating contents list";
	  _content = new QList<QDropboxFileInfo>();
	  QStringList contentsArray = getArray("contents");
	  for(qint32 i = 0; i<contentsArray.size(); ++i)
	  {
	    QDropboxFileInfo contentInfo(contentsArray.at(i));
		if(!contentInfo.isValid())
		  continue;
		
		_content->append(contentInfo);
	  }
	}
	
	qDebug() << "fertig";
	return;
}
Exemple #16
0
QString QDBCFile::getBitmaskTextRepresentation(quint32 field, quint32 row, BitmaskRepresentation view) const
{
    switch(view) {
    case BITMASK_VIEW_COMMA_SEPARATED_POSITIVE_BITS:
    case BITMASK_VIEW_COMMA_SEPARATED_POSITIVE_BITS_ALT:
        {
            quint32 index = 0;
            QString str = QString("Bitflags: ");
            if(fieldType(field) == FIELD_TYPE_INT) {
                qint32 i = getInt(field,row);
                if(i == 0)
                    return str.append("Empty.");
                if(i == 0x7FFFFFFF || i < -0x7FFFFFFF)
                    return str.append("All.");
                while(i != 0 || index <= BITMASK_MAX_BIT) {
                    qint32 value = qPow(2,index);
                    if((i & value) == value) {
                        i = (i & ~value);
                        (view == BITMASK_VIEW_COMMA_SEPARATED_POSITIVE_BITS) ? str.append(QString::number(index)) : str.append(QString::number(index+1));
                        if(i != 0)
                            str.append(",");
                        else
                            return str.append(".");
                    }
                    index++;
                }
            }
            else {
                quint32 u = getUInt(field,row);
                if(u == 0)
                    return str.append("Empty.");
                if(u == 0xffffffff)
                    return str.append("All.");
                while(u != 0 || index <= BITMASK_MAX_BIT) {
                    quint32 value = qPow(2,index);
                    if((u & value) == value) {
                        u = (u & ~value);
                        (view == BITMASK_VIEW_COMMA_SEPARATED_POSITIVE_BITS) ? str.append(QString::number(index)) : str.append(QString::number(index+1));
                        if(u != 0)
                            str.append(",");
                        else
                            return str.append(".");
                    }
                    index++;
                }
            }
        }
    }
    return QString();
}
Exemple #17
0
	std::vector<unsigned> TclUtils::getUIntVector(Tcl_Interp *interp, Tcl_Obj *objPtr) {
		int length;
		int rc = Tcl_ListObjLength(interp, objPtr, &length);
		if (TCL_OK != rc) {
			throw wrong_args_value_exception(error_message::bad_list_argument);
		}

		std::vector<unsigned> ret;
		for (int i = 0; i < length; ++i) {
			Tcl_Obj* v;
			rc = Tcl_ListObjIndex(interp, objPtr, i, &v);
			if (TCL_OK != rc) {
				throw wrong_args_value_exception(error_message::bad_list_argument);
			}
			ret.push_back(getUInt(interp, v));
		}

		return ret;
	}
/* Return non-zero if the ADDR instruction has a branch delay slot
   (i.e. it is a jump or branch instruction). */
static UInt
mips_instruction_has_delay_slot (Addr addr)
{
   UInt op, rs, rt;
   UInt inst = getUInt((UChar *)addr);

   op = itype_op (inst);
   if ((inst & 0xe0000000) != 0) {
      rs = itype_rs (inst);
      rt = itype_rt (inst);
      return (op >> 2 == 5        /* BEQL, BNEL, BLEZL, BGTZL: bits 0101xx  */
              || op == 29         /* JALX: bits 011101  */
              || (op == 17
                  && (rs == 8     /* BC1F, BC1FL, BC1T, BC1TL: 010001 01000  */
                      || (rs == 9 && (rt & 0x2) == 0)
                                  /* BC1ANY2F, BC1ANY2T: bits 010001 01001  */
                      || (rs == 10 && (rt & 0x2) == 0))));
                                  /* BC1ANY4F, BC1ANY4T: bits 010001 01010  */
   } else
Exemple #19
0
Inputs::Inputs() :
	Module("Inputs"),
	sine(QImage(":/sine")), ray2(QImage(":/ray2"))
{
	sine.setText("Path", ":/sine");
	ray2.setText("Path", ":/ray2");

	init("ToneGenerator/srate", 48000);
	init("ToneGenerator/freqs", 440);
	init("PCM", true);
	if (get("PCM/extensions").toStringList().isEmpty())
		set("PCM/extensions", standartExts.split(';'));
	if (getUInt("PCM/format") >= PCM::FORMAT_COUNT)
		set("PCM/format", 2);
	init("PCM/chn", 2);
	init("PCM/srate", 44100);
	init("PCM/offset", 0);
	init("PCM/BE", false);
	init("Rayman2", true);
}
//-------------------------------------------------------------------------
bool PUOnCountObserverTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node )
{
    PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node);
    PUObserver* ob = static_cast<PUObserver*>(prop->parent->context);
    PUOnCountObserver* observer = static_cast<PUOnCountObserver*>(ob);

    if (prop->name == token[TOKEN_ONCOUNT_THRESHOLD])
    {
        // Property: count_threshold
        if (passValidatePropertyNumberOfValues(compiler, prop, token[TOKEN_ONCOUNT_THRESHOLD], 2))
        {
            std::string compareType;
            unsigned int val = 0;
            PUAbstractNodeList::const_iterator i = prop->values.begin();
            if(getString(**i, &compareType))
            {
                if (compareType == token[TOKEN_LESS_THAN])
                {
                    observer->setCompare(CO_LESS_THAN);
                }
                else if (compareType == token[TOKEN_GREATER_THAN])
                {
                    observer->setCompare(CO_GREATER_THAN);
                }
                else if (compareType == token[TOKEN_EQUALS])
                {
                    observer->setCompare(CO_EQUALS);
                }
                ++i;
                if(getUInt(**i, &val))
                {
                    observer->setThreshold(val);
                    return true;
                }
            }
        }
    }

    return false;
}
//-------------------------------------------------------------------------
bool PUOnEventFlagObserverTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node )
{
    PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node);
    PUObserver* ob = static_cast<PUObserver*>(prop->parent->context);
    PUOnEventFlagObserver* observer = static_cast<PUOnEventFlagObserver*>(ob);

    if (prop->name == token[TOKEN_ONEVENT_FLAG])
    {
        // Property: event_flag
        if (passValidateProperty(compiler, prop, token[TOKEN_ONEVENT_FLAG], VAL_UINT))
        {
            unsigned int val = 0;
            if(getUInt(*prop->values.front(), &val))
            {
                observer->setEventFlag(val);
                return true;
            }
        }
    }

    return false;
}
__int64 SNMPObject::getValueAsInteger() const {
	switch(_syntax) {		
		case SNMP_SYNTAX_INT:
			return (__int64)getInt();
		case SNMP_SYNTAX_OCTETS:
		case SNMP_SYNTAX_OPAQUE:
		case SNMP_SYNTAX_BITS:	
			if(_binary) {
				int sz = 0;
				char * pChar = getValueAsOctets(&sz);				
				if(pChar && sz) {
					switch(sz) {
						case 1: return (__int64)(char)*((char*)pChar);
						case 2:
						case 3: return (__int64)(short)ntohs(*((short*)pChar));
						default: return (__int64)(long)ntohl(*((long*)pChar));
					}						
				}
			} else {
				return (__int64)_atoi64(_string.c_str());
			}
			break;		
		case SNMP_SYNTAX_CNTR64:
		case SNMP_SYNTAX_CNTR32:
		case SNMP_SYNTAX_GAUGE32:
		case SNMP_SYNTAX_UINT32:
		case SNMP_SYNTAX_TIMETICKS:
			return (__int64)getUInt();
		case SNMP_SYNTAX_OID:
		case SNMP_SYNTAX_NSAPADDR:
		case SNMP_SYNTAX_IPADDR:
		case SNMP_SYNTAX_NULL:
		case SNMP_SYNTAX_NOSUCHOBJECT:
		case SNMP_SYNTAX_NOSUCHINSTANCE:
		case SNMP_SYNTAX_ENDOFMIBVIEW:
			break;
	}	
	return 0;
}
Exemple #23
0
uint64_t Hdf::configGetUInt64(uint64_t defValue /* = 0 */) const {
  return getUInt(defValue, "unsigned int64", 0);
}
Exemple #24
0
uint32_t Hdf::configGetUInt32(uint32_t defValue /* = 0 */) const {
  return getUInt(defValue, "unsigned int32", ~0xFFFFFFFFUL);
}
Exemple #25
0
unsigned char Hdf::configGetUByte(unsigned char defValue /* = 0 */) const {
  return getUInt(defValue, "unsigned byte", ~0xFFUL);
}
Exemple #26
0
uint16_t Hdf::getUInt16(uint16_t defValue /* = 0 */) const {
  return getUInt(defValue, "unsigned int16", ~0xFFFFUL);
}
//-------------------------------------------------------------------------
bool PUDoPlacementParticleEventHandlerTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node )
{
    PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node);
    PUEventHandler* evt = static_cast<PUEventHandler *>(prop->parent->context);
    PUDoPlacementParticleEventHandler* handler = static_cast<PUDoPlacementParticleEventHandler*>(evt);

    if (prop->name == token[TOKEN_DOPLACE_FORCE_EMITTER])
    {
        // Property: force_emitter
        if (passValidateProperty(compiler, prop, token[TOKEN_DOPLACE_FORCE_EMITTER], VAL_STRING))
        {
            std::string val;
            if(getString(*prop->values.front(), &val))
            {
                handler->setForceEmitterName(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_DOPLACE_NUMBER_OF_PARTICLES])
    {
        // Property: number_of_particles
        if (passValidateProperty(compiler, prop, token[TOKEN_DOPLACE_NUMBER_OF_PARTICLES], VAL_UINT))
        {
            unsigned int val = 0;
            if(getUInt(*prop->values.front(), &val))
            {
                handler->setNumberOfParticles(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_POSITION])
    {
        // Property: inherit_position
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_POSITION], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritPosition(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_DIRECTION])
    {
        // Property: inherit_direction
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_DIRECTION], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritDirection(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_ORIENTATION])
    {
        // Property: inherit_orientation
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_ORIENTATION], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritOrientation(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_TIME_TO_LIVE])
    {
        // Property: inherit_time_to_live
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_TIME_TO_LIVE], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritTimeToLive(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_MASS])
    {
        // Property: inherit_mass
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_MASS], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritMass(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_TEXTURE_COORDINATE])
    {
        // Property: inherit_texture_coord
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_TEXTURE_COORDINATE], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritTextureCoordinate(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_COLOUR])
    {
        // Property: inherit_colour
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_COLOUR], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritColour(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_WIDTH])
    {
        // Property: inherit_width
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_WIDTH], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritParticleWidth(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_HEIGHT])
    {
        // Property: inherit_height
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_HEIGHT], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritParticleHeight(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_INHERIT_DEPTH])
    {
        // Property: inherit_depth
        if (passValidateProperty(compiler, prop, token[TOKEN_INHERIT_DEPTH], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                handler->setInheritParticleDepth(val);
                return true;
            }
        }
    }

    return false;
}
Exemple #28
0
unsigned int PvObject::getUInt() const
{
    std::string key = PyPvDataUtility::getValueOrSingleFieldName(pvStructurePtr);
    return getUInt(key);
}
//-------------------------------------------------------------------------
bool PUForceFieldAffectorTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node )
{
    PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node);
    PUAffector* af = static_cast<PUAffector*>(prop->parent->context);
    PUForceFieldAffector* affector = static_cast<PUForceFieldAffector*>(af);

    if (prop->name == token[TOKEN_FORCEFIELD_TYPE])
    {
        // Property: forcefield_type
        if (passValidateProperty(compiler, prop, token[TOKEN_FORCEFIELD_TYPE], VAL_STRING))
        {
            std::string val;
            if(getString(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                if (val == token[TOKEN_REALTIME])
                {
                    affector->setForceFieldType(PUForceField::FF_REALTIME_CALC);
                    return true;
                }
                else if (val == token[TOKEN_MATRIX])
                {
                    affector->setForceFieldType(PUForceField::FF_MATRIX_CALC);
                    return true;
                }
                affector->suppressGeneration(false);
            }
        }
    }
    else if (prop->name == token[TOKEN_DELTA])
    {
        // Property: delta
        if (passValidateProperty(compiler, prop, token[TOKEN_DELTA], VAL_REAL))
        {
            float val = 0.0f;
            if(getFloat(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setDelta(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_FORCE])
    {
        // Property: force
        if (passValidateProperty(compiler, prop, token[TOKEN_FORCE], VAL_REAL))
        {
            float val = 0.0f;
            if(getFloat(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setScaleForce(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_OCTAVES])
    {
        // Property: octaves
        if (passValidateProperty(compiler, prop, token[TOKEN_OCTAVES], VAL_UINT))
        {
            unsigned int val = 0;
            if(getUInt(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setOctaves(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_FREQUENCY])
    {
        // Property: frequency
        if (passValidateProperty(compiler, prop, token[TOKEN_FREQUENCY], VAL_REAL))
        {
            float val = 0.0f;
            if(getFloat(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setFrequency(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_AMPLITUDE])
    {
        // Property: amplitude
        if (passValidateProperty(compiler, prop, token[TOKEN_AMPLITUDE], VAL_REAL))
        {
            float val = 0.0f;
            if(getFloat(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setAmplitude(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_PERSISTENCE])
    {
        // Property: persistence
        if (passValidateProperty(compiler, prop, token[TOKEN_PERSISTENCE], VAL_REAL))
        {
            float val = 0.0f;
            if(getFloat(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setPersistence(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_FORCEFIELDSIZE])
    {
        // Property: forcefield_size
        if (passValidateProperty(compiler, prop, token[TOKEN_FORCEFIELDSIZE], VAL_UINT))
        {
            unsigned int val = 0;
            if(getUInt(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setForceFieldSize(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_WORLDSIZE])
    {
        // Property: worldsize
        if (passValidateProperty(compiler, prop, token[TOKEN_WORLDSIZE], VAL_VECTOR3))
        {
            Vec3 val;
            if(getVector3(prop->values.begin(), prop->values.end(), &val))
            {
                affector->suppressGeneration(true);
                affector->setWorldSize(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_IGNORE_NEGATIVE_X])
    {
        // Property: ignore_negative_x
        if (passValidateProperty(compiler, prop, token[TOKEN_IGNORE_NEGATIVE_X], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setIgnoreNegativeX(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_IGNORE_NEGATIVE_Y])
    {
        // Property: ignore_negative_y
        if (passValidateProperty(compiler, prop, token[TOKEN_IGNORE_NEGATIVE_Y], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setIgnoreNegativeY(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_IGNORE_NEGATIVE_Z])
    {
        // Property: ignore_negative_z
        if (passValidateProperty(compiler, prop, token[TOKEN_IGNORE_NEGATIVE_Z], VAL_BOOL))
        {
            bool val;
            if(getBoolean(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setIgnoreNegativeZ(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_MOVEMENT])
    {
        // Property: movement
        if (passValidateProperty(compiler, prop, token[TOKEN_MOVEMENT], VAL_VECTOR3))
        {
            Vec3 val;
            if(getVector3(prop->values.begin(), prop->values.end(), &val))
            {
                affector->suppressGeneration(true);
                affector->setMovement(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_MOVEMENT_FREQUENCY])
    {
        // Property: movement_frequency
        if (passValidateProperty(compiler, prop, token[TOKEN_MOVEMENT_FREQUENCY], VAL_REAL))
        {
            float val = 0.0f;
            if(getFloat(*prop->values.front(), &val))
            {
                affector->suppressGeneration(true);
                affector->setMovementFrequency(val);
                affector->suppressGeneration(false);
                return true;
            }
        }
    }

    return false;
}
Exemple #30
0
UInt64 JSON::get<UInt64>() const
{
    return getUInt();
}