本文整理汇总了C++中StringList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::empty方法的具体用法?C++ StringList::empty怎么用?C++ StringList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setModifications
void ModificationDefinitionsSet::setModifications(const StringList & fixed_modifications, const StringList & variable_modifications)
{
fixed_mods_.clear();
variable_mods_.clear();
if (!fixed_modifications.empty())
{
for (StringList::const_iterator it = fixed_modifications.begin(); it != fixed_modifications.end(); ++it)
{
ModificationDefinition def;
def.setModification(*it);
def.setFixedModification(true);
fixed_mods_.insert(def);
}
}
if (!variable_modifications.empty())
{
for (StringList::const_iterator it = variable_modifications.begin(); it != variable_modifications.end(); ++it)
{
ModificationDefinition def;
def.setModification(*it);
def.setFixedModification(false);
variable_mods_.insert(def);
}
}
}
示例2: InstanceDecorator
// Attempts to instance a decorator into a given list.
bool ElementDefinition::InstanceDecorator(const String& name, const String& type, const PropertyDictionary& properties, const StringList& pseudo_classes)
{
Decorator* decorator = Factory::InstanceDecorator(type, properties);
if (decorator == NULL)
{
Log::Message(Log::LT_WARNING, "Failed to instance decorator '%s' of type '%s'.", name.CString(), type.CString());
return false;
}
if (pseudo_classes.empty())
{
if (decorator != NULL)
decorators[name] = decorator;
}
else
{
PseudoClassDecoratorMap::iterator i = pseudo_class_decorators.find(pseudo_classes);
if (i == pseudo_class_decorators.end())
{
DecoratorMap decorators;
decorators[name] = decorator;
pseudo_class_decorators[pseudo_classes] = decorators;
}
else
(*i).second[name] = decorator;
}
return true;
}
示例3: setPrimaryMSRunPath
/// set the file path to the primary MS run (usually the mzML file obtained after data conversion from raw files)
void FeatureMap::setPrimaryMSRunPath(const StringList& s)
{
if (!s.empty())
{
this->setMetaValue("spectra_data", DataValue(s));
}
}
示例4: handleFindDupePaths
api_return ShareApi::handleFindDupePaths(ApiRequest& aRequest) {
const auto& reqJson = aRequest.getRequestBody();
json ret;
StringList paths;
auto path = JsonUtil::getOptionalField<string>("path", reqJson, false, false);
if (path) {
paths = ShareManager::getInstance()->getDirPaths(Util::toNmdcFile(*path));
} else {
auto tth = Deserializer::deserializeTTH(reqJson);
paths = ShareManager::getInstance()->getRealPaths(tth);
}
if (!paths.empty()) {
for (const auto& p : paths) {
ret.push_back(p);
}
} else {
ret = json::array();
}
aRequest.setResponseBody(ret);
return websocketpp::http::status_code::ok;
}
示例5: getParam
bool AdcCommand::getParam(const char* name, size_t start, StringList& ret) const {
for(string::size_type i = start; i < getParameters().size(); ++i) {
if(toCode(name) == toCode(getParameters()[i].c_str())) {
ret.push_back(getParameters()[i].substr(2));
}
}
return !ret.empty();
}
示例6: switchCurrentAudioDeviceToWenbox
void WenboxPlugin::switchCurrentAudioDeviceToWenbox() {
Config & config = ConfigManager::getInstance().getCurrentConfig();
//Looks for the Wenbox audio device from the list of devices from the OS
StringList wenboxAudioDeviceId = getWenboxOutputAudioDeviceId();
if (!wenboxAudioDeviceId.empty()) {
//Changes audio settings
config.set(Config::WENBOX_AUDIO_OUTPUT_DEVICEID_KEY, wenboxAudioDeviceId);
config.set(Config::WENBOX_AUDIO_RINGER_DEVICEID_KEY, wenboxAudioDeviceId);
}
wenboxAudioDeviceId = getWenboxInputAudioDeviceId();
if (!wenboxAudioDeviceId.empty()) {
//Changes audio settings
config.set(Config::WENBOX_AUDIO_INPUT_DEVICEID_KEY, wenboxAudioDeviceId);
}
}
示例7: getHubNames
QString WulforUtil::getHubNames(const dcpp::CID &cid){
StringList hubs = ClientManager::getInstance()->getHubNames(cid, "");
if (hubs.empty())
return tr("Offline");
else
return _q(Util::toString(hubs));
}
示例8: getChildsStatement
void EntitiesEntity::getChildsStatement(const shared_ptr<IPortalDatabase> &database, const ObjectsTypes &types, const RangeUint32 &range, bool count, bool includeSystem, bool includeInvisible, shared_ptr<DbSqlSelect> &statement) const
{
OS_LOCK(m_cs);
// Nota: qui bisogna specificare sempre la tabella perch dall'esterno la select pu essere messa in join con altre tabelle
shared_ptr<DbSqlSelect> select(OS_NEW DbSqlSelect(DBTABLES::SNAPSHOT_OBJECTS_TABLE));
if(count)
select->count = true;
else
select->fields.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::ENTITY, DBTABLES::SNAPSHOT_OBJECTS_TABLE));
database->getPortal()->getSnapshotManager()->ensureChilds(database, getEntityID());
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::PARENT, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(getEntityID()));
// Genera il filtro sui tipi di figli
StringList childsTypes;
for(ObjectsTypes::const_iterator i = types.begin(); i != types.end(); ++i)
{
if((*i) != portalObjectTypeUnknown)
childsTypes.push_back(Convert::toSQL(static_cast<uint32>(*i)));
}
// Se stato specificato un filtro sul tipo di figli lo applica
if(childsTypes.empty() == false)
{
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::TYPE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), childsTypes);
}
// Includi le sezioni di sistema (virtuali)?
// Sono figlie della root, per cui la condizione ha senso solo in quel caso
if(getEntityID() == ObjectsSystem::instance()->getRootID())
{
if(includeSystem == true)
{
// Salta la root stessa
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::ENTITY, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(ObjectsSystem::instance()->getRootID()), DbSqlCondition::cfDifferent | DbSqlCondition::cfAnd);
}
else
{
// VERYURGENT: Le classi statement non hanno una "not in"... poco male, ma userebbe meglio l'indice.
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::INSERT_DATE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(DateTime::EMPTY), DbSqlCondition::cfDifferent | DbSqlCondition::cfAnd);
}
}
if(includeInvisible == false)
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::VISIBLE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(true));
uint32 size = range.size();
if(size != 0)
select->limit.setCount(size);
uint32 start = range.start();
if(start != 0)
select->limit.setOffset(start);
statement = select;
}
示例9: GetUserChannels
// Get user channels.
void meth::GetUserChannels(LogicalConnections::iterator conn, String &response) {
StringList channels = ::GetUserChannels(GetConnectionUserName(conn));
if (!channels.empty()) {
response = "[" + implode(channels) + "]";
} else {
response = "null";
}
}
示例10: joinComponents
String AbstractFileManager::joinComponents(const StringList& pathComponents) {
if (pathComponents.empty())
return "";
StringStream result;
for (unsigned int i = 0; i < pathComponents.size() - 1; i++)
result << pathComponents[i] << pathSeparator();
result << pathComponents.back();
return result.str();
}
示例11: loadProgram
Program::Pointer ProgramFactory::loadProgram(const std::string& file, ObjectsCache& cache,
const StringList& defines)
{
auto cachedPrograms = cache.findObjects(file);
for (Program::Pointer cached : cachedPrograms)
{
if (cached.valid())
{
if (cached->defines().size() == defines.size())
{
bool same = true;
for (auto& inDefine : defines)
{
for (auto& cDefine : cached->defines())
{
if (inDefine != cDefine)
{
same = false;
break;
}
if (!same)
break;
}
}
if (same)
return cached;
}
}
}
std::string vertex_shader;
std::string geom_shader;
std::string frag_shader;
StringList sourceFiles = loadProgramSources(file, vertex_shader, geom_shader, frag_shader);
if (sourceFiles.empty())
return Program::Pointer::create(renderContext());
std::string workFolder = getFilePath(file);
parseSourceCode(ShaderType_Vertex, vertex_shader, defines, workFolder);
parseSourceCode(ShaderType_Geometry, geom_shader, defines, workFolder);
parseSourceCode(ShaderType_Fragment, frag_shader, defines, workFolder);
Program::Pointer program = Program::Pointer::create(renderContext(), vertex_shader, geom_shader,
frag_shader, getFileName(file), file, defines);
for (auto& s : sourceFiles)
program->addOrigin(s);
cache.manage(program, _private->loader);
return program;
}
示例12: getParams
void Transfer::getParams(const UserConnection& aSource, StringMap& params) {
params["userCID"] = aSource.getUser()->getCID().toBase32();
params["userNI"] = Util::toString(ClientManager::getInstance()->getNicks(aSource.getUser()->getCID(), aSource.getHubUrl()));
params["userI4"] = aSource.getRemoteIp();
StringList hubNames = ClientManager::getInstance()->getHubNames(aSource.getUser()->getCID(), aSource.getHubUrl());
if(hubNames.empty())
hubNames.push_back(_("Offline"));
params["hub"] = Util::toString(hubNames);
StringList hubs = ClientManager::getInstance()->getHubs(aSource.getUser()->getCID(), aSource.getHubUrl());
if(hubs.empty())
hubs.push_back(_("Offline"));
params["hubURL"] = Util::toString(hubs);
params["fileSI"] = Util::toString(getSize());
params["fileSIshort"] = Util::formatBytes(getSize());
params["fileSIactual"] = Util::toString(getActual());
params["fileSIactualshort"] = Util::formatBytes(getActual());
params["speed"] = str(F_("%1%/s") % Util::formatBytes(getAverageSpeed()));
params["time"] = Util::formatSeconds((GET_TICK() - getStart()) / 1000);
params["fileTR"] = getTTH().toBase32();
}
示例13: displayOpenTag
void
herschel::xml::displayStringList(Port<Octet>& port,
zstring outerTagName, zstring tagName,
const StringList& strlist)
{
if (!strlist.empty())
displayOpenTag(port, outerTagName);
for (StringList::const_iterator it = strlist.begin();
it != strlist.end();
it++)
{
String str = (*it);
displayOpenTag(port, tagName, !K(newline));
herschel::display(port, str);
displayCloseTag(port, tagName);
}
if (!strlist.empty())
displayCloseTag(port, outerTagName);
}
示例14: main_
ExitCodes main_(int, const char**) override
{
StringList in = getStringList_("in");
StringList out = getStringList_("out");
bool inplace = getFlag_("i");
// consistency checks
if (out.empty() && !inplace)
{
writeLog_("Cannot write output files, as neither -out nor -i are given. Use either of them, but not both!");
printUsage_();
return ILLEGAL_PARAMETERS;
}
if (out.size() > 0 && inplace)
{
writeLog_("Two incompatible arguments given (-out and -i). Use either of them, but not both!");
printUsage_();
return ILLEGAL_PARAMETERS;
}
if (!inplace && out.size() != in.size())
{
writeLog_("Output and input file list length must be equal!");
printUsage_();
return ILLEGAL_PARAMETERS;
}
// do the conversion!
FileHandler fh;
for (Size i = 0; i < in.size(); ++i)
{
FileTypes::Type f_type = fh.getType(in[i]);
if (f_type == FileTypes::INI) updateINI(in[i], inplace ? "" : out[i]);
else if (f_type == FileTypes::TOPPAS) updateTOPPAS(in[i], inplace ? "" : out[i]);
}
for (Size i = 0; i < tmp_files_.size(); ++i)
{
// clean up
File::remove(tmp_files_[i]);
}
if (failed_.size() > 0)
{
writeLog_("The following INI/TOPPAS files could not be updated:\n " + ListUtils::concatenate(failed_, "\n "));
return INPUT_FILE_CORRUPT;
}
return EXECUTION_OK;
}
示例15: resolvePath
StringList AbstractFileManager::resolvePath(const StringList& pathComponents) {
StringList cleanComponents;
for (unsigned int i = 0; i < pathComponents.size(); i++) {
const String& component = pathComponents[i];
if (component != ".") {
if (component == ".." && !cleanComponents.empty())
cleanComponents.pop_back();
else
cleanComponents.push_back(component);
}
}
return cleanComponents;
}