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


C++ QCString::stripWhiteSpace方法代码示例

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


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

示例1: write_multiplicity

void UmlItem::write_multiplicity(FileOut & out, QCString s, UmlItem * who)
{
  if (!s.isEmpty()) {
    QCString min;
    QCString max;
    int index = s.find("..");
    
    if (index != -1) {
      min = s.left(index).stripWhiteSpace();
      max = s.mid(index+2).stripWhiteSpace();
    }
    else
      min = max = s.stripWhiteSpace();
    
    out.indent();
    out << "<lowerValue xmi:type=\"uml:LiteralString\"";
    out.id_prefix(who, "MULTIPLICITY_L_");
    out << " value=\"" << min << "\"/>\n";
    
    out.indent();
    out << "<upperValue xmi:type=\"uml:LiteralString\"";
    out.id_prefix(who, "MULTIPLICITY_U_");
    out << " value=\"" << max << "\"/>\n";
  }
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例2: _setBriefDescription

void Definition::_setBriefDescription(const char *b,const char *briefFile,int briefLine)
{
  static QCString outputLanguage = "English";
  static bool needsDot = outputLanguage!="Japanese" && 
                         outputLanguage!="Chinese" &&
                         outputLanguage!="Korean";
  QCString brief = b;
  brief = brief.stripWhiteSpace();
  if (brief.isEmpty()) return;
  int bl = brief.length();
  if (bl>0 && needsDot) // add punctuation if needed
  {
    int c = brief.at(bl-1);
    switch(c)
    {
      case '.': case '!': case '?': case '>': case ':': case ')': break;
      default: 
        if (uni_isupper(brief.at(0)) && !lastCharIsMultibyte(brief)) brief+='.'; 
        break;
    }
  }

  if (!_docsAlreadyAdded(brief,m_impl->briefSignatures))
  {
    if (m_impl->brief && !m_impl->brief->doc.isEmpty())
    {
       //printf("adding to details\n");
       _setDocumentation(brief,briefFile,briefLine,FALSE,TRUE);
    }
    else
    {
      //fprintf(stderr,"Definition::setBriefDescription(%s,%s,%d)\n",b,briefFile,briefLine);
      if (m_impl->brief==0)
      {
        m_impl->brief = new BriefInfo;
      }
      m_impl->brief->doc=brief;
      if (briefLine!=-1)
      {
        m_impl->brief->file = briefFile;
        m_impl->brief->line = briefLine;
      }
      else
      {
        m_impl->brief->file = briefFile;
        m_impl->brief->line = 1;
      }
    }
  }
  else
  {
    //printf("do nothing!\n");
  }
}
开发者ID:kevinoupeng,项目名称:mydg,代码行数:54,代码来源:definition.cpp

示例3: tool_cmd

bool ClassData::tool_cmd(ToolCom * com, const char * args,
			 BrowserNode * bn,
			 const QString & comment) {
  if (((unsigned char) args[-1]) >= firstSetCmd) {
    if (!bn->is_writable() && !root_permission())
      com->write_ack(FALSE);
    else {
      switch ((unsigned char) args[-1]) {
      case setIsAbstractCmd:
	if ((*args == 0) && 
	    strcmp(browser_node->get_stereotype(), "enum") &&
	    ((BrowserClass *) browser_node)->have_abstract_operation()) {
	  com->write_ack(FALSE);
	  return TRUE;
	}
	else
	  is_abstract = (*args != 0);
	break;
      case setActiveCmd:
	is_active = (*args != 0);
	break;
      case setVisibilityCmd:
	{
	  UmlVisibility v;
	  
	  if (! com->get_visibility(v, args)) {
	    com->write_ack(FALSE);
	    return TRUE;
	  }
	  else
	    uml_visibility = v;
	}
	break;
      case setBaseTypeCmd:
	if (stereotype != "typedef") {
	  com->write_ack(FALSE);
	  return TRUE;
	}
	else {
	  AType t;
	  
	  com->get_type(t, args);
	  set_base_type(t);	  
	}
	break;
      case setConstraintCmd:
	constraint = args;
	break;
      case setIsCppExternalCmd:
	cpp_external = (*args != 0);
	break;
      case setCppVisibilityCmd:
	{
	  UmlVisibility v;
	  
	  if (! com->get_extended_visibility(v, args)) {
	    com->write_ack(FALSE);
	    return TRUE;
	  }
	  else
	    cpp_visibility = v;
	}
	break;
      case setCppDeclCmd:
	cpp_decl = args;
	break;
      case setIsJavaExternalCmd:
	java_external = (*args != 0);
	break;
      case setJavaDeclCmd:
	java_decl = args;
	break;
      case setJavaAnnotationCmd:
	{
	  QCString s = args;
	  
	  s = s.stripWhiteSpace();
	  if (! s.isEmpty())
	    s += '\n';
	  java_annotation = s;
	}
	break;
      case setIsJavaPublicCmd:
	{
	  UmlVisibility v = (*args != 0) ? UmlPublic : UmlPackageVisibility;
	  
	  if ((cpp_visibility == UmlDefaultVisibility) &&
	      (uml_visibility != UmlPublic) &&
	      (uml_visibility != UmlPackageVisibility))
	    cpp_visibility = uml_visibility;
	  uml_visibility = v;
	}
	break;
      case setIsJavaFinalCmd:
	java_final = (*args != 0);
	break;
      case setIsPhpExternalCmd:
	php_external = (*args != 0);
	break;
      case setPhpDeclCmd:
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例4: splitAddressInternal


//.........这里部分代码省略.........
                 break;
      case '\\' : // quoted character
                 displayName += *p;
                 ++p; // skip the '\'
                 if ( *p )
                   displayName += *p;
                 else
                   return KPIM::UnexpectedEnd;
                 break;
          case ',' :
          case ';' : if ( !inQuotedString ) {
                   if ( allowMultipleAddresses )
                     stop = true;
                   else
                     return KPIM::UnexpectedComma;
                 }
                 else
                   displayName += *p;
                 break;
      default :  displayName += *p;
      }
      break;
    }
    case InComment : {
      switch ( *p ) {
      case '(' : ++commentLevel;
                 comment += *p;
                 break;
      case ')' : --commentLevel;
                 if ( commentLevel == 0 ) {
                   context = TopLevel;
                   comment += ' '; // separate the text of several comments
                 }
                 else
                   comment += *p;
                 break;
      case '\\' : // quoted character
                 comment += *p;
                 ++p; // skip the '\'
                 if ( *p )
                   comment += *p;
                 else
                   return KPIM::UnexpectedEnd;
                 break;
      default :  comment += *p;
      }
      break;
    }
    case InAngleAddress : {
      switch ( *p ) {
      case '"' : inQuotedString = !inQuotedString;
                 addrSpec += *p;
                 break;
      case '>' : if ( !inQuotedString ) {
                   context = TopLevel;
                 }
                 else
                   addrSpec += *p;
                 break;
      case '\\' : // quoted character
                 addrSpec += *p;
                 ++p; // skip the '\'
                 if ( *p )
                   addrSpec += *p;
                 else
                   return KPIM::UnexpectedEnd;
                 break;
      default :  addrSpec += *p;
      }
      break;
    }
    } // switch ( context )
  }
  // check for errors
  if ( inQuotedString )
    return KPIM::UnbalancedQuote;
  if ( context == InComment )
    return KPIM::UnbalancedParens;
  if ( context == InAngleAddress )
    return KPIM::UnclosedAngleAddr;

  displayName = displayName.stripWhiteSpace();
  comment = comment.stripWhiteSpace();
  addrSpec = addrSpec.stripWhiteSpace();

  if ( addrSpec.isEmpty() ) {
    if ( displayName.isEmpty() )
      return KPIM::NoAddressSpec;
    else {
      addrSpec = displayName;
      displayName.truncate( 0 );
    }
  }
/*
  kdDebug() << "display-name : \"" << displayName << "\"" << endl;
  kdDebug() << "comment      : \"" << comment << "\"" << endl;
  kdDebug() << "addr-spec    : \"" << addrSpec << "\"" << endl;
*/
  return KPIM::AddressOk;
}
开发者ID:,项目名称:,代码行数:101,代码来源:

示例5: doFetchNewHeaders

void KNNntpClient::doFetchNewHeaders()
{
    KNGroup *target = static_cast<KNGroup *>(job->data());
    char *s;
    int first = 0, last = 0, oldlast = 0, toFetch = 0, rep = 0;
    QCString cmd;

    target->setLastFetchCount(0);

    sendSignal(TSdownloadNew);
    errorPrefix = i18n("No new articles could be retrieved for\n%1/%2.\nThe following error occurred:\n")
                  .arg(account.server()).arg(target->groupname());

    cmd = "GROUP ";
    cmd += target->groupname().utf8();
    if(!sendCommandWCheck(cmd, 211))         // 211 n f l s group selected
    {
        return;
    }

    currentGroup = target->groupname();

    progressValue = 90;

    s = strchr(getCurrentLine(), ' ');
    if(s)
    {
        s++;
        s = strchr(s, ' ');
    }
    if(s)
    {
        s++;
        first = atoi(s);
        target->setFirstNr(first);
        s = strchr(s, ' ');
    }
    if(s)
    {
        last = atoi(s);
    }
    else
    {
        QString tmp = i18n("No new articles could be retrieved.\nThe server sent a malformatted response:\n");
        tmp += getCurrentLine();
        job->setErrorString(tmp);
        closeConnection();
        return;
    }

    if(target->lastNr() == 0)   //first fetch
    {
        if(first > 0)
            oldlast = first - 1;
        else
            oldlast = first;
    }
    else
        oldlast = target->lastNr();

    toFetch = last - oldlast;
    //qDebug("knode: last %d  oldlast %d  toFetch %d\n",last,oldlast,toFetch);

    if(toFetch <= 0)
    {
        //qDebug("knode: No new Articles in group\n");
        target->setLastNr(last);     // don't get stuck when the article numbers wrap
        return;
    }

    if(toFetch > target->maxFetch())
    {
        toFetch = target->maxFetch();
        //qDebug("knode: Fetching only %d articles\n",toFetch);
    }

    progressValue = 100;
    predictedLines = toFetch;

    // get list of additional headers provided by the XOVER command
    // see RFC 2980 section 2.1.7
    QStrList headerformat;
    cmd = "LIST OVERVIEW.FMT";
    if(sendCommand(cmd, rep) && rep == 215)
    {
        QStrList tmp;
        if(getMsg(tmp))
        {
            for(QCString s = tmp.first(); s; s = tmp.next())
            {
                s = s.stripWhiteSpace();
                // remove the mandatory xover header
                if(s == "Subject:" || s == "From:" || s == "Date:" || s == "Message-ID:"
                        || s == "References:" || s == "Bytes:" || s == "Lines:")
                    continue;
                else
                    headerformat.append(s);
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:101,代码来源:knnntpclient.cpp

示例6: mocify

static CWResult        mocify(CWPluginContext context, const QCString &source)
{
    CWDisplayLines(context, line_count++);

    source.stripWhiteSpace();

    CWResult err;
        bool            dotmoc=false;
        QCString stem = source, ext;
        int dotpos = stem.findRev('.');
    if(dotpos != -1) {
        ext = stem.right(stem.length() - (dotpos+1));
        stem = stem.left(dotpos);
        if(ext == "cpp")
            dotmoc = true;
    } else {
        //whoa!
    }
    QCString dest;
    if(dotmoc)
        dest = stem + ".moc";
    else
        dest = "moc_" + stem + ".cpp";

    //moc it
    CWFileSpec destSpec;
        moc_status mocd = do_moc(context, source, dest, &destSpec, dotmoc);

#if 0
    QCString derr = "Weird";
    switch(mocd) {
    case moc_success: derr = "Success"; break;
    case moc_parse_error: derr = "Parser Error"; break;
    case moc_no_qobject:derr = "No QOBJECT"; break;
    case moc_not_time: derr = "Not Time"; break;
    case moc_no_source: derr = "No Source"; break;
    case moc_general_error: derr = "General Error"; break;
    }
        char        dmsg[200];
        sprintf(dmsg, "\"%s\" %s", source.data(), derr.data());
        CWReportMessage(context, NULL, dmsg, NULL, messagetypeError, 0);
#endif

    //handle project
    if(mocd == moc_no_qobject) {
        char        msg[400];
                sprintf(msg, "\"%s\" No relevant classes found. No output generated.", source.data());
                CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
        } else if ((mocd == moc_success || mocd == moc_not_time) && !dotmoc)
        {
                long                        whichFile;
                CWNewProjectEntryInfo ei;
                memset(&ei, '\0', sizeof(ei));
                ei.groupPath = "QtGenerated";
                    err = CWAddProjectEntry(context, &destSpec, true, &ei, &whichFile);
                    if (!CWSUCCESS(err))
                    {
                            char        msg[200];
                            sprintf(msg, "\"%s\" not added", dest.data());
                            CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
                    }
                    if(mocd == moc_success)
                        CWSetModDate(context, &destSpec, NULL, true);
        }
        return cwNoErr;
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:66,代码来源:mwerks_mac.cpp

示例7: if

int
BaseG::encsign(Block &block, const KeyIDList &recipients,
               const char *passphrase)
{
    QCString cmd;
    int exitStatus = 0;

    if(!recipients.isEmpty() && passphrase != 0)
        cmd = "--batch --armor --sign --encrypt --textmode";
    else if(!recipients.isEmpty())
        cmd = "--batch --armor --encrypt --textmode";
    else if(passphrase != 0)
        cmd = "--batch --escape-from --clearsign";
    else
    {
        kdDebug(5100) << "kpgpbase: Neither recipients nor passphrase specified." << endl;
        return OK;
    }

    if(passphrase != 0)
        cmd += addUserId();

    if(!recipients.isEmpty())
    {
        cmd += " --set-filename stdin";

        QCString pgpUser = Module::getKpgp()->user();
        if(Module::getKpgp()->encryptToSelf() && !pgpUser.isEmpty())
        {
            cmd += " -r 0x";
            cmd += pgpUser;
        }

        for(KeyIDList::ConstIterator it = recipients.begin();
                it != recipients.end(); ++it)
        {
            cmd += " -r 0x";
            cmd += (*it);
        }
    }

    clear();
    input = block.text();
    exitStatus = runGpg(cmd.data(), passphrase);
    if(!output.isEmpty())
        block.setProcessedText(output);
    block.setError(error);

    if(exitStatus != 0)
    {
        // this error message is later hopefully overwritten
        errMsg = i18n("Unknown error.");
        status = ERROR;
    }

#if 0
    // #### FIXME: As we check the keys ourselves the following problems
    //             shouldn't occur. Therefore I don't handle them for now.
    //             IK 01/2002
    if(!recipients.isEmpty())
    {
        int index = 0;
        bool bad = FALSE;
        unsigned int num = 0;
        QCString badkeys = "";
        // Examples:
        // gpg: 0x12345678: skipped: public key not found
        // gpg: 0x12345678: skipped: public key is disabled
        // gpg: 0x12345678: skipped: unusable public key
        // (expired or revoked key)
        // gpg: 23456789: no info to calculate a trust probability
        // (untrusted key, 23456789 is the key Id of the encryption sub key)
        while((index = error.find("skipped: ", index)) != -1)
        {
            bad = TRUE;
            index = error.find('\'', index);
            int index2 = error.find('\'', index + 1);
            badkeys += error.mid(index, index2 - index + 1) + ", ";
            num++;
        }
        if(bad)
        {
            badkeys.stripWhiteSpace();
            if(num == recipients.count())
                errMsg = i18n("Could not find public keys matching the userid(s)\n"
                              "%1;\n"
                              "the message is not encrypted.")
                         .arg(badkeys.data());
            else
                errMsg = i18n("Could not find public keys matching the userid(s)\n"
                              "%1;\n"
                              "these persons will not be able to read the message.")
                         .arg(badkeys.data());
            status |= MISSINGKEY;
            status |= ERROR;
        }
    }
#endif
    if(passphrase != 0)
    {
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:101,代码来源:kpgpbaseG.cpp

示例8: manage_enum_item

bool UmlAttribute::manage_enum_item(QCString name, UmlClass * cl
#ifdef ROUNDTRIP
				    , bool roundtrip,
				    QList<UmlItem> & expected_order
#endif
				    )
{   
  QCString comment = Lex::get_comments();
  QCString description = Lex::get_description();
  UmlAttribute * item = 0;	// initialize to avoid warning
#ifdef ROUNDTRIP
  Class * container = 0;	// initialize to avoid warning
  bool created = FALSE;		// initialize to avoid warning
#endif
  
  if (!Package::scanning()) {
#ifdef ROUNDTRIP
    container = cl->get_class();
    
    if (!roundtrip ||
	((item = search_attr(container, name)) == 0)) {
#endif
      if ((item = UmlBaseAttribute::create(cl, name)) == 0) {
	JavaCatWindow::trace(QCString("<font face=helvetica><b>cannot add enum item <i>")
			     + name + "</i> in <i>" + cl->name() 
			     + "</i></b></font><br>");  
	return FALSE;
      }
      
      item->set_Visibility(PublicVisibility);
#ifdef ROUNDTRIP
      if (roundtrip)
	container->set_updated();
    
      created = TRUE;
    }
#endif
  }
  
  Lex::mark();
  
  QCString aux;
  QCString s;
  
  if ((s = Lex::read_word()).isEmpty()) {
    if (! Package::scanning())
      Lex::premature_eof();
    return FALSE;
  }
  else if ((s == ";") || (s == "}")) {
    aux = Lex::region();
    Lex::unread_word(s);
  }
  else if (s == ",") {
    aux = Lex::region();
    Lex::finish_line();
    comment = Lex::get_comments(comment);
    description = Lex::get_description(description);
  }
  else if ((s == "(") || (s == "{")) {
    char c = UmlOperation::skip_expr(1);	// goes after opt init and body
    if (c == 0) {
      if (! Package::scanning())
	Lex::premature_eof();
      return FALSE;
    }
    // c is ',' or ';'
    if (c == ';')
      Lex::unread_word(";");
    aux = Lex::region();
  }
  else {
    if (! Package::scanning())
      Lex::error_near(s);
    return FALSE;
  }
  
  if (!Package::scanning()) {
    // here aux = opt init and body + final character , ; or }
    QCString decl = JavaSettings::enumItemDecl();
    int index;
    
    if ((decl.find("${name}") == -1) ||
	((index = decl.find("${value}")) == -1)) {
      decl = "  ${name}${value},${comment}";
      index = decl.find("${value}");
    }
    
    aux.resize(aux.length()); // remove , ; or }, warning resize count \000
    if (!aux.stripWhiteSpace().isEmpty())
      decl.replace(index, 8, aux);

#ifdef ROUNDTRIP
    if (roundtrip && !created) {
      if (decl.find("${description}") != -1) {
	if (nequal(item->description(), description)) {
	  item->set_Description(description);
	  container->set_updated();
	}
      }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例9: read_type

bool ClassContainer::read_type(UmlTypeSpec & typespec, Class ** cl, 
			       const QValueList<FormalParameterList> & tmplts,
			       QValueList<UmlTypeSpec> * actuals,
			       QCString & str_actuals, QCString s,
			       UmlClass ** first_actual_class, QCString & def,
			       QCString & genericname) {
  str_actuals = 0;
  if (actuals != 0)
    actuals->clear();
  
  if (s.isEmpty() && (s = Lex::read_word()).isEmpty()) {
    Lex::premature_eof();
    return FALSE;
  }
    
  QCString path; // type without <..>
  QCString type; // real type form
  bool internal_template = FALSE;	// true if type is ...<...>...
  int pfixdef_length = 0;		// generic form including first class
  int first_actual_class_length = 0;	// first class's name length
  
  genericname = s;
  
  for (;;) {
    internal_template = (path != type);
    
    path += s;
    type += s;
    
    s = Lex::read_word();
  
    if (s != "<")
      break;
    
    type += s;
    str_actuals = s;
    
    // read <...>
    do {
      Lex::mark();
      
      int level = 0;
      QCString firstword;	// first element in current actual
      int pfixlen = 0;		// type length including firstword
      
      for (;;) {
	s = Lex::read_word(TRUE);
	
	if (s == ",") {
	  if (level == 0)
	    break;
	}
	else if (s == ">") {
	  if (level-- == 0)
	    break;
	}
	else if (s == "]")
	  level -= 1;
	else if ((s == "<") || (s == "["))
	  level += 1;
	else if (s.isEmpty()) {
	  Lex::premature_eof();
	  return FALSE;
	}
	else if (firstword.isEmpty()) {
	  firstword = s;
	  pfixlen = type.length() + Lex::region().length();
	}
      }
      
      QCString e = Lex::region();
      
      type += e;
      str_actuals += e;

      if (actuals != 0) {
	UmlTypeSpec t;
	
	e.resize(e.length()); // remove , or >
	e = e.stripWhiteSpace();
	if (! e.isEmpty())
	  compute_type(e, t, tmplts);
	if (actuals != 0)
	  actuals->append(t);
      }
      else if ((first_actual_class != 0) &&
	       (*first_actual_class == 0) && 
	       !firstword.isEmpty()) {
	UmlTypeSpec t;
	
	compute_type(firstword, t, tmplts);
	if (t.type != 0) {
	  *first_actual_class = t.type;
	  first_actual_class_length = firstword.length();
	  pfixdef_length = pfixlen - first_actual_class_length;
	}
      }
    } while (s == ",");
    
    s = Lex::read_word();
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例10: saveSetting

bool EvaSetting::saveSetting(const int id, const char * md5Pwd, const bool recorded, const bool hidden , 
			const int type, const Q_UINT32 server, const Q_UINT16 port, const QString username, const QCString base64Param)
{
	QString home = QDir::homeDirPath();
	
	QDir d;
	QString fullPath = home + "/.eva";
	if (!d.exists(fullPath)){
		if(!d.cd(home)){
			emit exceptionEvent(QString("can't enter user's home directory"));
			return false;		
		}
		if(!d.mkdir(QString(".eva"),false)){
			emit exceptionEvent(QString("can't create Eva directory"));
			return false;		
		}		
	}
	QString fullName = fullPath + "/" + filename;
	loadSetting();
	//if id exists, update information, otherwise add a new record
	int userIndex = findUser(id);
	Q_UINT8 flag = 0x00;
	if(recorded) flag|=0x01;
	if(hidden) flag |= 0x02;
	switch(type){
	case 0: 
		flag |= 0x10;  // udp;
		break;
	case 1: 
		flag |= 0x08;  // tcp;
		break;
	case 2: 
		flag |= 0x04;  // http proxy;
		break;
	}	
	
	QString s_username = " ";
	QCString s_param = " ";
	if( !username.isEmpty() && username.stripWhiteSpace() != "") s_username = username;
	if( !base64Param.isEmpty() && base64Param.stripWhiteSpace() != "") s_param = base64Param;
	if( userIndex == -1){
		//new record
		LoginRecord *record = new LoginRecord();
		
		record->id = (uint)id;
		
		char *pwd = (char *)malloc(16 * sizeof(char));
		memcpy(pwd, md5Pwd, 16);
		//FIXME memory leak here!!!!
		record->md5Pwd = (Q_UINT8 *)pwd;
		
		record->flag = flag;
		record->proxy = server;
		record->port = port;
		record->proxyUserName = s_username;
		record->base64param = s_param;
		
		userList.append(record);
		userIndex = userList.count()-1;
	}else{
		// update information
		memcpy(userList.at(userIndex)->md5Pwd, md5Pwd, 16);
		userList.at(userIndex)->flag = flag;
		userList.at(userIndex)->proxy = server;
		userList.at(userIndex)->port = port;
		
		userList.at(userIndex)->proxyUserName = s_username;
		userList.at(userIndex)->base64param = s_param;
	}
	QFile file(fullName);
	if(!file.open(IO_WriteOnly)){
		//QString msg = qApp->translate("QFile",file.errorString());
		emit exceptionEvent(fullName);
		return false;
	}
  
	QDataStream stream(&file);
	// save the lastest user's id
	stream<<(Q_UINT32)(userIndex);
	// saving now
	for(uint i=0; i<userList.count(); i++){
		LoginRecord *r= userList.at(i);
		stream<<r->id;
		stream.writeRawBytes((char *)(r->md5Pwd), 16);
		stream<<r->flag;
		stream<<r->proxy;
		stream<<r->port;
		Q_UINT8 len = strlen(r->proxyUserName.ascii());
		stream<<len;
		//stream<<r->proxyUserName;
		stream.writeRawBytes(r->proxyUserName.ascii(), len);
		len = strlen(r->base64param.data());
		stream<<len;
		stream.writeRawBytes(r->base64param.data(), len);
	}
	file.flush();
	file.close();
	return true;
}
开发者ID:evareborn,项目名称:eva-nirvana,代码行数:99,代码来源:evasetting.cpp


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