void Settings::saveFloppyConfig(FloppyConfig *fc) { setBool("FLOPPYCONF_ENABLED", fc->enabled); setInt ("FLOPPYCONF_DRIVEID", fc->id); setBool("FLOPPYCONF_WRITEPROTECTED", fc->writeProtected); setBool("FLOPPYCONF_SOUND_ENABLED", fc->soundEnabled); }
void Tables::buildLookup() { // build end tables for sfbands int band = 0; for(int i = 0; i < BANDS; i++) { band += bandwidth[i]; sfend[i] = band; } band = 0; for(int i = 0; i < SHORT_BANDS; i++) { band += bandwidthShort[i]; sfendShort[i] = band; } // build lookup table for 3^4=81 small values in table a+b int i = 0; for(int a = -1; a <= +1; a++) { for(int b = -1; b <= +1; b++) { for(int c = -1; c <= +1; c++) { for(int d = -1; d <= +1; d++) { int vals[4] = {a, b, c, d}; byte quad = 0; int quadPosition = 0; byte signs = 0; int signsPosition = 0; // build the 4-bit index and signs for(int j = 0; j < 4; j++) { setBool(&quad, quadPosition, vals[j] != 0); if(vals[j] != 0) setBool(&signs, signsPosition, vals[j] == -1); } // right align both quad >>= 4; signs >>= 8 - signsPosition; byte htabAValue = htabA[quad][0]; int htabALength = htabA[quad][1] + signsPosition; byte htabBValue = (~quad) & 0x0f; int htabBLength = 4 + signsPosition; short* sla = Tables::smallLookupA[i]; sla[0] = htabAValue; sla[0] <<= signsPosition; sla[0] |= signs; sla[1] = htabALength; short* slb = Tables::smallLookupB[i]; slb[0] = htabBValue; slb[0] <<= signsPosition; slb[0] |= signs; slb[1] = htabBLength; i++; } } } } }
void QtGuiPrivate::setVars(QString classname) { setString(name_,argdict_,"name"); if (!name_.isEmpty()) classname=name_; setString(label_,argdict_,"label"); if (!label_.isEmpty())label_=qApp->translate(classname,label_); setString(tip_,argdict_,"tip"); if (!tip_.isEmpty()) tip_=qApp->translate(classname,tip_); { QString s=""; setString(s,argdict_,"pixmap"); if (!s.isEmpty()) { s=_qtguiappl->absFilename(s); pixmap_=new QPixmap(s,0,0); } } #if 0 setInt(xpos_,argdict_,"x"); setInt(ypos_,argdict_,"y"); setInt(minwidth_,argdict_,"minwidth"); setInt(minheight_,argdict_,"minheight"); setInt(maxwidth_,argdict_,"maxwidth"); setInt(maxheight_,argdict_,"maxheight"); #endif if ((*argdict_)["connect"]) { connectionList_=new QList<QtGuiConnect>(); connectionList_->setAutoDelete(TRUE); QString *s; while ((s=(*argdict_)["connect"])) { connectionList_->append(new QtGuiConnect(*s)); argdict_->remove("connect"); } } setBool(immediately_,argdict_,"immediately"); }
void ParseDef::parseArgs(ParserIO& io, Language& lang) { io.skipWhitespace(name); while (io.peek(name) != ')') { if (needComma) { io.expect(',',name); io.skipWhitespace(name); } std::string tag = io.getName(name); io.skipWhitespace(name); io.expect('=',name); io.skipWhitespace(name); if (std::isdigit(io.peek(name)) || io.peek(name) == '-') setInt(io,lang,tag,io.getInt(name)); else if (io.peek(name) == '"' || io.peek(name)=='\'') setString(io,lang,tag,io.getString(name)); else if (io.peek(name) == '{') setGroup(io,lang,tag); else setBool(io,lang,tag,io.getBool(name)); io.skipWhitespace(name); needComma = true; } }
Player::Player(QGraphicsItem *parent): QGraphicsPixmapItem(parent){ setPixmap(QPixmap(":/images/playerShip.png")); bulletTimer = new QTimer(this); setBool(true); QObject::connect(bulletTimer,SIGNAL(timeout()),this,SLOT(enableBullet())); }
void Parameters::toggleBool( const std::string& name ) { if( m_boolParameters.find( name ) != m_boolParameters.end() ) { setBool( name, !getBool( name ) ); } }
bool ConfigurationManager::configure(std::string name, bool& variable, bool defaultValue) { if(!hasBool(name)) { setBool(name, defaultValue); variable = defaultValue; return false; } variable = getBool(name); return true; }
bool Save(const ARGUMENTSINFO & value) override { setString("module", value.mod); setHex("start", value.start); setHex("end", value.end); setHex("icount", value.instructioncount); setBool("manual", value.manual); return true; }
int JSonDB::readBoolean(int boolean) { if (m_record == 1) { // Set data type to entry. setFieldType(m_entryIdx, TYPE_BOOL); } setBool(m_entryIdx, boolean); return 1; }
bool ConfigData::getBool(const char* key, bool defValue) { bool result = defValue; try { result = tree.get<bool>(key); } catch(...) { // In case key is not present, create it setBool( key, result ); } return result; }
TITANIUM_FUNCTION(Properties, setBool) { ENSURE_STRING_AT_INDEX(property, 0); ENSURE_BOOL_AT_INDEX(value, 1); const auto js_context = this_object.get_context(); const auto object_ptr = GetStaticObject(js_context).GetPrivate<Properties>(); object_ptr->setBool(property, value); return js_context.CreateUndefined(); }
bool Bool::parseBool(StringRef strRef, bool* ok) { uint32 len = strRef.length(); if (len == 4) { bool ret = strRef.engEqualsIgnoreCase("true"); setBool(ok, ret); return ret; } else if (len == 5) { bool ret = strRef.engEqualsIgnoreCase("false"); setBool(ok, ret); return ret; } else { setBool(ok, false); return false; } }
const bool DataTree::setBool(const std::string& key, const bool value, const bool overwrite) { std::string boolStr = std::string(); if (value) { boolStr = "true"; } else { boolStr = "false"; } return setBool(key, boolStr, overwrite); }
bool Preferences::getBool( const QString& group, const QString& key, bool def, bool create) { QString buffer_ = getString(group, key, def ? "true" : "false", create); if ( buffer_.isEmpty() ) { if ( create ) setBool( group, key, def ); return def; } if ( buffer_.contains("true")) return true; else return false; }
bool SimpleConfig::getBool(const std::string §ion, const std::string &key, bool default_, bool set) { ConfigValue *v = _find(section, key); if (v) { std::string const &value = v->getValue(); if (value == "true" || atoi(value.c_str())) { return true; } else { return false; } } else if (set) { setBool(section, key, default_); } return default_; }
void Settings::storeDefaultValues(void) { Debug::out(LOG_DEBUG, "Settings::storeDefaultValues() - storing default settings, because it seems we miss those setting..."); char key[32]; for(int id=0; id<8; id++) { // read the list of device types from settings sprintf(key, "ACSI_DEVTYPE_%d", id); // create settings KEY, e.g. ACSI_DEVTYPE_0 if(id == 1) { // ACSI id 0 enaled by defaul setInt(key, DEVTYPE_TRANSLATED); } else { // other ACSI id's disabled setInt(key, DEVTYPE_OFF); } } setChar("DRIVELETTER_FIRST", 'C'); setChar("DRIVELETTER_SHARED", 'P'); setChar("DRIVELETTER_CONFDRIVE", 'O'); setBool("MOUNT_RAW_NOT_TRANS", false); setBool("SHARED_ENABLED", false); setBool("SHARED_NFS_NOT_SAMBA", false); }
void ConfigValue::setString(const char* val) { switch(type) { case ConfigValue::Bool: setBool(!strcmp(val, "true") || !strcmp(val, "1")); break; case ConfigValue::Integer: setInt(strtol(val, nullptr, 0)); break; case ConfigValue::Float: setFloat((float) atof(val)); break; case ConfigValue::String: setString(std::string(val)); break; } }
void Settings::loadFile() { const std::string path = getHomePath() + "/.emulationstation/es_settings.cfg"; if (!boost::filesystem::exists(path)) return; pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(path.c_str()); if (!result) { LOG(LogError) << "Could not parse Settings file!\n " << result.description(); return; } for (pugi::xml_node node = doc.child("bool"); node; node = node.next_sibling("bool")) setBool(node.attribute("name").as_string(), node.attribute("value").as_bool()); for (pugi::xml_node node = doc.child("int"); node; node = node.next_sibling("int")) setInt(node.attribute("name").as_string(), node.attribute("value").as_int()); for (pugi::xml_node node = doc.child("float"); node; node = node.next_sibling("float")) setFloat(node.attribute("name").as_string(), node.attribute("value").as_float()); for (pugi::xml_node node = doc.child("string"); node; node = node.next_sibling("string")) setString(node.attribute("name").as_string(), node.attribute("value").as_string()); }
void Player::keyPressEvent(QKeyEvent *event){ if(event->key() == Qt::Key_Left){ if(pos().x()>0){ setPos(x()-10,y()); } } else if(event->key() == Qt::Key_Right){ if(pos().x() + 40 < 350){ setPos(x()+10,y()); } } else if(event->key() == Qt::Key_Up){ if(pos().y() > 0){ setPos(x(),y()-10); } } else if(event->key() == Qt::Key_Down){ if(pos().y() + 80 < 600){ setPos(x(),y()+10); } } else if(event->key() == Qt::Key_Space && bulAccept == true){ Bullet *bullet = new Bullet(); bullet->setPos(x()-240,y()-181); scene()->addItem(bullet); setBool(false); bulletTimer->start(2000); } else if(event->key() == Qt::Key_Escape){ game->close(); } }
void Record::setBool(string fieldName, bool value) { if (Field* field = fieldByName(fieldName)) setBool(field->getIndex(), value); }
void cSrvParams::setDefaultServerList() { setBool("LoginServer", "enabled", true); setString("LoginServer", "Shard 1", "Default=127.0.0.1,2593"); flush(); // save. }
void BooleanField::increment() { setBool(!getBool()); sendToServer(); }
void Player::enableBullet(){ setBool(true); bulletTimer->stop(); }
// // public "set" methods // void CConfigFile::setBool(const char * const key, const bool val) { setBool(std::string(key), val); }
MooseApp::~MooseApp() { // Warn if the compiler *does not* have support for the C++11 // features we plan to initially require support for in MOOSE. The // user can completely opt out of seeing this warning by setting the // environment variable MOOSE_CXX11_IGNORE char * moose_cxx11_ignore = std::getenv("MOOSE_CXX11_IGNORE"); if (!moose_cxx11_ignore) { // Array of feature descriptions const char * feature_descriptions[] = { "alias declarations", "auto keyword", "constexpr keyword", "decltype keyword", "deleted functions", "lambdas", "move keyword", "override keyword", "range-based for", "rvalue references", "std::shared_ptr", "std::unique_ptr", "variadic templates", }; // Array of true/false values const int tf_array[] = { setBool(EXPAND(LIBMESH_HAVE_CXX11_ALIAS_DECLARATIONS)), setBool(EXPAND(LIBMESH_HAVE_CXX11_AUTO)), setBool(EXPAND(LIBMESH_HAVE_CXX11_CONSTEXPR)), setBool(EXPAND(LIBMESH_HAVE_CXX11_DECLTYPE)), setBool(EXPAND(LIBMESH_HAVE_CXX11_DELETED_FUNCTIONS)), setBool(EXPAND(LIBMESH_HAVE_CXX11_LAMBDA)), setBool(EXPAND(LIBMESH_HAVE_CXX11_MOVE)), setBool(EXPAND(LIBMESH_HAVE_CXX11_OVERRIDE)), setBool(EXPAND(LIBMESH_HAVE_CXX11_RANGEFOR)), setBool(EXPAND(LIBMESH_HAVE_CXX11_RVALUE_REFERENCES)), setBool(EXPAND(LIBMESH_HAVE_CXX11_SHARED_PTR)), setBool(EXPAND(LIBMESH_HAVE_CXX11_UNIQUE_PTR)), setBool(EXPAND(LIBMESH_HAVE_CXX11_VARIADIC_TEMPLATES)) }; int n_entries = sizeof(tf_array)/sizeof(int); int success = std::accumulate(tf_array, tf_array+n_entries, 0); // Print prominent warning to screen if compiler does not support // one of the features we require. if (success < n_entries) { // Get compiler name and version #ifdef __clang__ std::string compiler_name = "Clang", compiler_version = QUOTE(__clang_major__) "." QUOTE(__clang_minor__) "." QUOTE(__clang_patchlevel__); #elif __INTEL_COMPILER std::string compiler_name = "Intel", compiler_version = QUOTE(__INTEL_COMPILER_BUILD_DATE); #elif __GNUG__ std::string compiler_name = "GCC", compiler_version = QUOTE(__GNUC__) "." QUOTE(__GNUC_MINOR__) "." QUOTE(__GNUC_PATCHLEVEL__); #else std::string compiler_name = "Unknown compiler", compiler_version = "Unknown version"; #endif std::stringstream oss; oss << "--------------------------------------------------------------------------------\n"; oss << "Warning!\n"; oss << "MOOSE will soon start using the following C++11 features, but\n"; oss << "your compiler, " << compiler_name << ' ' << compiler_version << ", does not support the ones marked 'no' below:\n"; for (int i=0; i<n_entries; ++i) printYesNo(oss, feature_descriptions[i], tf_array[i]); oss << '\n'; oss << "These features will require the following minimum compiler versions:\n"; oss << "* GCC >= 4.8.4\n"; oss << "* Clang >= 3.4.0\n"; oss << "* Intel >= 20130607\n"; oss << "\n"; oss << "Please upgrade your compiler as soon as possible, or send mail to\n"; oss << "[email protected] for assistance.\n"; oss << "--------------------------------------------------------------------------------\n"; Moose::out << '\n' << oss.str(); } } _action_warehouse.clear(); _executioner.reset(); delete _input_parameter_warehouse; #ifdef LIBMESH_HAVE_DLOPEN // Close any open dynamic libraries for (std::map<std::pair<std::string, std::string>, void *>::iterator it = _lib_handles.begin(); it != _lib_handles.end(); ++it) dlclose(it->second); #endif }
ConfEntry::ConfEntry(const std::string& name, bool value) { this->name = name; setBool(value); }
void Record::setBool(Field& field, bool value) { setBool(field.getName(),value); }
void cSrvParams::guardsActive(bool enabled) { guardsActive_ = enabled; setBool("General", "Guards Enabled", enabled); }
void Sound::setLooping(bool looping) { setBool(looping, AL_LOOPING); }
void Sound::setRelative(bool rel) { setBool(rel, AL_SOURCE_RELATIVE); }