当前位置: 首页>>代码示例>>C++>>正文


C++ QStringList::split方法代码示例

本文整理汇总了C++中QStringList::split方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::split方法的具体用法?C++ QStringList::split怎么用?C++ QStringList::split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStringList的用法示例。


在下文中一共展示了QStringList::split方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadUrlEncoding

void RDFormPost::LoadUrlEncoding(char first)
{
  char *data=new char[post_content_length+1];
  int n;
  QStringList lines;
  QStringList line;

  data[0]=first;
  if((n=read(0,data+1,post_content_length-1))<0) {
    post_error=RDFormPost::ErrorMalformedData;
    return;
  }
  data[post_content_length]=0;

  /*
   * Uncomment this to dump the raw post data to "/tmp/output.dat".
   */
  /*
  int out=open("/tmp/output.dat",O_WRONLY|O_CREAT);
  if(out<0) {
    int err=errno;
    printf("Content-type: text/html\n\n");
    printf("Couldn't open file [%s]\n",strerror(err));
    exit(0);
  }
  write(out,data,post_content_length);
  ::close(out);
  printf("Content-type: text/html\n\n");
  printf("POST DUMPED TO \"/tmp/output.dat\"!\n");
  exit(0);
  */
  lines=lines.split("&",data);
  for(unsigned i=0;i<lines.size();i++) {
    line=line.split("=",lines[i]);
    switch(line.size()) {
    case 1:
      post_values[line[0]]="";
      post_filenames[line[0]]=false;
      break;

    case 2:
      post_values[line[0]]=RDFormPost::urlDecode(line[1]);
      post_filenames[line[0]]=false;
      break;
    }
  }

  post_error=RDFormPost::ErrorOk;
  delete data;
}
开发者ID:kevinsikes,项目名称:rivendell,代码行数:50,代码来源:rdformpost.cpp

示例2: RKComponent

RKText::RKText (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
	RK_TRACE (PLUGIN);

	// create layout and label
	QVBoxLayout *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());

	label = new QLabel (QString::null, this);
	label->setAlignment (Qt::AlignAuto | Qt::ExpandTabs | Qt::WordBreak);
	vbox->addWidget (label);

	QString initial_text;
	QStringList lines = lines.split ("\n", element.text (), false);
	for (unsigned int i=0; i < lines.count (); i++) {
		QString line = lines[i].stripWhiteSpace ();
		if (!line.isEmpty ()) {
			initial_text.append (line + '\n');
		}
	}

	// strip final newline
	initial_text.truncate (initial_text.length () -1);

	// create and add property
	addChild ("text", text = new RKComponentPropertyBase (this, true));
	connect (text, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (textChanged (RKComponentPropertyBase *)));

	// initialize
	text->setValue (initial_text);
}
开发者ID:svn2github,项目名称:rkward-svn-mirror,代码行数:29,代码来源:rktext.cpp

示例3: get_substr_csv

//----------------------------------------------------------------------------
// Import from CSV file
//
// CSV Format : Last Name / First Name / Birthday / address1 / address2 / ZIP / City / Phone
//----------------------------------------------------------------------------
QStringList get_substr_csv( std::string str )
{
    QRegExp     sSeparator( "[;\t]" );
    QStringList listStr;

    return listStr.split( sSeparator, str.c_str(), true );
}
开发者ID:Stroff,项目名称:Amonsoft,代码行数:12,代码来源:CDatas.cpp

示例4:

QList< bool > KLCPUFuses::stringToBoolValList(const QString & boolList) const
{
    QStringList list;
    QList< bool > retVal;

    list = list.split( ",", boolList );
    for (QStringList::iterator it = list.begin(); it != list.end(); ++it)
    {
        if ( (*it).stripWhiteSpace().length() != 0 )
            retVal.append( (*it).stripWhiteSpace().upper() == TRUE_STRING );
    }
    return retVal;
}
开发者ID:andik92,项目名称:kontrollerlab,代码行数:13,代码来源:klcpufuses.cpp

示例5: if

KLCPUFuses::KLCPUFuses(QDomDocument &, QDomElement & parent)
{
    if ( parent.nodeName().upper() == "FUSES" )
    {
        for( QDomNode n = parent.firstChild(); !n.isNull(); n = n.nextSibling() )
        {
            if ( n.isElement() )
            {
                QDomElement ele = n.toElement();
                if ( n.nodeName().upper() == "LOW_CAN_BE_CHANGED" )
                    m_lowCanBeChanged = stringToBoolValList( ele.text() );
                else if ( n.nodeName().upper() == "LOW_NAMES" )
                {
                    QStringList list;
                    list = list.split(",", ele.text());
                    m_lowNames = list;
                }
                else if ( n.nodeName().upper() == "HIGH_CAN_BE_CHANGED" )
                    m_highCanBeChanged = stringToBoolValList( ele.text() );
                else if ( n.nodeName().upper() == "HIGH_NAMES" )
                {
                    QStringList list;
                    list = list.split(",", ele.text());
                    m_highNames = list;
                }
                else if ( n.nodeName().upper() == "EXT_CAN_BE_CHANGED" )
                    m_extCanBeChanged = stringToBoolValList( ele.text() );
                else if ( n.nodeName().upper() == "EXT_NAMES" )
                {
                    QStringList list;
                    list = list.split(",", ele.text());
                    m_extNames = list;
                }
            }
        }
    }
}
开发者ID:andik92,项目名称:kontrollerlab,代码行数:37,代码来源:klcpufuses.cpp

示例6: LoadUrlEncoding

void RDFormPost::LoadUrlEncoding()
{
    char *data=new char[post_content_length+1];
    int n;
    QStringList lines;
    QStringList line;

    if((n=read(0,data,post_content_length))<0) {
        post_error=RDFormPost::ErrorMalformedData;
        return;
    }
    data[post_content_length]=0;
    lines=lines.split("&",data);
    for(unsigned i=0; i<lines.size(); i++) {
        line=line.split("=",lines[i]);
        if(line.size()==2) {
            post_values[line[0]]=UrlDecode(line[1]);
            post_filenames[line[0]]=false;
        }
    }

    post_error=RDFormPost::ErrorOk;
    delete data;
}
开发者ID:stgabmp,项目名称:Rivendell,代码行数:24,代码来源:rdformpost.cpp

示例7: retreiveFilesInfos

VCSFileInfoMap* ClearcaseManipulator::retreiveFilesInfos(const QString& directory) {


  VCSFileInfoMap* fileInfoMap = new VCSFileInfoMap();

  char CCcommand[1024];
  sprintf(CCcommand, "cleartool desc -fmt \"%%m;%%En;%%Rf;%%Sn;%%PVn\\n\" %s/*", directory.ascii());
  FILE* outputFile = popen(CCcommand, "r");

  char* line = NULL;
  size_t numRead;
  while (!feof(outputFile)) {
    getline(&line,&numRead,outputFile);

    if (numRead > 0) {
      int pos = 0;
      int lastPos = -1;

      QStringList outputList;
      outputList = outputList.split(CT_DESC_SEPARATOR, QString(line), true );
      outputList[Name] = QString(basename((char*)outputList[Name].ascii()));

      VCSFileInfo::FileState state;
      if (outputList[ClearcaseManipulator::State] == "unreserved" || outputList[ClearcaseManipulator::State] == "reserved") {
	state = VCSFileInfo::Modified;
      }
      else if (outputList[ClearcaseManipulator::State] == "") {
	state = VCSFileInfo::Uptodate;
      }
      else {
	state = VCSFileInfo::Unknown;
      }


      (*fileInfoMap)[outputList[ClearcaseManipulator::Name]] = VCSFileInfo(outputList[ClearcaseManipulator::Name], outputList[ClearcaseManipulator::Version], outputList[ClearcaseManipulator::RepositoryVersion], state);
    }
  }

  pclose(outputFile);

  return fileInfoMap;
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:42,代码来源:clearcasemanipulator.cpp

示例8: UpdateMeters

void RDCae::UpdateMeters()
{
  char msg[1501];
  int n;
  QStringList args;

  while((n=cae_meter_socket->readBlock(msg,1500))>0) {
    msg[n]=0;
    args=args.split(" ",msg);
    if(args[0]=="ML") {
      if(args.size()==6) {
	if(args[1]=="I") {
	  cae_input_levels[args[2].toInt()][args[3].toInt()][0]=args[4].toInt();
	  cae_input_levels[args[2].toInt()][args[3].toInt()][1]=args[5].toInt();
	}
	if(args[1]=="O") {
	  cae_output_levels[args[2].toInt()][args[3].toInt()][0]=
	    args[4].toInt();
	  cae_output_levels[args[2].toInt()][args[3].toInt()][1]=
	    args[5].toInt();
	}
      }
    }
    if(args[0]=="MO") {
      if(args.size()==5) {
	cae_stream_output_levels[args[1].toInt()][args[2].toInt()][0]=
	    args[3].toInt();
	cae_stream_output_levels[args[1].toInt()][args[2].toInt()][1]=
	    args[4].toInt();
      }
    }
    if(args[0]=="MP") {
      if(args.size()==4) {
	cae_output_positions[args[1].toInt()][args[2].toInt()]=args[3].toUInt();
      }
    }
  }
}
开发者ID:WMFO,项目名称:rivendell,代码行数:38,代码来源:rdcae.cpp

示例9: LoadMultipartEncoding

void RDFormPost::LoadMultipartEncoding()
{
    std::map<QString,QString> headers;
    bool header=true;
    char *data=NULL;
    FILE *f=NULL;
    ssize_t n=0;
    QString sep;
    QString name;
    QString filename;
    QString tempdir;
    int fd=-1;

    if((f=fdopen(0,"r"))==NULL) {
        post_error=RDFormPost::ErrorInternal;
        return;
    }



    /*
    int out=open("/tmp/output.dat",O_WRONLY|O_CREAT);
    while((n=getline(&data,(size_t *)&n,f))>0) {
      write(out,data,n);
    }
    ::close(out);
    printf("Content-type: text/html\n\n");
    printf("DONE!\n");
    */








    if((n=getline(&data,(size_t *)&n,f))<=0) {
        post_error=RDFormPost::ErrorMalformedData;
        return;
    }
    sep=QString(data).stripWhiteSpace();

    //
    // Get message parts
    //
    while((n=getline(&data,(size_t *)&n,f))>0) {
        if(QString(data).stripWhiteSpace().contains(sep)>0) {  // End of part
            if(fd>=0) {
                ftruncate(fd,lseek(fd,0,SEEK_CUR)-2);  // Remove extraneous final CR/LF
                ::close(fd);
                fd=-1;
            }
            name="";
            filename="";
            headers.clear();
            header=true;
            continue;
        }
        if(header) {  // Read header
            if(QString(data).stripWhiteSpace().isEmpty()) {
                if(!headers["content-disposition"].isNull()) {
                    QStringList fields;
                    fields=fields.split(";",headers["content-disposition"]);
                    if(fields.size()>0) {
                        if(fields[0].lower().stripWhiteSpace()=="form-data") {
                            for(unsigned i=1; i<fields.size(); i++) {
                                QStringList pairs;
                                pairs=pairs.split("=",fields[i]);
                                if(pairs[0].lower().stripWhiteSpace()=="name") {
                                    name=pairs[1].stripWhiteSpace();
                                    name.replace("\"","");
                                }
                                if(pairs[0].lower().stripWhiteSpace()=="filename") {
                                    filename=post_tempdir+"/"+pairs[1].stripWhiteSpace();
                                    filename.replace("\"","");
                                    fd=open(filename,O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR);
                                }
                            }
                        }
                    }
                }
                header=false;
            }
            else {
                QStringList hdr;
                hdr=hdr.split(":",QString(data).stripWhiteSpace());
                // Reconcaternate trailing sections so we don't split on the
                // useless M$ drive letter supplied by IE
                for(unsigned i=2; i<hdr.size(); i++) {
                    hdr[1]+=hdr[i];
                }
                headers[hdr[0].lower()]=hdr[1];
            }
        }
        else {  // Read data
            if(filename.isEmpty()) {
                QString str=post_values[name].toString();
                str+=QString(data);
                post_filenames[name]=false;
//.........这里部分代码省略.........
开发者ID:stgabmp,项目名称:Rivendell,代码行数:101,代码来源:rdformpost.cpp

示例10: DispatchCommand

void MainObject::DispatchCommand(QString cmd)
{
    bool processed=false;
    int line;
    QTime time;
    bool ok=false;
    bool overwrite=!edit_modified;
    QStringList cmds;
    QString verb;

    cmd=cmd.stripWhiteSpace();
    if(cmd.right(1)=="!") {
        overwrite=true;
        cmd=cmd.left(cmd.length()-1).stripWhiteSpace();
    }
    cmds=cmds.split(" ",cmd);
    verb=cmds[0].lower();

    //
    // No loaded log needed for these
    //
    if(verb=="deletelog") {
        if(rda->user()->deleteLog()) {
            if(cmds.size()==2) {
                Deletelog(cmds[1]);
            }
            else {
                fprintf(stderr,"deletelog: invalid command arguments\n");
            }
        }
        else {
            fprintf(stderr,"deletelog: insufficient privileges [Delete Log]\n");
        }
        processed=true;
    }

    if((verb=="exit")||(verb=="quit")||(verb=="bye")) {
        if(overwrite) {
            exit(0);
        }
        else {
            OverwriteError(verb);
        }
        processed=true;
    }

    if((verb=="help")||(verb=="?")) {
        Help(cmds);
        processed=true;
    }

    if(verb=="listlogs") {
        ListLogs();
        processed=true;
    }

    if(verb=="listservices") {
        Listservices();
        processed=true;
    }

    if(verb=="load") {
        if(overwrite) {
            if(cmds.size()==2) {
                Load(cmds[1]);
            }
            else {
                fprintf(stderr,"load: invalid command arguments\n");
            }
        }
        else {
            OverwriteError("load");
        }
        processed=true;
    }

    if(verb=="new") {
        if(overwrite) {
            if(cmds.size()==2) {
                New(cmds[1]);
            }
            else {
                fprintf(stderr,"new: invalid command arguments\n");
            }
        }
        else {
            OverwriteError("new");
        }
        processed=true;
    }

    //
    // These need a log loaded
    //
    if((processed)||(edit_log_event!=NULL)) {
        if(verb=="addcart") {
            if(rda->user()->addtoLog()) {
                if(cmds.size()==3) {
                    line=cmds[1].toInt(&ok);
                    if(ok&&(line>=0)) {
//.........这里部分代码省略.........
开发者ID:radio-helsinki-graz,项目名称:rivendell,代码行数:101,代码来源:parser.cpp

示例11: slotButtReplace

// -----------------------------------------------------------------------
// Is called if the "Replace"-button is pressed.
void ChangeDialog::slotButtReplace()
{
  Expr.setWildcard(true);  // switch into wildcard mode
  Expr.setPattern(CompNameEdit->text());
  if(!Expr.isValid()) {
    QMessageBox::critical(this, tr("Error"),
	  tr("Regular expression for component name is invalid."));
    return;
  }

  // create dialog showing all found components
  QDialog *Dia = new QDialog(this);
  Dia->setCaption(tr("Found Components"));
  QVBoxLayout *Dia_All = new QVBoxLayout(Dia);
  Dia_All->setSpacing(3);
  Dia_All->setMargin(5);
  
  QScrollArea *Dia_Scroll = new QScrollArea(Dia);
  //Dia_Scroll->setMargin(5);
  Dia_All->addWidget(Dia_Scroll);
  
  QVBoxLayout *Dia_Box = new QVBoxLayout(Dia_Scroll->viewport());
  Dia_Scroll->insertChild(Dia_Box);
  QLabel *Dia_Label = new QLabel(tr("Change properties of\n")
                               + tr("these components ?"), Dia);
  Dia_All->addWidget(Dia_Label);
  
  QHBoxLayout *Dia_h = new QHBoxLayout(Dia);
  Dia_h->setSpacing(5);
  QPushButton *YesButton = new QPushButton(tr("Yes"));
  QPushButton *CancelButton = new QPushButton(tr("Cancel"));
  Dia_h->addWidget(YesButton);
  Dia_h->addWidget(CancelButton);
  connect(YesButton, SIGNAL(clicked()), Dia, SLOT(accept()));
  connect(CancelButton, SIGNAL(clicked()), Dia, SLOT(reject()));
  
  Dia_All->addLayout(Dia_h);

  QList<QCheckBox *> pList;
  QCheckBox *pb;
  Component *pc;
  QStringList List;
  QString str;
  int i1, i2;
  // search through all components
  for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next()) {
    if(matches(pc->Model)) {
      if(Expr.search(pc->Name) >= 0)
        for(Property *pp = pc->Props.first(); pp!=0; pp = pc->Props.next())
          if(pp->Name == PropNameEdit->currentText()) {
            pb = new QCheckBox(pc->Name);
            Dia_Box->addWidget(pb);   
            pList.append(pb);
            pb->setChecked(true);
            i1 = pp->Description.find('[');
            if(i1 < 0)  break;  // no multiple-choice property

            i2 = pp->Description.findRev(']');
            if(i2-i1 < 2)  break;
            str = pp->Description.mid(i1+1, i2-i1-1);
            str.replace( QRegExp("[^a-zA-Z0-9_,]"), "" );
            List = List.split(',',str);
            if(List.findIndex(NewValueEdit->text()) >= 0)
              break;    // property value is okay

            pb->setChecked(false);
            pb->setEnabled(false);
            break;
          }
    }
  }
/*
  QColor theColor;
  if(pList.isEmpty()) {
    YesButton->setEnabled(false);
    theColor =
       (new QLabel(tr("No match found!"), Dia_Box))->paletteBackgroundColor();
  }
  else  theColor = pList.current()->paletteBackgroundColor();
*/
  //Dia_Scroll->viewport()->setPaletteBackgroundColor(theColor);
  Dia->resize(50, 300);


  // show user all components found
  int Result = Dia->exec();
  if(Result != QDialog::Accepted) return;


  bool changed = false;
  // change property values
  
  QListIterator<QCheckBox *> i(pList);
  while(i.hasNext()){
    pb = i.next();
    if(!pb->isChecked())  continue;

    for(pc = Doc->Components->first(); pc!=0; pc = Doc->Components->next()) {
//.........这里部分代码省略.........
开发者ID:AMDmi3,项目名称:qucs,代码行数:101,代码来源:changedialog.cpp


注:本文中的QStringList::split方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。