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


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

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


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

示例1: makeInlineDoc

void makeInlineDoc(int endCode)
{
  int len=endCode-iCodeLen;
  QCString par=inputString.mid(iCodeLen,len);
  //fprintf(stderr,"\n inline code: \n<%s>",par.data());
  gBlock.doc=par;
  gBlock.inbodyDocs=par;
  gBlock.section=Entry::VARIABLE_SEC;
  gBlock.spec=VhdlDocGen::MISCELLANEOUS;
  gBlock.fileName = yyFileName;
  gBlock.endBodyLine=yyLineNr-1;
  gBlock.lang=SrcLangExt_VHDL;
  Entry *temp=new Entry(gBlock);
  Entry* compound=getVhdlCompound();

  if (compound)
  {
    compound->addSubEntry(temp);
  }
  else
  {
    temp->type="misc"; // global code like library ieee...
    VhdlParser::current_root->addSubEntry(temp);
  }
  strComment.resize(0);
  gBlock.reset();
}// makeInlineDoc
开发者ID:CosmicFish,项目名称:CosmicFish,代码行数:27,代码来源:vhdljjparser.cpp

示例2: findString

int KNFile::findString(const char *s)
{
    QCString searchBuffer;
    searchBuffer.resize(2048);
    char *buffPtr = searchBuffer.data(), *pos;
    int readBytes, currentFilePos;

    while(!atEnd())
    {
        currentFilePos = at();
        readBytes = readBlock(buffPtr, 2047);
        if(readBytes == -1)
            return -1;
        else
            buffPtr[readBytes] = 0;       // terminate string

        pos = strstr(buffPtr, s);
        if(pos == 0)
        {
            if(!atEnd())
                at(at() - strlen(s));
            else
                return -1;
        }
        else
        {
            return currentFilePos + (pos - buffPtr);
        }
    }

    return -1;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:32,代码来源:utilities.cpp

示例3: oneLineComment

void VhdlParser::oneLineComment(QCString qcs)
{
  bool isEndCode=qcs.contains("\\endcode");

  int index = qcs.find("\\code");
  if (isEndCode)
  {
    int end = inputString.find(qcs.data(),iCodeLen);
    makeInlineDoc(end);
  }
  else if (index > 0)
  {
    // assert(false);
    strComment=qcs;
    startCodeBlock(index);
    strComment.resize(0);
  }

  if (!isEndCode && index==-1)
  {
    int j=qcs.find("--!");
    qcs=qcs.right(qcs.length()-3-j);
    if (!checkMultiComment(qcs,iDocLine))
    {
      handleCommentBlock(qcs,TRUE);
    }
  }
}
开发者ID:CosmicFish,项目名称:CosmicFish,代码行数:28,代码来源:vhdljjparser.cpp

示例4: readyRead

void Nntp::readyRead()
{
    // new data arrived on the command socket

    // of we should read the list of available groups, let's do so
    if ( readGroups ) {
	parseGroups();
	return;
    }

    // of we should read an article, let's do so
    if ( readArticle ) {
	parseArticle();
	return;
    }

    // read the new data from the socket
    QCString s;
    s.resize( commandSocket->bytesAvailable() + 1 );
    commandSocket->readBlock( s.data(), commandSocket->bytesAvailable() );

    if ( !url() )
	return;

    // of the code of the server response was 200, we know that the
    // server is ready to get commands from us now
    if ( s.left( 3 ) == "200" )
	connectionReady = TRUE;
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:29,代码来源:nntp.cpp

示例5: exec

/**
 * Execute a KDM/GDM remote control command.
 * @param cmd the command to execute. FIXME: undocumented yet.
 * @param buf the result buffer.
 * @return result:
 *  @li If true, the command was successfully executed.
 *   @p ret might contain addional results.
 *  @li If false and @p ret is empty, a communication error occurred
 *   (most probably KDM is not running).
 *  @li If false and @p ret is non-empty, it contains the error message
 *   from KDM.
 */
bool DM::exec(const char *cmd, QCString &buf)
{
    bool ret = false;
    int tl;
    unsigned len = 0;

    if(fd < 0)
        goto busted;

    tl = strlen(cmd);
    if(::write(fd, cmd, tl) != tl)
    {
    bust:
        ::close(fd);
        fd = -1;
    busted:
        buf.resize(0);
        return false;
    }
    if(DMType == OldKDM)
    {
        buf.resize(0);
        return true;
    }
    for(;;)
    {
        if(buf.size() < 128)
            buf.resize(128);
        else if(buf.size() < len * 2)
            buf.resize(len * 2);
        if((tl = ::read(fd, buf.data() + len, buf.size() - len)) <= 0)
        {
            if(tl < 0 && errno == EINTR)
                continue;
            goto bust;
        }
        len += tl;
        if(buf[len - 1] == '\n')
        {
            buf[len - 1] = 0;
            if(len > 2 && (buf[0] == 'o' || buf[0] == 'O') && (buf[1] == 'k' || buf[1] == 'K') && buf[2] <= 32)
                ret = true;
            break;
        }
    }
    return ret;
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:59,代码来源:dmctl.cpp

示例6: getContents

QCString OutputGenerator::getContents() const
{
  QCString s;
  s.resize(a.size()+1);
  memcpy(s.data(),a.data(),a.size());
  s.at(a.size())='\0';
  return s;
}
开发者ID:tch-opensrc,项目名称:TC72XX_LxG1.0.10mp5_OpenSrc,代码行数:8,代码来源:outputgen.cpp

示例7: parseInput

void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root,
                          bool ,QStrList&)
{
  g_thisParser=this;
  bool inLine=false;
  inputString=fileBuf;

 // fprintf(stderr,"\n ============= %s\n ==========\n",fileBuf);

  if (strlen(fileName)==0)
  {
    inLine=true;
  }

  yyFileName+=fileName;

  bool xilinx_ucf=isConstraintFile(yyFileName,".ucf");
  bool altera_qsf=isConstraintFile(yyFileName,".qsf");

  // support XILINX(ucf) and ALTERA (qsf) file

  if (xilinx_ucf)
  {
    VhdlDocGen::parseUCF(fileBuf,root,yyFileName,FALSE);
    return;
  }
  if (altera_qsf)
  {
    VhdlDocGen::parseUCF(fileBuf,root,yyFileName,TRUE);
    return;
  }
  libUse.setAutoDelete(true);
  yyLineNr=1;
  VhdlParser::current_root=root;
  VhdlParser::lastCompound=0;
  VhdlParser::lastEntity=0;
  VhdlParser::currentCompound=0;
  VhdlParser::lastEntity=0;
  VhdlParser::current=new Entry();
  VhdlParser::initEntry(VhdlParser::current);
  groupEnterFile(fileName,yyLineNr);
  lineParse=new int[200]; // Dimitri: dangerous constant: should be bigger than largest token id in VhdlParserConstants.h
  VhdlParserIF::parseVhdlfile(fileBuf,inLine);

  delete VhdlParser::current;
  VhdlParser::current=0;

  if (!inLine)
  VhdlParser::mapLibPackage(root);

  delete[] lineParse;
  yyFileName.resize(0);
  libUse.clear();
  VhdlDocGen::resetCodeVhdlParserState();
}
开发者ID:Distrotech,项目名称:doxygen,代码行数:55,代码来源:vhdljjparser.cpp

示例8: load

void Editor::load( const QString &fn )
{
    filename = fn;
    QFile f( filename );
    if ( !f.open( IO_ReadOnly ) )
	return;
    QCString txt;
    txt.resize( f.size() );
    f.readBlock( txt.data(), f.size() );
    QString s( QString::fromLatin1( txt ) );
    setText( s );
}
开发者ID:JustDevZero,项目名称:pdfedit5,代码行数:12,代码来源:editor.cpp

示例9: incomingData

void hl_rcon::incomingData(int)
{
	QCString temp;
	QString mooh;
	temp.resize( qsd->bytesAvailable() );
	qsd->readBlock( temp.data(), qsd->bytesAvailable());
	mooh=temp;
	if(mooh.contains("challenge rcon")>=1)
		sendRealCmd(mooh.right(11).left(10));
	if(mooh.contains("Bad rcon_password")>=1)
		emit logMsg("Bad rcon_password");
}
开发者ID:BackupTheBerlios,项目名称:cwbot,代码行数:12,代码来源:hl_rcon.cpp

示例10: dcopNetworkId

QCString dcopNetworkId()
{
    QCString result;
    result.resize(1025);
    QFile file(DCOPClient::dcopServerFile());
    if (!file.open(IO_ReadOnly))
        return "";
    int i = file.readLine(result.data(), 1024);
    if (i <= 0)
        return "";
    result.data()[i-1] = '\0'; // strip newline
    return result;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例11: simplify_comment

// remove first and last line in comment if non significant
QCString Lex::simplify_comment(QCString & comment)
{
  if (comment.isEmpty())
    return comment;
  
  const char * s = comment;
  const char * p = s;
  
  for (;;) {
    switch (*p) {
    case 0:
      return comment;
    case ' ':
    case '\t':
      p += 1;
      break;
    case '\n':
      comment.remove(0, p - s + 1);
      
      if (comment.isEmpty())
	return comment;
      
      s = comment;
      // no break
    default:
      p = s + comment.length() - 1;

      while (p != s) {
	switch(*p) {
	case ' ':
	case '\t':
	  p -= 1;
	  break;
	case '\n':
	  comment.resize(p - s + 1);
	  // no break
	default:
	  return comment;
	}
      }
      
      if (*p == '\n')
	comment = "";
      return comment;
    }
  }
}
开发者ID:,项目名称:,代码行数:48,代码来源:

示例12: decodeQuotedPrintable

QCString MIMECodec::decodeQuotedPrintable(const QCString &text)
{
  if (text.isEmpty() || !text.length())
    return "";

  QCString outstr;
  outstr.resize(text.length() / 3 + 1);
  outstr[0] = 0;
  unsigned index = 0;
  const char *str = text.data();
  char c = 0, c1 = 0, c2 = 0, h = 0;
  unsigned uLength = text.length();

  while (index < uLength) {
    c = str[index];

    if (c == '=') {
      c1 = index < uLength - 1 ? str[index + 1] : '\n';
      c2 = index < uLength - 2 ? str[index + 2] : 'X';

      if (c1 == '\r' && c2 == '\n')
        index += 3;
      else if (c1 == '\n')
        index += 2;
      else {
        c1 = QChar(c1).upper();
        c2 = QChar(c2).upper();
        h = (((c1 >= 'A' && c1 <= 'F') ?
              (c1 - 'A' + 10) :
              (c1 - '0')) * 16) + ((c2 >= 'A' && c2 <= 'F') ? (c2 - 'A' + 10) : (c2 - '0'));
        outstr += h;
        index += 3;
      }
    } else {
      outstr += c;
      index++;
    }
  }

  return outstr;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:41,代码来源:mimecodec.cpp

示例13: writeTooltips

void TooltipManager::writeTooltips(CodeOutputInterface &ol)
{
  QDictIterator<Definition> di(p->tooltipInfo);
  Definition *d;
  for (di.toFirst();(d=di.current());++di)
  {
    DocLinkInfo docInfo;
    docInfo.name   = d->qualifiedName();
    docInfo.ref    = d->getReference();
    docInfo.url    = d->getOutputFileBase();
    docInfo.anchor = d->anchor();
    SourceLinkInfo defInfo;
    if (d->getBodyDef() && d->getStartBodyLine()!=-1)
    {
      defInfo.file    = d->getBodyDef()->name();
      defInfo.line    = d->getStartBodyLine();
      defInfo.url     = d->getSourceFileBase();
      defInfo.anchor  = d->getSourceAnchor();
    }
    SourceLinkInfo declInfo; // TODO: fill in...
    QCString decl;
    if (d->definitionType()==Definition::TypeMember)
    {
      MemberDef *md = (MemberDef*)d;
      decl = md->declaration();
      if (!decl.isEmpty() && decl.at(0)=='@') // hide enum values
      {
        decl.resize(0);
      }
    }
    ol.writeTooltip(di.currentKey(),                 // id
                    docInfo,                         // symName
                    decl,                            // decl
                    d->briefDescriptionAsTooltip(),  // desc
                    defInfo,
                    declInfo
                   );
  }
}
开发者ID:Beachy13,项目名称:doxygen,代码行数:39,代码来源:tooltip.cpp

示例14: encodeQuotedPrintable

QCString MIMECodec::encodeQuotedPrintable(const QCString &str, bool compat, bool footer)
{
  if (str.isEmpty() || !str.length())
    return "";

  const int wrap = 76;
  int i;
  QCString prestr = str;
  QSettings sett;
  bool addFooter = sett.readBoolEntry(AQ_KEYBASE + "/email/addFooter", true);
  qWarning(AQ_KEYBASE + "/email/addFooter");
  qWarning("addFooter %d", addFooter);
  if (footer && addFooter) {
    sett.setPath("InfoSiAL", "AbanQ", QSettings::User);
    QString filepre(sett.readEntry(AQ_KEYBASE + "/email/footerText",
                                   AQ_DATA + "/text_mail.txt"));
    if (filepre.isEmpty()) {
      sett.setPath("InfoSiAL", "FacturaLUX", QSettings::User);
      filepre = sett.readEntry("/facturalux/lite/email/footerText",
                               AQ_DATA + "/text_mail.txt");
    }
    QFile fipre(filepre);
    if (fipre.exists() && fipre.open(IO_ReadOnly)) {
      QTextStream t(&fipre);
      QCString pretxt = t.read().local8Bit();
      fipre.close();
      if (!pretxt.isEmpty())
        prestr += "\n" + pretxt;
    } else
      for (i = 0; i < 257; i++) prestr += preencode[i];
  }
  QCString outstr;
  unsigned uLength = prestr.length();
  const char *ptrStr = prestr.data();
  outstr.resize(uLength);
  outstr[0] = 0;
  unsigned index = 0, lindex = 0;
  char c = 0, c1 = 0, c2 = 0, c3 = 0;

  while (index < uLength) {
    c = ptrStr[index++];

    if (((c >= 33 && c <= 60) || (c >= 62 && c <= 126) || c == 9 || c == 32) &&
        !(compat && QCString("!\"#@[\\]^`{|}~").find(c) != -1)) {
      outstr += c;
      lindex++;
    } else {
      char h1 = (c & 240) / 16, h2 = c & 15;

      h1 = h1 < 10 ? h1 + '0' : h1 - 10 + 'A';
      h2 = h2 < 10 ? h2 + '0' : h2 - 10 + 'A';
      outstr += '=';
      outstr += h1;
      outstr += h2;
      lindex += 3;
    }

    c1 = index   < uLength ? ptrStr[index]   : 'a';
    c2 = index + 1 < uLength ? ptrStr[index + 1] : 'a';
    c3 = index + 2 < uLength ? ptrStr[index + 2] : 'a';

    if (lindex == wrap - 1 || ((c1 < 33 || (c1 > 60 && c1 < 62) || c1 > 126 || (compat && QCString("!\"#@[\\]^`{|}~").find(c1) != -1) ||
                                c2 < 33 || (c2 > 60 && c2 < 62) || c2 > 126 || (compat && QCString("!\"#@[\\]^`{|}~").find(c2) != -1) ||
                                c3 < 33 || (c3 > 60 && c3 < 62) || c3 > 126 || (compat && QCString("!\"#@[\\]^`{|}~").find(c3) != -1)) && lindex == wrap - 3)) {
      outstr += "=\r\n";
      lindex = 0;
    }
  }

  return outstr;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:71,代码来源:mimecodec.cpp

示例15: set_cpp

void UmlOperation::set_cpp(const char * return_form_or_inherit,
			   const char * params, QCString body,
			   bool inlinep, const char * if_def,
			   const char * end_if) {
  if (*return_form_or_inherit == ':') {
    // inherit
    if (inlinep) {
      QCString s = remove_throw(CppSettings::operationDecl());
      int index = s.find("${)}");
      
      s.resize(index + 5);
      s.insert(index, params);
      s.append(" ");
      s.append(return_form_or_inherit);
      if (!body.isEmpty()) {
	s.append(" {\n  ");
	s.append(body);
	s.append("}\n");
      }
      else
	s.append(" {\n}\n");
      conditional(s, if_def, end_if);
      set_CppDecl(s);
      
      set_CppDef("");
    }
    else {
      QCString s = remove_throw(CppSettings::operationDecl());
      int index = s.find("${)}");
      
      s.resize(index + 5);
      s.insert(index, params);
      s.append(";");
      conditional(s, if_def, end_if);
      set_CppDecl(s);
      
      s = remove_throw(CppSettings::operationDef());
      index = s.find("${)}");
      s.resize(index + 5);
      s.insert(index, params);
      s.append(" ");
      s.append(return_form_or_inherit);
      if (!body.isEmpty()) {
	s.append(" {\n  ");
	s.append(body);
	s.append("}\n");
      }
      else
	s.append(" {\n}\n");
      conditional(s, if_def, end_if);
      set_CppDef(s);
    }
  }
  else {
    // return
    if (inlinep) {
      QCString s = remove_throw(CppSettings::operationDecl());
      int index = s.find("${type}");
      
      s.replace(index, 7, return_form_or_inherit);
      s.insert(s.find("${)}", index), params);
      s.resize(s.findRev(";") + 1);
      if (!body.isEmpty()) {
	s.append(" {\n  ");
	s.append(body);
	s.append("}\n");
      }
      else
	s.append(" {\n}\n");
      conditional(s, if_def, end_if);
      set_CppDecl(s);
      
      set_CppDef("");
    }
    else {
      QCString s = remove_throw(CppSettings::operationDecl());
      int index = s.find("${type}");
      
      s.replace(index, 7, return_form_or_inherit);
      s.insert(s.find("${)}", index), params);
      conditional(s, if_def, end_if);
      set_CppDecl(s);
      
      s = remove_throw(CppSettings::operationDef());
      index = s.find("${type}");
      s.replace(index, 7, return_form_or_inherit);
      s.insert(s.find("${)}", index), params);
      conditional(s, if_def, end_if);
      set_CppDef(s);
      
      set_CppBody(body);
    }
  }
}
开发者ID:,项目名称:,代码行数:94,代码来源:


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