本文整理汇总了C++中qstringlist::iterator::toStdString方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::toStdString方法的具体用法?C++ iterator::toStdString怎么用?C++ iterator::toStdString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstringlist::iterator
的用法示例。
在下文中一共展示了iterator::toStdString方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotImportMeshModels
void SceneWidget::slotImportMeshModels(void) {
MainWindow* main_window = MainWindow::getInstance();
QStringList filenames = QFileDialog::getOpenFileNames(main_window, "Import Mesh Models", main_window->getWorkspace().c_str(),
"Mesh Models (*.off *.ply *.obj)");
if (filenames.isEmpty())
return;
bool flag = true;
std::string failed_list;
for (QStringList::iterator it = filenames.begin(); it != filenames.end(); ++it) {
osg::ref_ptr<MeshModel> mesh_model(new MeshModel());
if (mesh_model->load(it->toStdString())) {
mesh_models_.push_back(mesh_model);
addSceneChild(mesh_model);
} else {
flag = false;
LOG(ERROR) << "Importing " << it->toStdString() << " failed!" << std::endl;
failed_list += it->toStdString() + " ";
}
}
if (!flag) {
main_window->showMessageBox("Some mesh importing failed!", failed_list);
}
centerScene();
return;
}
示例2:
std::vector<std::string> GMSHPrefsDialog::getSelectedObjects(QStringList list)
{
std::vector<std::string> indexList;
for (QStringList::iterator it = list.begin(); it != list.end(); ++it)
indexList.push_back(it->toStdString());
return indexList;
}
示例3: loadAll
bool LuaList::loadAll()
{
std::cout << "[Lua] loading all script files from " << _filePath.toStdString() << std::endl;
// get everything with ".lua"
QStringList files;
QDirIterator dirIt(_filePath);
while (dirIt.hasNext()) {
dirIt.next();
if (QFileInfo(dirIt.filePath()).isFile())
if (QFileInfo(dirIt.filePath()).suffix() == "lua")
files.append(dirIt.fileName());
}
std::cout << "[Lua] loading all script files from " << _templateFilePath.toStdString() << std::endl;
// get everything with ".lua"
QDirIterator dirIt2(_templateFilePath);
while (dirIt2.hasNext()) {
dirIt2.next();
if (QFileInfo(dirIt2.filePath()).isFile())
if (QFileInfo(dirIt2.filePath()).suffix() == "lua")
if(!files.contains(dirIt2.fileName(), Qt::CaseInsensitive))
files.append(dirIt2.fileName());
}
if(!_luaList.empty())
// clear list before loading
clearList();
// load lua files
for( QStringList::iterator it = files.begin(); it != files.end(); ++it)
{
LuaContainer* c = new LuaContainer();
std::cout << "[Lua] loading file " << it->toStdString() << " ..." << std::endl;
if(load((*it), c))
_luaList.push_back(c);
else
std::cerr << "[Lua] can't load file " << it->toStdString() << std::endl;
}
if(_luaList.empty())
return false;
else
return true;
}
示例4: bt_ok_clicked
void SignatureDialog::bt_ok_clicked()
{
m_ok_clicked = true;
QMap<QString, QString> options;
m_data_layout->options(options, true);
QMap<QString, XmlNode>::iterator it = m_nodes.begin();
for( ; it != m_nodes.end() ; it++)
{
XmlNode & optionNode = it.value();
if( Map::is_single_value(optionNode) )
{
XmlNode node( optionNode.content->first_node() );
const std::string value = options[it.key()].toStdString().c_str();
node.content->value( node.content->document()->allocate_string(value.c_str(), value.size()+1), value.size() );
}
else
{
QStringList value = options[it.key()].split(";");
QStringList::iterator itValue = value.begin();
std::string delim(optionNode.content->first_attribute( Protocol::Tags::attr_array_delimiter() )->value());
std::string val_str;
rapidxml::xml_node<char>* node = it.value().content;
for( ; itValue != value.end() ; itValue++)
{
if(!val_str.empty())
val_str += delim;
val_str += itValue->toStdString();
}
node->value( node->document()->allocate_string(val_str.c_str()) );
it.value().set_attribute(Protocol::Tags::attr_array_size(), QString::number(value.count()).toStdString());
}
}
emit finished(QDialog::Accepted);
if(m_is_blocking)
this->setVisible(false);
}
示例5: generateSelectAttribute
void synaxErrorJudger::generateSelectAttribute()
{
int begin = sqlExp.indexOf("select") + 6;
int end = sqlExp.indexOf("from") - 1;
QStringList selectAttrs = sqlExp.mid(begin, end - begin + 1).split(',');
QStringList::iterator it;
for (it = selectAttrs.begin(); it != selectAttrs.end(); ++it) {
*it = it->trimmed();
if (*it == "") {
throw QString("Synax Error: Select statement's format is incorrect.");
}
if (selectAttribute == 0) {
selectAttribute = new vector<string>;
}
selectAttribute->push_back(it->toStdString());
}
}
示例6: loadIcon_
QIcon* IconLoader::loadIcon_(const String& name)
{
const QString filename = QString(name.c_str()) + ".png";
for (QStringList::iterator it = icon_dirs_.begin(); it != icon_dirs_.end(); ++it)
{
QDir base_dir(*it);
if (!base_dir.exists())
{
Log.error() << "Could not locate the icon directory: " << it->toStdString() << std::endl;
return 0;
}
QString category_name;
QIcon* result = 0;
for(std::list<int>::iterator sit = sizes_.begin(); sit != sizes_.end(); ++sit)
{
QDir size_dir = *it + FileSystem::PATH_SEPARATOR + QString::number(*sit) + "x" + QString::number(*sit);
if (!size_dir.exists())
{
continue;
}
if (size_dir.exists(filename))
{
if (!result)
{
result = new QIcon();
}
result->addFile(size_dir.path() + FileSystem::PATH_SEPARATOR + filename);
}
}
if (result)
{
icon_map_[name] = result;
return result;
}
}
return 0;
}
示例7: tr
void HIC::WMain::loadLinkTypes()
{
QString linktypeDirPath = QCoreApplication::applicationDirPath() + tr("/linktypes/");
QDir linktypeDir = QDir(linktypeDirPath);
QStringList nameFilters;
nameFilters.append(QString("*.linktype"));
QStringList fileList = linktypeDir.entryList(nameFilters);
std::vector<std::string> linkTypeFilePaths;
for (QStringList::iterator iterator = fileList.begin(); iterator != fileList.end(); iterator++)
{
linkTypeFilePaths.push_back(iterator->toStdString());
}
QDir::setCurrent(linktypeDirPath);
_application.loadLinkTypeList(linkTypeFilePaths);
QDir::setCurrent(QCoreApplication::applicationDirPath());
}
示例8: Name
ChatroomInfo
ChatDialog::getChatroomInfo()
{
ChatroomInfo chatroomInfo;
chatroomInfo.setName(Name::Component(m_chatroomName));
QStringList prefixList = m_scene->getRosterPrefixList();
for(QStringList::iterator it = prefixList.begin();
it != prefixList.end(); ++it ) {
Name participant = Name(it->toStdString()).getPrefix(-3);
chatroomInfo.addParticipant(participant);
}
chatroomInfo.setSyncPrefix(m_chatroomPrefix);
if (m_isSecured)
chatroomInfo.setTrustModel(ChatroomInfo::TRUST_MODEL_HIERARCHICAL);
else
chatroomInfo.setTrustModel(ChatroomInfo::TRUST_MODEL_NONE);
return chatroomInfo;
}
示例9: LoadDataset
bool MainWindow::LoadDataset(QStringList files, QString targetFilename,
bool bNoUserInteraction) {
std::vector<std::string> stdFiles;
for (QStringList::iterator it = files.begin(); it != files.end();
++it)
{
string datasetName = it->toStdString();
stdFiles.push_back(datasetName);
}
string stdTargetFilename = targetFilename.toStdString();
LuaClassInstance inst =
m_MasterController.LuaScript()->cexecRet<LuaClassInstance>(
"iv3d.rendererWithParams.new", stdFiles, stdTargetFilename,
bNoUserInteraction);
return !inst.isDefaultInstance();
}
示例10: display
void PluginManager::display(GenericInterface* gi)
{
QMenu* menu = gi->menu(tr("&Plugin"));
_loadPluginAction = menu->addAction(tr("&Load plugin"));
_unloadPluginsAction = menu->addAction(tr("&Unload all plugins"));
// TODO: perform this task in a better and most logical place. For now,
// it works because 'addPlugin()' signal will be connected when it is emmited
// in loadPlugin(), so it will really display its menu in the GenericInterface
QDir directory("plugins");
QStringList files = directory.entryList();
std::cout << files.size() << " files in plugins' directory" << std::endl;
for(QStringList::iterator it = files.begin(); it != files.end(); ++it) {
if(QLibrary::isLibrary(*it)) {
std::cout << "library found : " << it->toStdString() << std::endl;
loadPlugin(directory.path() + QDir::separator() + *it);
}
}
checkActionsValid();
}
示例11: openDir
void NRemoteFSBrowser::openDir ( const QString & path )
{
SignalFrame frame("read_dir", uri(), SERVER_CORE_PATH);
SignalOptions options( frame );
std::vector<std::string> vect;
QStringList::iterator it = m_extensions.begin();
while(it != m_extensions.end())
{
vect.push_back(it->toStdString());
it++;
}
options.add_option< OptionT<std::string> >("dirPath", path.toStdString());
options.add_option< OptionT<bool> >("includeFiles", m_includeFiles);
options.add_option< OptionT<bool> >("includeNoExtensions", m_includeNoExtensions);
options.add_option< OptionArrayT<std::string> >("extensions", vect);
options.flush();
NetworkQueue::global_queue()->send( frame, NetworkQueue::IMMEDIATE );
}
示例12: generateCondition
void synaxErrorJudger::generateCondition()
{
int begin = sqlExp.indexOf("where") + 5;
int end = sqlExp.indexOf(QRegExp(";$")) - 1;
QStringList conditions = sqlExp.mid(begin, end - begin + 1).split("and");
QStringList::iterator it;
pair<int, size_t> dataType;
int logicType;
string rightSide, leftSide;
for (it = conditions.begin(); it != conditions.end(); ++it) {
*it = it->trimmed();
if (*it == "") {
throw QString("Synax Error: Conditions' format is incorrect.");
}
int begin = 0;
int end = it->indexOf(QRegExp("[=><]"))-1;
rightSide = it->mid(begin, end - begin + 1).trimmed().toStdString();
begin = end + 1;
end = it->indexOf(QRegExp("[=><]"), begin + 1);
if (end - begin > 1 || end == -1) { //如果下一个"=",">","<"号出现在较远处
end = begin; //说明这个逻辑关系是"=",">","<"而非">=", "<=", "<>"
}
logicType = condition::getLogicTypeFromStr(it->mid(begin, end - begin + 1).toStdString());
if (logicType == _ERROR) {
throw QString("Synax Error: The logic arithemtic is invalid.");
}
bool ok;
*it = it->mid(end + 1).trimmed();
if (it->indexOf(QRegExp("^'")) != -1) { //引号'应该是字符或字符串
it->remove(0, 1).remove(QRegExp("'$"));
size_t len = it->size();
pair<int, size_t> dType;
Api::cManager.getAttributeDataType(*tblName, rightSide, dType);
if (len < 1 || len > 255 || len > dType.second) {
throw QString("Synax Error: The length of string is overflow.");
}
else if (len == 1) {
dataType = pair<int, size_t>(_CHAR, sizeof(char));
}
else {
dataType = pair<int, size_t>(_STRING, dType.second * sizeof(char));
}
}
else if (it->indexOf('.') != -1) { //有小数点且不是字符串,应该是float
it->toFloat(&ok);
if (!ok) {
;
}
else {
dataType = pair<int, size_t>(_FLOAT, sizeof(float));
}
}
else { //剩下的应该是int类型
it->toInt(&ok);
if (!ok) {
;
}
else {
dataType = pair<int, size_t>(_INT, sizeof(int));
}
}
leftSide = it->toStdString();
if (cond == 0) {
cond = new vector<condition>;
}
cond->push_back(condition(rightSide, logicType, dataType, leftSide));
}
}
示例13: fi
void
CLArgsPrivate::parse()
{
{
QStringList::iterator it = hasToken( QString::fromUtf8("version"), QString::fromUtf8("v") );
if ( it != args.end() ) {
QString msg = QObject::tr("%1 version %2 at commit %3 on branch %4 built on %4").arg( QString::fromUtf8(NATRON_APPLICATION_NAME) ).arg( QString::fromUtf8(NATRON_VERSION_STRING) ).arg( QString::fromUtf8(GIT_COMMIT) ).arg( QString::fromUtf8(GIT_BRANCH) ).arg( QString::fromUtf8(__DATE__) );
std::cout << msg.toStdString() << std::endl;
error = 1;
return;
}
}
{
QStringList::iterator it = hasToken( QString::fromUtf8("help"), QString::fromUtf8("h") );
if ( it != args.end() ) {
CLArgs::printUsage( args[0].toStdString() );
error = 1;
return;
}
}
{
QStringList::iterator it = hasToken( QString::fromUtf8("background"), QString::fromUtf8("b") );
if ( it != args.end() ) {
isBackground = true;
args.erase(it);
}
}
{
QStringList::iterator it = hasToken( QString::fromUtf8("interpreter"), QString::fromUtf8("t") );
if ( it != args.end() ) {
isInterpreterMode = true;
isBackground = true;
std::cout << QObject::tr("Note: -t argument given, loading in command-line interpreter mode, only Python commands / scripts are accepted").toStdString()
<< std::endl;
args.erase(it);
}
}
{
QStringList::iterator it = hasToken( QString::fromUtf8("render-stats"), QString::fromUtf8("s") );
if ( it != args.end() ) {
enableRenderStats = true;
args.erase(it);
}
}
{
QStringList::iterator it = hasToken( QString::fromUtf8(NATRON_BREAKPAD_PROCESS_PID), QString() );
if ( it != args.end() ) {
++it;
if ( it != args.end() ) {
breakpadProcessPID = it->toLongLong();
args.erase(it);
} else {
std::cout << QObject::tr("You must specify the breakpad process executable file path").toStdString() << std::endl;
error = 1;
return;
}
}
}
{
QStringList::iterator it = hasToken( QString::fromUtf8(NATRON_BREAKPAD_PROCESS_EXEC), QString() );
if ( it != args.end() ) {
++it;
if ( it != args.end() ) {
breakpadProcessFilePath = *it;
args.erase(it);
} else {
std::cout << QObject::tr("You must specify the breakpad process executable file path").toStdString() << std::endl;
error = 1;
return;
}
}
}
{
QStringList::iterator it = hasToken( QString::fromUtf8(NATRON_BREAKPAD_CLIENT_FD_ARG), QString() );
if ( it != args.end() ) {
++it;
if ( it != args.end() ) {
breakpadPipeClientID = it->toInt();
args.erase(it);
} else {
std::cout << QObject::tr("You must specify the breakpad pipe client FD").toStdString() << std::endl;
error = 1;
return;
}
}
}
{
//.........这里部分代码省略.........