Exemple #1
0
void TestRunner::overridePreference(JSStringRef key, JSStringRef value)
{
    if (equals(key, "WebKitJavaScriptEnabled"))
        ewk_view_setting_enable_scripts_set(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitDefaultFontSize"))
        ewk_view_setting_font_default_size_set(browser->mainView(), toInt(value));
    else if (equals(key, "WebKitMinimumFontSize"))
        ewk_view_setting_font_minimum_size_set(browser->mainView(), toInt(value));
    else if (equals(key, "WebKitPluginsEnabled"))
        ewk_view_setting_enable_plugins_set(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitWebGLEnabled"))
        ewk_view_setting_enable_webgl_set(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitEnableCaretBrowsing"))
        ewk_view_setting_caret_browsing_set(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitUsesPageCachePreferenceKey"))
        ewk_view_setting_page_cache_set(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitHyperlinkAuditingEnabled"))
        ewk_view_setting_enable_hyperlink_auditing_set(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitTabToLinksPreferenceKey"))
        ewk_view_setting_include_links_in_focus_chain_set(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitOfflineWebApplicationCacheEnabled"))
        ewk_view_setting_application_cache_set(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitLoadSiteIconsKey"))
        DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitCSSGridLayoutEnabled"))
        DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled(browser->mainView(), toBool(value));
    else if (equals(key, "WebKitWebAudioEnabled"))
        ewk_view_setting_web_audio_set(browser->mainView(), toBool(value));
    else
        fprintf(stderr, "TestRunner::overridePreference tried to override unknown preference '%s'.\n", value->ustring().utf8().data());
}
Exemple #2
0
//---------------------------------------------------------------------------------------------------
SFBool CFunction::setValueByName(const SFString& fieldName, const SFString& fieldValue)
{
	switch (tolower(fieldName[0]))
	{
		case 'a':
			if ( fieldName % "anonymous" ) { anonymous = toBool(fieldValue); return TRUE; }
			break;
		case 'c':
			if ( fieldName % "constant" ) { constant = toBool(fieldValue); return TRUE; }
			break;
		case 'e':
			if ( fieldName % "encoding" ) { encoding = fieldValue; return TRUE; }
			break;
		case 'h':
			if ( fieldName % "handle" ) { handle = toLong(fieldValue); return TRUE; }
			break;
		case 'i':
			if ( fieldName % "indexed" ) { indexed = toBool(fieldValue); return TRUE; }
			if ( fieldName % "inputs" ) parseParams(TRUE, fieldValue); return TRUE;
			break;
		case 'n':
			if ( fieldName % "name" ) { name = fieldValue; return TRUE; }
			break;
		case 'o':
			if ( fieldName % "outputs" ) parseParams(FALSE, fieldValue); return TRUE;
			break;
		case 't':
			if ( fieldName % "type" ) { type = fieldValue; return TRUE; }
			break;
		default:
			break;
	}
	return FALSE;
}
OpenGLContext OpenGLContext::fromJsonConfig(const QJsonObject & config, JsonParseError * error)
{
    static const auto hasWrongFormat = -1;

    QSurfaceFormat format{};
    format.setRenderableType(QSurfaceFormat::OpenGL);

    const auto majorVersion = config.value("major").toInt(hasWrongFormat);

    if (majorVersion == hasWrongFormat)
    {
        if (error)
            *error = { JsonParseError::PropertyNotFoundOrWrongFormat, "major" };

        return OpenGLContext{};
    }

    const auto minorVersion = config.value("minor").toInt(hasWrongFormat);

    if (minorVersion == hasWrongFormat)
    {
        if (error)
            *error = { JsonParseError::PropertyNotFoundOrWrongFormat, "minor" };

        return OpenGLContext{};
    }

    format.setVersion(majorVersion, minorVersion);

    if (format.version() >= qMakePair(3, 2))
    {
        const auto jsonCoreFlag = config.value("core");
        const auto profile = jsonCoreFlag.toBool(true) ? QSurfaceFormat::CoreProfile :
                             QSurfaceFormat::CompatibilityProfile;

        format.setProfile(profile);
    }

    if (format.version() >= qMakePair(3, 0))
    {
        const auto jsonForwardFlag = config.value("forward");

        if (jsonForwardFlag.toBool(false))
            format.setOption(QSurfaceFormat::DeprecatedFunctions);
    }

    const auto jsonDebugFlag = config.value("debug");

    if (jsonDebugFlag.toBool(false))
        format.setOption(QSurfaceFormat::DebugContext);

    auto context = OpenGLContext{};
    context.setFormat(format);

    if (error)
        *error = JsonParseError::NoError;

    return context;
}
Exemple #4
0
/* Uh, this doesn't do anything at all.  IIRC glibc (or ld.so, I don't
   remember) does a bunch of mprotects on itself, and if we follow
   through here, it causes the debug info for that object to get
   discarded. */
void VG_(di_notify_mprotect)( Addr a, SizeT len, UInt prot )
{
   Bool exe_ok = toBool(prot & VKI_PROT_EXEC);
#  if defined(VGP_x86_linux)
   exe_ok = exe_ok || toBool(prot & VKI_PROT_READ);
#  endif
   if (0 && !exe_ok)
      discard_syms_in_range(a, len);
}
Exemple #5
0
void Image3DOverlay::setProperties(const QVariantMap& properties) {
    Billboard3DOverlay::setProperties(properties);

    auto urlValue = properties["url"];
    if (urlValue.isValid()) {
        QString newURL = urlValue.toString();
        if (newURL != _url) {
            setURL(newURL);
        }
    }

    auto subImageBoundsVar = properties["subImage"];
    if (subImageBoundsVar.isValid()) {
        if (subImageBoundsVar.isNull()) {
            _fromImage = QRect();
        } else {
            QRect oldSubImageRect = _fromImage;
            QRect subImageRect = _fromImage;
            auto subImageBounds = subImageBoundsVar.toMap();
            if (subImageBounds["x"].isValid()) {
                subImageRect.setX(subImageBounds["x"].toInt());
            } else {
                subImageRect.setX(oldSubImageRect.x());
            }
            if (subImageBounds["y"].isValid()) {
                subImageRect.setY(subImageBounds["y"].toInt());
            } else {
                subImageRect.setY(oldSubImageRect.y());
            }
            if (subImageBounds["width"].isValid()) {
                subImageRect.setWidth(subImageBounds["width"].toInt());
            } else {
                subImageRect.setWidth(oldSubImageRect.width());
            }
            if (subImageBounds["height"].isValid()) {
                subImageRect.setHeight(subImageBounds["height"].toInt());
            } else {
                subImageRect.setHeight(oldSubImageRect.height());
            }
            setClipFromSource(subImageRect);
        }
    }

    auto keepAspectRatioValue = properties["keepAspectRatio"];
    if (keepAspectRatioValue.isValid()) {
        _keepAspectRatio = keepAspectRatioValue.toBool();
    }

    auto emissiveValue = properties["emissive"];
    if (emissiveValue.isValid()) {
        _emissive = emissiveValue.toBool();
    }
}
static void notify_tool_of_mmap(Addr a, SizeT len, UInt prot, ULong di_handle)
{
   Bool rr, ww, xx;

   /* 'a' is the return value from a real kernel mmap, hence: */
   vg_assert(VG_IS_PAGE_ALIGNED(a));
   /* whereas len is whatever the syscall supplied.  So: */
   len = VG_PGROUNDUP(len);

   rr = toBool(prot & VKI_PROT_READ);
   ww = toBool(prot & VKI_PROT_WRITE);
   xx = toBool(prot & VKI_PROT_EXEC);

   VG_TRACK( new_mem_mmap, a, len, rr, ww, xx, di_handle );
}
Exemple #7
0
	ActorProto::ActorProto(const TupleParser &parser) :ProtoImpl(parser, true) {
		punch_weapon = parser("punch_weapon");
		kick_weapon = parser("kick_weapon");
		sound_prefix = parser("sound_prefix");
		is_heavy = toBool(parser("is_heavy"));
		is_alive = toBool(parser("is_alive"));

		float4 speed_vec = toFloat4(parser("speeds"));
		speeds[0] = speed_vec.x;
		speeds[1] = speed_vec.y;
		speeds[2] = speed_vec.z;
		speeds[3] = speed_vec.w;

		hit_points = toFloat(parser("hit_points"));
	}
Tensor variable_data_factory(const Type& type, PyObject* args, PyObject* kwargs) {
  static PythonArgParser parser({
    "new(Tensor other, *, bool requires_grad=False)",
    "new(PyObject* data, *, int64_t device=-1, bool requires_grad=False)",
  });

  PyObject* parsed_args[3];
  auto r = parser.parse(args, kwargs, parsed_args);
  if (r.idx == 0) {
    return set_requires_grad(new_with_tensor_copy(type, r.tensor(0)), r.toBool(1));
    return set_requires_grad(new_with_tensor(type, r.tensor(0)), r.toBool(1));
  } else if (r.idx == 1) {
    return set_requires_grad(new_from_data(type, r.toInt64(1), r.pyobject(0)), r.toBool(2));
  }
  throw std::runtime_error("variable(): invalid arguments");
}
Resource* TiledFont::GetFont(File* f, Kvp kvp) {
	bool monosized = toBool(GetKv(kvp, "monosized"));
	char* charset = 0;
	auto cs = GetKv(kvp, "charset");
	if(!cs.empty()) {
		charset = (char*)cs.c_str();
	}
	int fontsize = 13;
	auto fs = GetKv(kvp, "fontsize");
	if(!fs.empty()) {
		fontsize = std::stoi(fs);
	}
	auto bgc = GetKv(kvp, "bgcolor");
	unsigned int bg_key = 0;
	if(!bgc.empty()) {
		bg_key = Color(bgc).GetUint32();
	}
	
	Size tilesize = {64,64};
	auto ts = GetKv(kvp, "tilesize");
	std::vector<std::string> vs;
	split_string(ts, vs, ',');
	if(vs.size() == 2) {
		tilesize.w = std::stoi(vs[0]);
		tilesize.h = std::stoi(vs[1]);
	}
	std::cout << "loading tiledfont: " << f->path << "\n";
	Image* img = Images::GetImage(f->path);
	if(!img) {
		return 0;
	}
	
	
	return new TiledFont(img, tilesize, bg_key, fontsize, monosized, charset);
}
KOKKOS_INLINE_FUNCTION
bool
operator || (const PCE<Storage>& x1,
             const typename PCE<Storage>::value_type& b)
{
  return toBool(x1) || b;
}
KOKKOS_INLINE_FUNCTION
bool
operator || (const typename PCE<Storage>::value_type& a,
             const PCE<Storage>& x2)
{
  return a || toBool(x2);
}
Exemple #12
0
SEXP lUModDist_z
( SEXP RptrA, SEXP Rptrp, SEXP Rptru, SEXP Rptrv, SEXP conjugate, SEXP tau ){
  ElLUModDist_z( toDistMatrix_z(RptrA), toDistPermutation(Rptrp),
                 toDistMatrix_z(Rptru), toDistMatrix_z(Rptrv),
		 toBool(conjugate), toDouble(tau) );
  return R_NilValue;
}
Exemple #13
0
SEXP multiplyAfterLDLPivDist_z
( SEXP RptrA, SEXP RptrdSub, SEXP Rptrp, SEXP RptrB, SEXP conjugate ){
  ElMultiplyAfterLDLPivDist_z( toDistMatrix_z(RptrA), toDistMatrix_z(RptrdSub),
			       toDistPermutation(Rptrp), toDistMatrix_z(RptrB),
			       toBool(conjugate) );
  return R_NilValue;
}
Exemple #14
0
SEXP solveAfterLDLPiv_z
( SEXP RptrA, SEXP RptrdSub, SEXP Rptrp, SEXP RptrB, SEXP conjugate ){
  ElSolveAfterLDLPiv_z( toMatrix_z(RptrA), toMatrix_z(RptrdSub),
                        toPermutation(Rptrp), toMatrix_z(RptrB),
			toBool(conjugate) );
  return R_NilValue;
}
Exemple #15
0
bool ConfigDomain::getBool(const UString &key, bool def) const {
	UString value;
	if (!getKey(key, value))
		return def;

	return toBool(value);
}
Exemple #16
0
/*!
  Creates a set-call for property \a exclusiveProp of the object
  given in \a e.

  If the object does not have this property, the function does nothing.

  Exclusive properties are used to generate the implementation of
  application font or palette change handlers in createFormImpl().

 */
void Uic::createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp )
{
    QDomElement n;
    QString objClass = getClassName( e );
    if ( objClass.isEmpty() )
	return;
    QString objName = getObjectName( e );
#if 0 // it's not clear whether this check should be here or not
    if ( objName.isEmpty() )
	return;
#endif
    for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
	if ( n.tagName() == "property" ) {
	    bool stdset = stdsetdef;
	    if ( n.hasAttribute( "stdset" ) )
		stdset = toBool( n.attribute( "stdset" ) );
	    QString prop = n.attribute( "name" );
	    if ( prop != exclusiveProp )
		continue;
	    QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset );
	    if ( value.isEmpty() )
		continue;
	    // we assume the property isn't of type 'string'
	    out << '\t' << objName << "->setProperty( \"" << prop << "\", " << value << " );" << endl;
	}
    }
}
MenuActiveEffects::MenuActiveEffects(StatBlock *_stats)
	: timer(NULL)
	, stats(_stats)
	, orientation(false) { // horizontal
	// Load config settings
	FileParser infile;
	// @CLASS MenuActiveEffects|Description of menus/activeeffects.txt
	if(infile.open("menus/activeeffects.txt")) {
		while(infile.next()) {
			if (parseMenuKey(infile.key, infile.val))
				continue;

			// @ATTR orientation|bool|True is vertical orientation; False is horizontal orientation.
			if(infile.key == "orientation") {
				orientation = toBool(infile.val);
			}
			else {
				infile.error("MenuActiveEffects: '%s' is not a valid key.", infile.key.c_str());
			}
		}
		infile.close();
	}

	loadGraphics();
	align();
}
void DatabaseInfo::acceptWidget(DomWidget *node)
{
    QHash<QString, DomProperty*> properties = propertyMap(node->elementProperty());

    DomProperty *frameworkCode = properties.value(QLatin1String("frameworkCode"), 0);
    if (frameworkCode && toBool(frameworkCode->elementBool()) == false)
        return;

    DomProperty *db = properties.value(QLatin1String("database"), 0);
    if (db && db->elementStringList()) {
        QStringList info = db->elementStringList()->elementString();

        QString connection = info.size() > 0 ? info.at(0) : QString();
        if (connection.isEmpty())
            return;
        m_connections.append(connection);

        QString table = info.size() > 1 ? info.at(1) : QString();
        if (table.isEmpty())
            return;
        m_cursors[connection].append(table);

        QString field = info.size() > 2 ? info.at(2) : QString();
        if (field.isEmpty())
            return;
        m_fields[connection].append(field);
    }

    TreeWalker::acceptWidget(node);
}
SDLFontEngine::SDLFontEngine() : FontEngine(), active_font(NULL) {
	// Initiate SDL_ttf
	if(!TTF_WasInit() && TTF_Init()==-1) {
		logError("SDLFontEngine: TTF_Init: %s", TTF_GetError());
		Exit(2);
	}

	// load the fonts
	// @CLASS SDLFontEngine: Font settings|Description of engine/font_settings.txt
	FileParser infile;
	if (infile.open("engine/font_settings.txt")) {
		while (infile.next()) {
			if (infile.new_section) {
				SDLFontStyle f;
				f.name = infile.section;
				font_styles.push_back(f);
			}

			if (font_styles.empty()) continue;

			SDLFontStyle *style = &(font_styles.back());
			if ((infile.key == "default" && style->path == "") || infile.key == LANGUAGE) {
				// @ATTR $STYLE.default, $STYLE.$LANGUAGE|filename (string), point size (integer), blending (boolean)|Filename, point size, and blend mode of the font to use for this language. $STYLE can be something like "font_normal" or "font_bold". $LANGUAGE can be a 2-letter region code.
				style->path = popFirstString(infile.val);
				style->ptsize = popFirstInt(infile.val);
				style->blend = toBool(popFirstString(infile.val));
				style->ttfont = TTF_OpenFont(mods->locate("fonts/" + style->path).c_str(), style->ptsize);
				if(style->ttfont == NULL) {
					logError("FontEngine: TTF_OpenFont: %s", TTF_GetError());
				}
				else {
					int lineskip = TTF_FontLineSkip(style->ttfont);
					style->line_height = lineskip;
					style->font_height = lineskip;
				}
			}
		}
		infile.close();
	}

	// set the font colors
	Color color;
	if (infile.open("engine/font_colors.txt")) {
		while (infile.next()) {
			// @ATTR menu_normal, menu_bonus, menu_penalty, widget_normal, widget_disabled|r (integer), g (integer), b (integer)|Colors for menus and widgets
			// @ATTR combat_givedmg, combat_takedmg, combat_crit, combat_buff, combat_miss|r (integer), g (integer), b (integer)|Colors for combat text
			// @ATTR requirements_not_met, item_bonus, item_penalty, item_flavor|r (integer), g (integer), b (integer)|Colors for tooltips
			// @ATTR item_$QUALITY|r (integer), g (integer), b (integer)|Colors for item quality. $QUALITY should match qualities used in items/items.txt
			color_map[infile.key] = toRGB(infile.val);
		}
		infile.close();
	}

	// Attempt to set the default active font
	setFont("font_regular");
	if (!active_font) {
		logError("FontEngine: Unable to determine default font!");
		Exit(1);
	}
}
void leagueOverSeer::loadConfig(const char* cmdLine) //Load the plugin configuration file
{
    PluginConfig config = PluginConfig(cmdLine);
    std::string section = "leagueOverSeer";

    if (config.errors) bz_shutdown(); //Shutdown the server

    //Extract all the data in the configuration file and assign it to plugin variables
    rotLeague = toBool(config.item(section, "ROTATIONAL_LEAGUE"));
    mapchangePath = config.item(section, "MAPCHANGE_PATH");
    SQLiteDB = config.item(section, "SQLITE_DB");
    LEAGUE_URL = config.item(section, "LEAGUE_OVER_SEER_URL");
    DEBUG = atoi((config.item(section, "DEBUG_LEVEL")).c_str());

    //Check for errors in the configuration data. If there is an error, shut down the server
    if (strcmp(LEAGUE_URL.c_str(), "") == 0)
    {
            bz_debugMessage(0, "*** DEBUG :: League Over Seer :: No URLs were choosen to report matches or query teams. ***");
            bz_shutdown();
    }
    if (DEBUG > 4 || DEBUG < 0)
    {
        bz_debugMessage(0, "*** DEBUG :: League Over Seer :: Invalid debug level in the configuration file. ***");
        bz_shutdown();
    }
}
Exemple #21
0
void AnimeListWidget::loadState() {
    QString table_key = "states/";
    QString width_key = m_list + "_stateWidth_";
    QString hidden_key = m_list + "_stateVisible_";

    width_key.replace(QRegExp("[ ]+"), "");
    hidden_key.replace(QRegExp("[ ]+"), "");

    QSettings settings;

    for (int i = 0; i < m_model->columnCount(); ++i) {
        auto width = settings.value(table_key + width_key + QString::number(i));
        auto hidden = settings.value(table_key + hidden_key + QString::number(i));

        if (settings.contains(table_key + hidden_key + QString::number(i))) {
            m_ui->table->setColumnHidden(i, hidden.toBool());
        } else {
            m_ui->table->setColumnHidden(i, m_model->defaultHidden(i));
        }

        if (settings.contains(table_key + width_key + QString::number(i))) {
            m_ui->table->setColumnWidth(i, width.toInt());
        }
    }
}
void DistViewGUI::restoreState()
{
	QSettings settings;

	settings.beginGroup("DistView_" + representation::str(type));
	auto hq = settings.value("HQDrawing", true);
	auto log = settings.value("LogDrawing", false);
	auto alpha = settings.value("alphaModifier", 50);
	auto nbins = settings.value("NBins", 64);
	settings.endGroup();

	uivc->actionHq->setChecked(hq.toBool());
	uivc->actionLog->setChecked(log.toBool());
	uivc->alphaSlider->setValue(alpha.toInt());
	uivc->binSlider->setValue(nbins.toInt());
}
bool hkbGetWorldFromModelModifier::readData(const HkxXmlReader &reader, long & index){
    std::lock_guard <std::mutex> guard(mutex);
    bool ok;
    QByteArray text;
    auto ref = reader.getNthAttributeValueAt(index - 1, 0);
    auto checkvalue = [&](bool value, const QString & fieldname){
        (!value) ? LogFile::writeToLog(getParentFilename()+": "+getClassname()+": readData()!\n'"+fieldname+"' has invalid data!\nObject Reference: "+ref) : NULL;
    };
    for (; index < reader.getNumElements() && reader.getNthAttributeNameAt(index, 1) != "class"; index++){
        text = reader.getNthAttributeValueAt(index, 0);
        if (text == "variableBindingSet"){
            checkvalue(getVariableBindingSet().readShdPtrReference(index, reader), "variableBindingSet");
        }else if (text == "userData"){
            userData = reader.getElementValueAt(index).toULong(&ok);
            checkvalue(ok, "userData");
        }else if (text == "name"){
            name = reader.getElementValueAt(index);
            checkvalue((name != ""), "name");
        }else if (text == "enable"){
            enable = toBool(reader.getElementValueAt(index), &ok);
            checkvalue(ok, "enable");
        }else if (text == "translationOut"){
            translationOut = readVector4(reader.getElementValueAt(index), &ok);
            checkvalue(ok, "translationOut");
        }else if (text == "rotationOut"){
            rotationOut = readVector4(reader.getElementValueAt(index), &ok);
            checkvalue(ok, "rotationOut");
        }
    }
    index--;
    return true;
}
Exemple #24
0
LootManager::LootManager()
	: sfx_loot(0)
	, drop_max(1)
	, drop_radius(1)
	, hero(NULL)
	, tooltip_margin(0)
{
	tip = new WidgetTooltip();

	FileParser infile;
	// load loot animation settings from engine config file
	// @CLASS Loot|Description of engine/loot.txt
	if (infile.open("engine/loot.txt")) {
		while (infile.next()) {
			if (infile.key == "tooltip_margin") {
				// @ATTR tooltip_margin|integer|Vertical offset of the loot tooltip from the loot itself.
				tooltip_margin = toInt(infile.val);
			}
			else if (infile.key == "autopickup_currency") {
				// @ATTR autopickup_currency|boolean|Enable autopickup for currency
				AUTOPICKUP_CURRENCY = toBool(infile.val);
			}
			else if (infile.key == "currency_name") {
				// This key is parsed in loadMiscSettings() in Settings.cpp
			}
			else if (infile.key == "vendor_ratio") {
				// @ATTR vendor_ratio|integer|Prices ratio for vendors
				VENDOR_RATIO = static_cast<float>(toInt(infile.val)) / 100.0f;
			}
			else if (infile.key == "sfx_loot") {
				// @ATTR sfx_loot|string|Filename of a sound effect to play for dropping loot.
				sfx_loot =  snd->load(infile.val, "LootManager dropping loot");
			}
			else if (infile.key == "drop_max") {
				// @ATTR drop_max|integer|The maximum number of random item stacks that can drop at once
				drop_max = toInt(infile.val);
				clampFloor(drop_max, 1);
			}
			else if (infile.key == "drop_radius") {
				// @ATTR drop_radius|integer|The distance (in tiles) away from the origin that loot can drop
				drop_radius = toInt(infile.val);
				clampFloor(drop_radius, 1);
			}
			else {
				infile.error("LootManager: '%s' is not a valid key.", infile.key.c_str());
			}
		}
		infile.close();
	}

	// reset current map loot
	loot.clear();

	loadGraphics();

	full_msg = false;

	loadLootTables();
}
Exemple #25
0
void SceneryCfg::onKeyValue(const QString& section, const QString& sectionSuffix, const QString& key,
                            const QString& value)
{
  Q_UNUSED(sectionSuffix);
  if(section == "general")
  {
    if(key == "title")
      title = key;
    else if(key == "description")
      description = value;
    else if(key == "clean_on_exit")
      cleanOnExit = toBool(value);
    else
      qWarning() << "Unexpected key" << key << "in section" << section << "file" << filename;
  }
  else if(section == "area")
  {
    if(key == "title")
      currentArea.title = value;
    else if(key == "texture_id")
      currentArea.textureId = toInt(value);
    else if(key == "remote")
      currentArea.remotePath = value;
    else if(key == "local")
    {
#ifdef Q_OS_UNIX
      currentArea.localPath = QString(value).replace("\\", "/");
#else
      currentArea.localPath = value;
#endif
    }
    else if(key == "layer")
      currentArea.layer = toInt(value);
    else if(key == "active")
      currentArea.active = toBool(value);
    else if(key == "required")
      currentArea.required = toBool(value);
    else if(key == "exclude")
      currentArea.exclude = value;
    else
      qWarning() << "Unexpected key" << key << "in section" << section << "file" << filename;
  }
  else
    qWarning() << "Unexpected section" << section << "file" << filename;
}
Exemple #26
0
/**
 * Check if the hero can move during this dialog branch
 */
bool NPC::checkMovement(unsigned int dialog_node) {
	if (dialog_node < dialog.size()) {
		for (unsigned int i=0; i<dialog[dialog_node].size(); i++) {
			if (dialog[dialog_node][i].type == EC_NPC_ALLOW_MOVEMENT)
				return toBool(dialog[dialog_node][i].s);
		}
	}
	return true;
}
bool OsmAnd::MapStyleEvaluationResult::getBooleanValue(const int valueDefId, bool& value) const
{
    const auto itValue = _d->_values.constFind(valueDefId);
    if(itValue == _d->_values.cend())
        return false;

    value = itValue->toBool();
    return true;
}
Exemple #28
0
bool InetfsProperties::hasBool(const char *name)
{
	string value;
	int status = get(string(name), value);
	if (status <= 0)
	{
		return false;
	}
	return toBool(value.c_str());
}
Node * buiIf(ListNode * args, Env * env)
{
	if (len((Node *) args) < 2 || len((Node *) args) > 3) {
		error("*** ERROR:if:","Illegal form");
		return NULL;
	}
	Node * t = eval(args->car, env);
	if (t->type == BOOL && toBool(t)->value == 0) return eval(args->cddar, env);
	else					  					  return eval(args->cdar, env);
}
Exemple #30
0
QVariant QDBusDemarshaller::toVariantInternal()
{
    switch (q_dbus_message_iter_get_arg_type(&iterator)) {
    case DBUS_TYPE_BYTE:
        return qVariantFromValue(toByte());
    case DBUS_TYPE_INT16:
	return qVariantFromValue(toShort());
    case DBUS_TYPE_UINT16:
	return qVariantFromValue(toUShort());
    case DBUS_TYPE_INT32:
        return toInt();
    case DBUS_TYPE_UINT32:
        return toUInt();
    case DBUS_TYPE_DOUBLE:
        return toDouble();
    case DBUS_TYPE_BOOLEAN:
        return toBool();
    case DBUS_TYPE_INT64:
        return toLongLong();
    case DBUS_TYPE_UINT64:
        return toULongLong();
    case DBUS_TYPE_STRING:
        return toString();
    case DBUS_TYPE_OBJECT_PATH:
        return qVariantFromValue(toObjectPath());
    case DBUS_TYPE_SIGNATURE:
        return qVariantFromValue(toSignature());
    case DBUS_TYPE_VARIANT:
        return qVariantFromValue(toVariant());

    case DBUS_TYPE_ARRAY:
        switch (q_dbus_message_iter_get_element_type(&iterator)) {
        case DBUS_TYPE_BYTE:
            // QByteArray
            return toByteArray();
        case DBUS_TYPE_STRING:
            return toStringList();
        case DBUS_TYPE_DICT_ENTRY:
            return qVariantFromValue(duplicate());

        default:
            return qVariantFromValue(duplicate());
        }

    case DBUS_TYPE_STRUCT:
        return qVariantFromValue(duplicate());

    default:
        qWarning("QDBusDemarshaller: Found unknown D-Bus type %d '%c'",
                 q_dbus_message_iter_get_arg_type(&iterator),
                 q_dbus_message_iter_get_arg_type(&iterator));
        return QVariant();
        break;
    };
}