static int textAlreadyAdded(char *text) { int i; char *clean; if (strcmpignorecase("msgid \"\"", text) == 0) { return TRUE; } clean = replaceString(text, "msgid \"", ""); clean[strlen(clean) - 1] = '\0'; clean = replaceString(clean, "\\", ""); clean = replaceString(clean, "\\", ""); for (i=0;i<poIndex;i++) { if (strcmpignorecase(added[i], text) == 0) { return TRUE; } } if (checkExists(clean) == FALSE) { return TRUE; } STRNCPY(added[poIndex], text, MAX_LINE_LENGTH); poIndex++; return FALSE; }
void PlaylistItem::setAllCriteriaEnabled( bool enabled ) { m_filestatusEnabled = enabled; m_dynamicEnabled = enabled; checkExists(); setEnabled(); }
AutoloadHandler::Result AutoloadHandler::loadFromMap(const String& name, const String& kind, bool toLower, const T &checkExists) { assert(!m_map.isNull()); while (true) { const Variant& type_map = m_map.get()->get(kind); auto const typeMapCell = type_map.asCell(); if (typeMapCell->m_type != KindOfArray) return Failure; String canonicalName = toLower ? f_strtolower(name) : name; const Variant& file = typeMapCell->m_data.parr->get(canonicalName); bool ok = false; if (file.isString()) { String fName = file.toCStrRef().get(); if (fName.get()->data()[0] != '/') { if (!m_map_root.empty()) { fName = m_map_root + fName; } } try { JIT::VMRegAnchor _; bool initial; auto const ec = g_context.getNoCheck(); Unit* u = ec->evalInclude(fName.get(), nullptr, &initial); if (u) { if (initial) { TypedValue retval; ec->invokeFunc(&retval, u->getMain(), init_null_variant, nullptr, nullptr, nullptr, nullptr, ExecutionContext::InvokePseudoMain); tvRefcountedDecRef(&retval); } ok = true; } } catch (...) {} } if (ok && checkExists(name)) { return Success; } const Variant& func = m_map.get()->get(s_failure); if (func.isNull()) return Failure; // can throw, otherwise // - true means the map was updated. try again // - false means we should stop applying autoloaders (only affects classes) // - anything else means keep going Variant action = vm_call_user_func(func, make_packed_array(kind, name)); auto const actionCell = action.asCell(); if (actionCell->m_type == KindOfBoolean) { if (actionCell->m_data.num) continue; return StopAutoloading; } return ContinueAutoloading; } }
void FileUtils::zipFile(const QString &zipFileName, const QString &srcFileName) { QString newSrcFileName = getFullPath(srcFileName); if (!checkExists(newSrcFileName)) { return; } QString newZipFileName = getFullPath(zipFileName); QString commandLine = QString("7zr a \"%0\" \"%1\"").arg(newZipFileName).arg(newSrcFileName); execCommand(commandLine); }
void FileUtils::unzip(const QString &zipFileName, const QString &outputDir) { QString newZipFileName = getFullPath(zipFileName); if (!checkExists(newZipFileName)) { return; } QString newOutputDir = getFullPath(outputDir); // 如 "7zr x \"-oE:/trd/product/Rokh/bin/data/test7z\" \"E:/trd/product/Rokh/bin/tests/test1.7z\"" QString commandLine = QString("7zr x \"-o%1\" \"%0\"").arg(newZipFileName).arg(newOutputDir); execCommand(commandLine); }
void dbase::runQuery() { logger _logger( glob.g_ll, glob.g_logfile ); _logger.logstream << "RunQuery() called."; _logger.log( 0 ); bool ex = checkExists( inval[1], "gd_servers", "hostname", "0", "0" ); if ( ex == true ) { updateServer(); } else { inServer(); } _logger.logstream << "runQuery() completed."; _logger.log( 0 ); }
void PainterTerrain::initColorBuffer(){ if(checkExists("conf_runnel.txt")){ std::ifstream conf_file; std::string line; std::string name; float x; float y; float z; conf_file.open ("conf_runnel.txt"); while ( std::getline (conf_file, line) ){ std::istringstream iss(line); iss >> name; iss >> x; iss >> y; iss >> z; color_conf[name] = glm::vec3(x,y,z); } conf_file.close(); }else{
int ZKWatcher::handleEvent(int event){ std::string e = toZkEventType(event); if(event & m_event_mask){ addWatch(event); } switch(event){ case DELETE_EVENT: if(!(event & m_event_mask)){ checkExists(); } break; case CREATE_EVENT: if(!(event & m_event_mask)){ nodeExists(); } break; } return 0; }
//#include"serial.h" void dbase::runDriveQuery( const std::vector<std::string> &qvec ) { logger _logger( glob.g_ll, glob.g_logfile ); bool ex = checkExists( qvec[0], "gd_drives", "host_shortname", "drive_label", qvec[1]); std::stringstream qqquery; if( ex ) { qqquery << "UPDATE `" << dbname << "`.`gd_drives` SET spool_number=" << mysqlpp::quote_only << qvec[2]; qqquery << ", drive_status=" << mysqlpp::quote_only << qvec[3] <<", spool_status='" << mysqlpp::quote_only; qqquery << qvec[5]; qqquery << "', pending_sectors=" << mysqlpp::quote_only << qvec[6]; qqquery << ", reallocated_sectors=" << mysqlpp::quote_only << qvec[7]; qqquery << "WHERE host_shortname=" << mysqlpp::quote_only << qvec[0]; qqquery << " AND drive_label=" << mysqlpp::quote_only << qvec[1] << ";"; std::string fquery = qqquery.str(); qqquery.str(""); _logger.logstream << "Calling SQL statement '" << fquery << "'.;"; _logger.log( 1 ); update( fquery ); } else { qqquery << "INSERT INTO `" << dbname << "`.`gd_drives` VALUES ( " << mysqlpp::quote_only << "Hard Drive"; qqquery << ", " << "'" << qvec[0] << "/" << qvec[1] << "', " << mysqlpp::quote_only << qvec[8]; qqquery << ", " << mysqlpp::quote_only << qvec[0] << ", " << mysqlpp::quote_only << qvec[1]; qqquery << ", " << mysqlpp::quote_only << "0"; qqquery << ", " << mysqlpp::quote_only << qvec[2]; qqquery << ", " << mysqlpp::quote_only << qvec[3]; qqquery << ", " << mysqlpp::quote_only << qvec[5] << ", " << mysqlpp::quote_only << qvec[4]; qqquery << ", " << mysqlpp::quote_only << qvec[6] << ", " << mysqlpp::quote_only << qvec[7]; qqquery << ", " << mysqlpp::quote_only << "0" << ", '1'"; qqquery << ");"; std::string ffquery = qqquery.str(); qqquery.str(""); _logger.logstream << "Calling SQL Statement '" << ffquery << "'."; _logger.log( 1 ); insert( ffquery ); } }
void PlaylistItem::setFilestatusEnabled( bool enabled ) { m_filestatusEnabled = enabled; checkExists(); setEnabled(); }