示例#1
0
void Parameters::setChar(QString key, QChar value)
{
	checkIsType_(key, Char);

	if (isRestricted_(key))
	{
		bool invalid = false;
		if (value==QChar::Null && !get_(key).restriction.toStringList().contains(""))
		{
			invalid = true;
		}
		if (value!=QChar::Null && !get_(key).restriction.toStringList().contains(value))
		{
			invalid = true;
		}

		if (invalid)
		{
			THROW(ParameterException, "Value '" + QString(value) + "' is not valid for restricted character parameter '" + key + "'.");
		}
	}

	get_(key).v_variant = value;
	emit valueChanged(key);
}
示例#2
0
void Parameters::setString(QString key, QString value)
{
	checkIsType_(key, String);

	if (isRestricted_(key) && !get_(key).restriction.toStringList().contains(value))
	{
		THROW(ParameterException, "Value '" + value + "' is not valid for restricted string parameter '" + key + "'.");
	}

	get_(key).v_variant = value;
	emit valueChanged(key);
}
示例#3
0
void Parameters::setBool(QString key, bool value)
{
	checkIsType_(key, Bool);

	get_(key).v_variant = value;
	emit valueChanged(key);
}
示例#4
0
void Parameters::setColor(QString key, QColor value)
{
	checkIsType_(key, Color);

	get_(key).v_variant = value;
	emit valueChanged(key);
}
示例#5
0
void Parameters::setSymbol(QString key, QwtSymbol::Style value)
{
	checkIsType_(key, Symbol);

	get_(key).v_symbol = value;
	emit valueChanged(key);
}
示例#6
0
void Parameters::setDouble(QString key, double value)
{
	checkIsType_(key, Double);

	if (isRestricted_(key))
	{
		QPointF bounds = get_(key).restriction.toPointF();
		if (value < bounds.x() || value > bounds.y())
		{
			THROW(ParameterException, "Value '" + QString::number(value) + "' is not valid for restricted double parameter '" + key + "'.");
		}
	}

	get_(key).v_variant = value;
	emit valueChanged(key);
}
示例#7
0
void* handle_monster( void *a )
 {
    usleep( WAIT );

	while ( !is_hero_dead() ) {

        pos gallego_pos = get_hero_pos(), monster_pos = get_monster_pos(), next_pos = get_monster_pos();

        maybe_monster_wants_stop();

        search_hero( _monster_moviment_default, &gallego_pos, &monster_pos, &next_pos );

        if ( gallego_pos.row == next_pos.row && gallego_pos.column == next_pos.column )
            monster_catched();

        if ( get_( next_pos.row, next_pos.column ) == BOSTA ) {
            score_up();
            pisou_na_bosta();
            veiudo.shited_sec = get_sec();
        }

        if ( get_( next_pos.row, next_pos.column ) == TRAP ) {
            veiudo.wet_sec = get_sec();
            veiudo.wet = 1;
            // vou por som de pisar no molhado que ficará na função move...junto com o monster.wav
            //if ( !get_rand( 15 ) )
             //   play_wet();
        }

       // if ( get_sec() - veiudo.shited_sec == 2 || get_sec() - veiudo.shited_sec == -58 )
        //    veiudo.shited = 0;
        // a ser colocado no set.c!
        if ( get_sec() - veiudo.wet_sec == 2 || get_sec() - veiudo.wet_sec == -58 )
            veiudo.wet = 0;

        move( next_pos );
        usleep( DELAY );

	}

     return NULL;
 }
示例#8
0
bool
CopyCacheDSMap::exists_( const char * key )
{
	try
	{
		get_( key );
		return true;
	}catch(BaseException & e){
		return false;
	}
}
示例#9
0
bool
CopyCacheDSMap::exists_( ExpressionList & list)
{
	try
	{
		get_( list );
		return true;
	}catch(BaseException & e){
		return false;
	}
}
示例#10
0
 zvalue remove(zvalue key)
 {
 int i = 0;
 zvalue* zv = get_(key, i);
 zvalue v = NULL_ZVALUE;
     if (!NULLP(*zv))
 {
     --occupied;
         v = *zv;
         *zv=DELETED_ZVALUE;
     }
     return v;
 }
示例#11
0
static void move( pos next_pos )
{
    pos monster_pos = get_monster_pos();
    next_pos.on = is_monster_shited() ? BLOCK : get_( next_pos.row, next_pos.column );
    char body = MONSTER;
    if ( is_monster_catched() ) {
        body = DEAD;
        hero_dead();
    }

    play_monstro();
    move_to( monster_pos, next_pos, body );
    if ( is_monster_shited() ) {
        play_wet();
        usleep( 1000000 );
        veiudo.shited = 0;
    }
    set_monster_pos( next_pos );
}
示例#12
0
 int TairHelper::query_family(FamilyInfo& family_info)
 {
   int64_t pos = 0;
   char pkey[64] = {'\0'};
   char skey[128] = {'\0'};
   char value[1024] = {'\0'};
   snprintf(pkey, 64, "%s%06d", key_prefix_.c_str(), get_bucket(family_info.family_id_));
   snprintf(skey, 64, "%020"PRI64_PREFIX"d", family_info.family_id_);
   tbutil::Mutex::Lock lock(mutex_);
   int32_t ret = get_(pkey, skey, value, 1024);
   if (TAIR_RETURN_SUCCESS != ret)
   {
     TBSYS_LOG(WARN, "query family : %"PRI64_PREFIX"d error: call tair put error, ret: %d, pkey: %s, skey: %s", family_info.family_id_, ret, pkey, skey);
     ret = EXIT_OP_TAIR_ERROR;
   }
   else
   {
     ret = family_info.deserialize(value, 1024, pos);
   }
   return ret;
 }
示例#13
0
double Parameters::getDouble(QString key) const
{
	checkIsType_(key, Double);

	return get_(key).v_variant.toDouble();
}
示例#14
0
QChar Parameters::getChar(QString key) const
{
	checkIsType_(key, Char);

	return get_(key).v_variant.toChar();
}
示例#15
0
QString Parameters::getString(QString key) const
{
	checkIsType_(key, String);

	return get_(key).v_variant.toString();
}
示例#16
0
int Parameters::getInt(QString key) const
{
	checkIsType_(key, Int);

	return get_(key).v_variant.toInt();
}
示例#17
0
	void CsvDeSerializer::get(float &data, const Field &field) { get_(data, field); }
示例#18
0
	void CsvDeSerializer::get(double &data, const Field &field) { get_(data, field); }
示例#19
0
 zvalue getNext(zvalue key, int& i) const
 {
     return *get_(key, i);
 }
示例#20
0
文件: mar.c 项目: marayl/aug
static aug_result
run_BIN_(int argc, char* argv[], const char* archivename)
{
    aug_mpool* mpool;
    int flags = 0;
    mode_t mode = 0;

    aug_mar* mar;
    int ch;

    switch (options_ & (READOPT_ | WRITEOPT_)) {
    case READOPT_:
        flags = AUG_RDONLY;
        break;
    case WRITEOPT_:
        flags = AUG_WRONLY;
        break;
    case READOPT_ | WRITEOPT_:
        flags = AUG_RDWR;
        break;
    }

    if (options_ & CREATEOPT_) {
        flags |= AUG_CREAT;
        mode = 0666;
    }

    mpool = aug_getmpool(aug_tlx);
    mar = aug_openmar_BIN(mpool, archivename, flags, mode);
    aug_release(mpool);

    if (!mar) {
        aug_perrinfo(aug_tlx, "aug_openmar() failed", NULL);
        return -1;
    }

    while (-1 != (ch = aug_getopt(argc, argv, OPTIONS_)))
        switch (ch) {
        case 'c':
            if (clear_(mar) < 0) {
                aug_perrinfo(aug_tlx, "failed to " CLEARTEXT_, NULL);
                goto fail;
            }
            break;
        case 'd':
            if (del_(mar, aug_optarg) < 0) {
                aug_perrinfo(aug_tlx, "failed to " DELTEXT_, NULL);
                goto fail;
            }
            break;
        case 'f':
            break;
        case 'g':
            if (get_(mar, aug_optarg) < 0) {
                aug_perrinfo(aug_tlx, "failed to " GETTEXT_, NULL);
                goto fail;
            }
            break;
        case 'i':
            if (insert_BIN_(mar, aug_optarg) < 0) {
                aug_perrinfo(aug_tlx, "failed to " INSERTTEXT_, NULL);
                goto fail;
            }
            break;
        case 'l':
            if (names_(mar) < 0) {
                aug_perrinfo(aug_tlx, "failed to " NAMESTEXT_, NULL);
                goto fail;
            }
            break;
        case 'n':
            size_(mar);
            break;
        case 'o':
            if (aug_compactmar(mar) < 0) {
                aug_perrinfo(aug_tlx, "failed to " COMPACTTEXT_, NULL);
                goto fail;
            }
            break;
        case 'p':
            if (put_BIN_(mar, aug_optarg) < 0) {
                aug_perrinfo(aug_tlx, "failed to " PUTTEXT_, NULL);
                goto fail;
            }
            break;
        case 't':
            if (list_(mar) < 0) {
                aug_perrinfo(aug_tlx, "failed to " LISTTEXT_, NULL);
                goto fail;
            }
            break;
        case 'x':
            if (extract_(mar, aug_optarg) < 0) {
                aug_perrinfo(aug_tlx, "failed to " EXTRACTTEXT_, NULL);
                goto fail;
            }
            break;
        case 'z':
            if (zero_(mar) < 0) {
                aug_perrinfo(aug_tlx, "failed to " ZEROTEXT_, NULL);
                goto fail;
            }
            break;
        case 'h':
        case '?':
        default:
            fprintf(stderr, "unexpected option [-%c]\n", aug_optopt);
            goto fail;
        }

    aug_release(mar);
    return 0;

 fail:
    aug_release(mar);
    return -1;
}
示例#21
0
	void CsvDeSerializer::get(boost::uint64_t &data, const Field &field) { get_(data, field); }
示例#22
0
QwtSymbol::Style Parameters::getSymbol(QString key) const
{
	checkIsType_(key, Symbol);

	return get_(key).v_symbol;
}
示例#23
0
bool Parameters::getBool(QString key) const
{
	checkIsType_(key, Bool);

	return get_(key).v_variant.toBool();
}
示例#24
0
QColor Parameters::getColor(QString key) const
{
	checkIsType_(key, Color);

	return get_(key).v_variant.value<QColor>();
}
示例#25
0
 zvalue get(zvalue key) const
 {
     int i = 0;
     return *get_(key, i);
 }
示例#26
0
Parameters::Type Parameters::type(QString key) const
{
	checkExists_(key);

	return get_(key).type;
}
示例#27
0
	void CsvDeSerializer::get(std::string &data, const Field &field) { get_(data, field); }