void CheatFeedback(int16_t whichCheat, bool activate, Handle<Admiral> whichPlayer) { String admiral_name(GetAdmiralName(whichPlayer)); String feedback; if (activate) { feedback.assign(StringList(kCheatFeedbackOnID).at(whichCheat - 1)); } else { feedback.assign(StringList(kCheatFeedbackOffID).at(whichCheat - 1)); } Messages::add(format("{0}{1}", admiral_name, feedback)); }
LDAPObjClass::LDAPObjClass(){ DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPObjClass::LDAPObjClass( )" << endl); oid = string (); desc = string (); names = StringList (); must = StringList(); may = StringList(); sup = StringList(); }
bool LDAPExpr::IsSimple(const StringList& keywords, LocalCache& cache, bool matchCase ) const { if (cache.empty()) { cache.resize(keywords.size()); } if (d->m_operator == EQ) { StringList::const_iterator index; if ((index = std::find(keywords.begin(), keywords.end(), matchCase ? d->m_attrName : ToLower(d->m_attrName))) != keywords.end() && d->m_attrValue.find_first_of(WILDCARD) == std::string::npos) { cache[index - keywords.begin()] = StringList(1, d->m_attrValue); return true; } } else if (d->m_operator == OR) { for (std::size_t i = 0; i < d->m_args.size( ); i++) { if (!d->m_args[i].IsSimple(keywords, cache, matchCase)) return false; } return true; } return false; }
void OneSidedXData::togglePageLayout(XDataPtr& target) const { XDataPtr newXData(new TwoSidedXData(_name)); newXData->setNumPages( (_numPages+1)/2); newXData->setSndPageTurn(_sndPageTurn); // Add default guiPage to all guiPage-entries. newXData->setGuiPage( StringList( newXData->getNumPages(), DEFAULT_TWOSIDED_GUI) ); // Reshuffle the TwoSided pages contents into the OneSided page contents. for (std::size_t n = 0; n < newXData->getNumPages()-1; n++) { newXData->setPageContent(Title, n, Left, _pageTitle[2*n] ); newXData->setPageContent(Body, n, Left, _pageBody[2*n] ); newXData->setPageContent(Title, n, Right, _pageTitle[2*n+1] ); newXData->setPageContent(Body, n, Right, _pageBody[2*n+1] ); } newXData->setPageContent(Title, newXData->getNumPages()-1, Left, _pageTitle[2*(newXData->getNumPages()-1)] ); newXData->setPageContent(Body, newXData->getNumPages()-1, Left, _pageBody[2*(newXData->getNumPages()-1)] ); if ( (_numPages % 2) == 0) { // Prevent vector subscript exceeded. newXData->setPageContent(Title, newXData->getNumPages()-1, Right, _pageTitle[_numPages-1] ); newXData->setPageContent(Body, newXData->getNumPages()-1, Right, _pageBody[_numPages-1] ); } target = newXData; }
StringList DirectoryListing::getLocalPaths(const Directory* d) const { try { return ShareManager::getInstance()->getRealPaths(Util::toAdcFile(getPath(d))); } catch(const ShareException&) { return StringList(); } }
const StringList RosterItem::groups() const { if( m_data ) return m_data->groups(); else return StringList(); }
int findAllVariants(String const &packageId, FS::FoundFiles &found) const { QStringList const components = packageId.split('.'); String id; // The package may actually be inside other packages, so we need to check // each component of the package identifier. for(int i = components.size() - 1; i >= 0; --i) { id = components.at(i) + (!id.isEmpty()? "." + id : ""); FS::FoundFiles files; App::fileSystem().findAllOfTypes(StringList() << DENG2_TYPE_NAME(Folder) << DENG2_TYPE_NAME(ArchiveFolder), id + ".pack", files); files.remove_if(PackageIdentifierDoesNotMatch(packageId)); std::copy(files.begin(), files.end(), std::back_inserter(found)); } return int(found.size()); }
int main(int argc, char *argv[]) { const char *config_file = "bonway.conf"; StringList types = StringList(); int c; while ((c = getopt(argc, argv, "hc:")) != -1) { switch (c) { case 'h': show_help(); return 1; case 'c': config_file = optarg; break; case '?': fprintf(stderr, "Unknown option '-%c'.\r\n", optopt); show_help(); return 1; default: abort(); } } if (parse_config(config_file) != true) return 1; std::list<ConfigService> cs = config_services(); std::list<ConfigService>::const_iterator csit; for (csit = cs.begin(); csit != cs.end(); csit++) { StringList::const_iterator sit; for (sit = (*csit).type.begin(); sit != (*csit).type.end(); sit++) { StringList::const_iterator it; it = std::find(types.begin(), types.end(), *sit); if (it == types.end()) { types.push_back(*sit); std::cout << *sit << std::endl; } } } avahi = new Avahi::Avahi(); StringList::const_iterator sit; for (sit = types.begin(); sit != types.end(); sit++) { Avahi::Browser *browser = avahi->Browse((*sit).c_str(), "", NULL); browser->new_service = service_new; } int result = avahi->Run(); fprintf(stderr, "Result = %d\r\n", result); delete avahi; return 0; }
StringList ExternalProcess::Environment() const { StringList environment; if ( (*API->ExternalProcess->EnumerateExternalProcessEnvironment)( handle, ExternalProcessPrivate::EnvironmentEnumerationCallback, &environment ) == api_false ) return StringList(); return environment; }
WebCLConfiguration::WebCLConfiguration() : typePrefix_("_Wcl") , variablePrefix_("_wcl") , macroPrefix_("_WCL") , minSuffix_("min") , maxSuffix_("max") , indentation_(" ") , sizeParameterType_("ulong") , privateAddressSpace_("private") , localAddressSpace_("local") , constantAddressSpace_("constant") , globalAddressSpace_("global") , privateRecordType_(typePrefix_ + "Privates") , localRecordType_(typePrefix_ + "Locals") , constantRecordType_(typePrefix_ + "Constants") , globalRecordType_(typePrefix_ + "Globals") , addressSpaceRecordType_(typePrefix_ + "ProgramAllocations") , localLimitsType_(typePrefix_ + "LocalLimits") , constantLimitsType_(typePrefix_ + "ConstantLimits") , globalLimitsType_(typePrefix_ + "GlobalLimits") , localMinField_(variablePrefix_ + "_locals_min") , localMaxField_(variablePrefix_ + "_locals_max") , constantMinField_(variablePrefix_ + "_constant_allocations_min") , constantMaxField_(variablePrefix_ + "_constant_allocations_max") , privatesField_("pa") , localLimitsField_("ll") , constantLimitsField_("cl") , globalLimitsField_("gl") , localRecordName_(variablePrefix_ + "_locals") , constantRecordName_(variablePrefix_ + "_constant_allocations") , programRecordName_(variablePrefix_ + "_allocations_allocation") , addressSpaceRecordName_(variablePrefix_ + "_allocs") , nullType_("uint") , privateNullField_("pn") , localNullField_("ln") , constantNullField_("cn") , globalNullField_("gn") , localRangeZeroingMacro_(macroPrefix_ + "_LOCAL_RANGE_INIT") , dataWidths_(addValue(generateWidths(2, 16), 3)) // this may be a little bit ridiculous but at least we get a constant list initialized , roundingModes_(addValue(addValue(addValue(addValue(StringList(), "rte"), "rtz"), "rtp"), "rtn")) , localVariableRenamer_(variablePrefix_ + "_", "_") , privateVariableRenamer_(variablePrefix_ + "_", "_") , typedefRenamer_("", "") , anonymousStructureRenamer_(typePrefix_, "") { }
void ClientManager::search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) { Lock l(cs); for(auto i: clients) { if(i->isConnected()) { i->search(aSizeMode, aSize, aFileType, aString, aToken, StringList() /*ExtList*/); } } }
bool ShareManager::SearchQuery::hasExt(const string& name) { if(ext.empty()) return true; if(!noExt.empty()) { ext = StringList(ext.begin(), set_difference(ext.begin(), ext.end(), noExt.begin(), noExt.end(), ext.begin())); noExt.clear(); } auto fileExt = Util::getFileExt(name); return !fileExt.empty() && std::find(ext.cbegin(), ext.cend(), Text::toLower(fileExt.substr(1))) != ext.cend(); }
LDAPAttrType::LDAPAttrType(){ DEBUG(LDAP_DEBUG_CONSTRUCT, "LDAPAttrType::LDAPAttrType( )" << endl); oid = string (); desc = string (); names = StringList (); single = false; usage = 0; }
void registerOptionsAndFlags_() { registerInputFile_("in", "<file>", "", "Input file (see below for details)"); setValidFormats_("in", ListUtils::create<String>("mzML,idXML,featureXML,consensusXML")); registerOutputFileList_("out", "<file(s)>", StringList(), "Output file(s)"); setValidFormats_("out", ListUtils::create<String>("featureXML")); addEmptyLine_(); registerFlag_("use_peptide_mass", "[idXML input only] Use the monoisotopic mass of the best peptide hit for the m/z position (default: use precursor m/z)"); }
StringList ClientManager::getNicks(const CID& cid) const { Lock l(cs); StringSet ret; OnlinePairC op = onlineUsers.equal_range(cid); for(auto i = op.first; i != op.second; ++i) { ret.insert(i->second->getIdentity().getNick()); } if(ret.empty()) { ret.insert(getOfflineNick(cid)); } return StringList(ret.begin(), ret.end()); }
bool SearchQuery::hasExt(const string& name) noexcept { if(ext.empty()) return true; if(!noExt.empty()) { ext = StringList(ext.begin(), set_difference(ext.begin(), ext.end(), noExt.begin(), noExt.end(), ext.begin())); noExt.clear(); } for(const auto& i: ext) { if (name.length() >= i.length() && name.compare(name.length() - i.length(), i.length(), i.c_str()) == 0) return true; } return false; }
void DictClient::lookup_with_fuzzy(const gchar *word) { simple_lookup_ = false; if (!word || !*word) { on_complex_lookup_end_.emit(StringList()); return; } if (!channel_ || !source_id_) return; connect(); cmd_.reset(new LevCmd("*", word)); }
StringList ClientManager::getNicks(const CID& cid) const { Lock l(cs); StringSet nicks; OnlinePairC op = onlineUsers.equal_range(cid); for(OnlineIterC i = op.first; i != op.second; ++i) { nicks.insert(i->second->getIdentity().getNick()); } if(nicks.empty()) { // Offline perhaps? UserMap::const_iterator i = users.find(cid); if(i != users.end() && !i->second->getFirstNick().empty()) { nicks.insert(i->second->getFirstNick()); } else { nicks.insert('{' + cid.toBase32() + '}'); } } return StringList(nicks.begin(), nicks.end()); }
bool VDispatcher::readMsg(StringList& datas){ StringList tmp_datas; while (m_com->readData(tmp_datas)) { const String& Msg_ID=tmp_datas[0]; if (m_serialIDSet.count(Msg_ID)>0) ++m_isSerialStrikeMsg; m_dataList.push_back(StringList()); m_dataList.back().swap(tmp_datas); }; if (m_isBarrageMsg>0) return false; while (m_dataList.size()>0) { if (m_dataList[0].size()==0) m_dataList.pop_front(); else break; } long size=(long)m_dataList.size(); long i = 0; while (i<size) { StringList& Msg =m_dataList[i]; if (Msg.size()==0) { ++i; }else{ const String& Msg_ID=Msg[0]; if ((i > 0) && (m_serialIDSet.count(Msg_ID) > 0)) return false; if (getIsCanDisposeMsg(Msg_ID)) { if (m_serialIDSet.count(Msg_ID)>0) --m_isSerialStrikeMsg; datas.swap(Msg); Msg.resize(0); //del return true; }else ++i; } } return false; }
StringList ToolHandler::getTypes(const String& toolname) { // for internal tools, query TOPP and UTILS for a match Internal::ToolDescription ret; if (getUtilList().has(toolname)) { return getUtilList()[toolname].types; } else { ToolListType tools; if (toolname == "GenericWrapper") tools = getTOPPToolList(true); else tools = getTOPPToolList(); if (tools.has(toolname)) { return tools[toolname].types; } } throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "Requested toolname '" + toolname + " does not exist!", toolname); return StringList(); }
void TwoSidedXData::togglePageLayout(XDataPtr& target) const { XDataPtr newXData(new OneSidedXData(_name)); newXData->setNumPages(_numPages*2); //delete last page if no content later. newXData->setSndPageTurn(_sndPageTurn); // Add default guiPage to all guiPage-entries. newXData->setGuiPage( StringList( newXData->getNumPages(), DEFAULT_ONESIDED_GUI) ); // Reshuffle the TwoSided pages contents into the OneSided page contents. for (std::size_t n = 0; n < _numPages; n++) { newXData->setPageContent(Title, 2*n, Left, _pageLeftTitle[n] ); newXData->setPageContent(Body, 2*n, Left, _pageLeftBody[n] ); newXData->setPageContent(Title, 2*n+1, Left, _pageRightTitle[n] ); newXData->setPageContent(Body, 2*n+1, Left, _pageRightBody[n] ); } if ( (_pageRightTitle[_numPages-1] == "") && (_pageRightBody[_numPages-1] == "") ) // Last page is empty. Set new numpages accordingly. newXData->setNumPages(newXData->getNumPages()-1); target = newXData; }
void LDAPAttrType::setNames ( char **at_names ) { names = StringList(at_names); }
void LDAPObjClass::setSup (char **oc_sup) { sup = StringList (oc_sup); }
void LDAPObjClass::setMay (char **oc_may) { may = StringList (oc_may); }
void LDAPObjClass::setMust (char **oc_must) { must = StringList (oc_must); }
void LDAPObjClass::setNames (char **oc_names) { names = StringList (oc_names); }
void ClArgs::unintialize() { StringList().swap(args_); StringList().swap(lc_args_); }
// Builds the properties of all of the pseudo-classes of this style sheet node into a single map. void StyleSheetNode::GetPseudoClassProperties(PseudoClassPropertyMap& pseudo_class_properties) const { for (NodeMap::const_iterator i = children[PSEUDO_CLASS].begin(); i != children[PSEUDO_CLASS].end(); ++i) (*i).second->GetPseudoClassProperties(pseudo_class_properties, StringList()); }
RosterItem::RosterItem( const std::string& jid, const std::string& name ) : m_data( new RosterItemData( JID( jid ), name, StringList() ) ) { }
StringList StringListOperations::Apply(const StringList& inputList, size_t maxSize, const behavior::Behavior& behavior) const { if (!HasOperations()) return inputList.SubList(0, maxSize); uint32_t operations = fOperations; bool hasSelectorOperation = (operations & PATH_PART_SELECTOR_MASK) != 0; bool hasPathPartOperation = hasSelectorOperation || (operations & (PATH_PART_REPLACER_MASK | TO_PARENT_DIRECTORY)) != 0; if (hasPathPartOperation && !hasSelectorOperation) { // Only replacer operations. Continue as if all path parts are selected. operations |= PATH_PART_SELECTOR_MASK; } // If a join shall be performed before to-upper/to-lower, we simply convert // the join parameter first and join as usual afterwards. String joinParameterBuffer; StringPart joinParameter = fJoinParameter; if (!joinParameter.IsEmpty() && (operations & (TO_UPPER | TO_LOWER)) != 0 && behavior.GetJoinCaseOperator() == behavior::Behavior::JOIN_BEFORE_CASE_OPERATOR) { joinParameterBuffer = joinParameter; if ((operations & TO_UPPER) != 0) joinParameterBuffer.ToUpper(); else joinParameterBuffer.ToLower(); joinParameter = joinParameterBuffer; } StringList resultList; StringBuffer buffer; const StringList& list = inputList.IsEmpty() && (operations & REPLACE_EMPTY) != 0 ? StringList(String(fEmptyParameter)) : inputList; size_t count = std::min(list.Size(), maxSize); for (size_t i = 0; i < count; i++) { String string = list.ElementAt(i); size_t bufferSizeBeforeElement = buffer.Length(); // If any of the file name/path part selectors/replacers need to be // applied, we disassemble the string, make the modifications, and // reassemble it. if (hasPathPartOperation) { Path::Parts parts(string); if ((operations & REPLACE_GRIST) != 0) parts.SetGrist(fGristParameter); else if ((operations & SELECT_GRIST) == 0) parts.UnsetGrist(); if ((operations & REPLACE_ROOT) != 0) parts.SetRoot(fRootParameter); else if ((operations & SELECT_ROOT) == 0) parts.UnsetRoot(); if ((operations & REPLACE_DIRECTORY) != 0) parts.SetDirectory(fDirectoryParameter); else if ((operations & SELECT_DIRECTORY) == 0) parts.UnsetDirectory(); if ((operations & REPLACE_BASE_NAME) != 0) parts.SetBaseName(fBaseNameParameter); else if ((operations & SELECT_BASE_NAME) == 0) parts.UnsetBaseName(); if ((operations & REPLACE_SUFFIX) != 0) parts.SetSuffix(fSuffixParameter); else if ((operations & SELECT_SUFFIX) == 0) parts.UnsetSuffix(); if ((operations & REPLACE_ARCHIVE_MEMBER) != 0) parts.SetArchiveMember(fArchiveMemberParameter); else if ((operations & SELECT_ARCHIVE_MEMBER) == 0) parts.UnsetArchiveMember(); if ((operations & TO_PARENT_DIRECTORY) != 0) { parts.UnsetBaseName(); parts.UnsetSuffix(); parts.UnsetArchiveMember(); } parts.GetPath(buffer, behavior); } else buffer += string; if ((operations & TO_UPPER) != 0) { char* toConvert = buffer.Data() + bufferSizeBeforeElement; char* end = buffer.Data() + buffer.Length(); std::transform(toConvert, end, toConvert, ::toupper); } else if ((operations & TO_LOWER) != 0) { char* toConvert = buffer.Data() + bufferSizeBeforeElement; char* end = buffer.Data() + buffer.Length(); std::transform(toConvert, end, toConvert, ::tolower); } if ((operations & JOIN) != 0) { if (i + 1 < count) buffer += joinParameter; } else { resultList.Append(buffer); buffer = StringPart(); } } if ((operations & JOIN) != 0 && count > 0) { // Append the joined value, if we're not emulating the broken behavior // of jam. if (behavior.GetBrokenSubscriptJoin() == behavior::Behavior::NO_BROKEN_SUBSCRIPT_JOIN || count == list.Size()) { resultList.Append(buffer); } } return resultList; }