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


C++ ArgumentList::count方法代码示例

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


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

示例1: it

ClassDef *GenericsSDict::find(const QCString &key)
{
  int i=key.find('<');
  if (i==-1)
  {
    GenericsCollection *collection = m_dict.find(key);
    if (collection && collection->count()==1)
    {
      QIntDictIterator<ClassDef> it(*collection);
      return it.current();
    }
  }
  else
  {
    GenericsCollection *collection = m_dict.find(key.left(i));
    if (collection)
    {
      ArgumentList argList;
      stringToArgumentList(key.mid(i),&argList);
      int c = argList.count();
      return collection->find(c);
    }
  }
  return 0;
}
开发者ID:stden,项目名称:doxygen,代码行数:25,代码来源:classlist.cpp

示例2: makeFunction

QString makeFunction(FunctionModelItem function, const QString preFix = QString()) {
    QString fullName;
    fullName += function->type().toString();
    fullName += " ";
    fullName += preFix;
    fullName += function->name();
    ArgumentList arguments = function->arguments();
    QStringList args;
    for (int i = 0; i < arguments.count(); ++i) {
        QString arg = arguments[i]->name();
        if (arg.isEmpty())
            arg = QString("arg%1").arg(i);
        QString theargs = arguments[i]->type().toString() + " " + arg;
        if (arguments[i]->defaultValue())
            theargs += " = " + arguments[i]->defaultValueExpression();
        args += theargs;
    }
    fullName += "(" + args.join(", ") + ")";
    if (function->isConstant())
        fullName +=  " const";

    if (function->isStatic())
        fullName =  "static " + fullName;

    return fullName;
}
开发者ID:icefox,项目名称:qautotestgenerator,代码行数:26,代码来源:main.cpp

示例3: stringToArgumentList

QSharedPointer<ClassDef> GenericsSDict::find(const QString &key)
{
   int i = key.indexOf('<');

   if (i == -1) {
       QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key);

      if (collection && collection->count() == 1) {        
         return collection->begin().value();
      }

   } else {
      QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key.left(i));

      if (collection) {
         ArgumentList argList;
         stringToArgumentList(key.mid(i), &argList);

         int c = argList.count();
         return collection->value(c);
      }
   }

   return QSharedPointer<ClassDef>();
}
开发者ID:pepr,项目名称:doxypress,代码行数:25,代码来源:classlist.cpp

示例4: insert

void GenericsSDict::insert(const QString &key, QSharedPointer<ClassDef> cd)
{
   int i = key.indexOf('<');

   if (i == -1) {
      return;
   }

   ArgumentList argList;
   stringToArgumentList(key.mid(i), &argList);

   int c = argList.count();

   if (c == 0) {
      return;
   }

   QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key.left(i));

   if (collection == 0) {
      // new hash
      collection = QMakeShared<QHash<long, QSharedPointer<ClassDef>>>();       

      // add new hash to m_dict
      m_dict.insert(key.left(i), collection);
   }

   if (! collection->contains(c)) {
      // add the collection
      collection->insert(c, cd);
   }
}
开发者ID:pepr,项目名称:doxypress,代码行数:32,代码来源:classlist.cpp

示例5: insert

void GenericsSDict::insert(const QCString &key,ClassDef *cd)
{
  int i=key.find('<');
  if (i==-1) return;
  ArgumentList argList;
  stringToArgumentList(key.mid(i),&argList);
  int c = argList.count();
  if (c==0) return;
  GenericsCollection *collection = m_dict.find(key.left(i));
  if (collection==0) // new name
  {
    collection = new GenericsCollection;
    m_dict.append(key.left(i),collection);
  }
  if (collection->find(c)==0) // should always be 0!
  {
    collection->insert(c,cd);
  }
}
开发者ID:stden,项目名称:doxygen,代码行数:19,代码来源:classlist.cpp

示例6: generateDEFForMember

void generateDEFForMember(MemberDef *md,
    FTextStream &t,
    Definition *def,
    const char* Prefix)
{
  QCString memPrefix;

  // + declaration
  // - reimplements
  // - reimplementedBy
  // - exceptions
  // - const/volatile specifiers
  // - examples
  // + source definition
  // - source references
  // - source referenced by
  // - include code 

  if (md->memberType()==MemberDef::EnumValue) return;

  QCString scopeName;
  if (md->getClassDef()) 
    scopeName=md->getClassDef()->name();
  else if (md->getNamespaceDef()) 
    scopeName=md->getNamespaceDef()->name();

  t << "    " << Prefix << "-member = {" << endl;
  memPrefix = "      ";
  memPrefix.append( Prefix );
  memPrefix.append( "-mem-" );

  QCString memType;
  bool isFunc=FALSE;
  switch (md->memberType())
  {
    case MemberDef::Define:      memType="define";    break;
    case MemberDef::EnumValue:   ASSERT(0);           break;
    case MemberDef::Property:    memType="property";  break;
    case MemberDef::Event:       memType="event";     break;
    case MemberDef::Variable:    memType="variable";  break;
    case MemberDef::Typedef:     memType="typedef";   break;
    case MemberDef::Enumeration: memType="enum";      break;
    case MemberDef::Function:    memType="function";  isFunc=TRUE; break;
    case MemberDef::Signal:      memType="signal";    isFunc=TRUE; break;
    case MemberDef::Friend:      memType="friend";    isFunc=TRUE; break;
    case MemberDef::DCOP:        memType="dcop";      isFunc=TRUE; break;
    case MemberDef::Slot:        memType="slot";      isFunc=TRUE; break;
  }

  t << memPrefix << "kind = '" << memType << "';" << endl;
  t << memPrefix << "id   = '"
    << md->getOutputFileBase() << "_1" << md->anchor()
    << "';" << endl;

  t << memPrefix << "virt = ";
  switch (md->virtualness())
  {
    case Normal:  t << "normal;"       << endl; break;
    case Virtual: t << "virtual;"      << endl; break;
    case Pure:    t << "pure-virtual;" << endl; break;
    default: ASSERT(0);
  }

  t << memPrefix << "prot = ";
  switch(md->protection())
  {
    case Public:    t << "public;"    << endl; break;
    case Protected: t << "protected;" << endl; break;
    case Private:   t << "private;"   << endl; break;
    case Package:   t << "package;"   << endl; break;
  }

  if (md->memberType()!=MemberDef::Define &&
      md->memberType()!=MemberDef::Enumeration
     )
  {
    QCString typeStr = replaceAnonymousScopes(md->typeString());
    t << memPrefix << "type = <<_EnD_oF_dEf_TeXt_" << endl << typeStr << endl
      << "_EnD_oF_dEf_TeXt_;" << endl;
  }

  t << memPrefix << "name = '" << md->name() << "';" << endl;

  if (isFunc) //function
  {
    ArgumentList *declAl = new ArgumentList;
    LockingPtr<ArgumentList> defAl = md->argumentList();
    stringToArgumentList(md->argsString(),declAl);
    QCString fcnPrefix = "  " + memPrefix + "param-";

    if (declAl->count()>0)
    {
      ArgumentListIterator declAli(*declAl);
      ArgumentListIterator defAli(*defAl);
      Argument *a;
      for (declAli.toFirst();(a=declAli.current());++declAli)
      {
        Argument *defArg = defAli.current();
        t << memPrefix << "param = {" << endl;
        if (!a->attrib.isEmpty())
//.........这里部分代码省略.........
开发者ID:fourmond,项目名称:doxygen-ruby-patch,代码行数:101,代码来源:defgen.cpp

示例7: if

    foreach (FunctionModelItem fun, functions) {
        if (done.contains(fun->name()))
            continue;

        // data function
        out << endl;

        QStringList fetchMeType;
        QStringList fetchMeName;

        ArgumentList arguments = fun->arguments();
        for (int i = 0; i < arguments.count(); ++i) {
            QString type = arguments[i]->type().toString();
            type = type.mid(0, type.indexOf(' '));
            QString name = arguments[i]->name();
            if (arguments[i]->type().indirections()) {
                type = "int";
                name = name + "Count";
            }
            fetchMeType << type;
            fetchMeName << name;
        }
        if (fun->type().toString() != "void") {
            QString returnType = fun->type().toString();
            fetchMeType << returnType;
            fetchMeName << fun->name();
        }
        if (fetchMeType.isEmpty()) {
            fetchMeType << "int";
            fetchMeName << "foo";
        }

        QStringList knownTypes;
        knownTypes << "int" << "qreal" << "bool" << "QString" << "QRectF" << "QPointF" << "QPixmap" << "QFont" << "QUrl" << "uint" << "QImage" << "QStringList";
        bool knowAllTypes = true;
        for (int i = 0; i < fetchMeType.count(); ++i) {
            if (!knownTypes.contains(fetchMeType[i])) {
                if (!declared.contains(fetchMeType[i])) {
                    out << "Q_DECLARE_METATYPE(" << fetchMeType[i] << ")" << endl;
                    declared.append(fetchMeType[i]);
                }
                knowAllTypes = false;
            }
        }


        out << QString("void %1::%2_data()\n{").arg(tstClassName).arg(fun->name()) << endl;

        if (!knowAllTypes)
            out << "#if 0" << endl;
        for (int i = 0; i < fetchMeType.count(); ++i)
            out << indent << QString("QTest::addColumn<%1>(\"%2\");").arg(fetchMeType[i]).arg(fetchMeName[i]) << endl;

        bool stubbed = false;
        // fill out the most common cases
        if (fetchMeType.count() == 1
            && fetchMeType[0] == "bool") {
            out << indent << "QTest::newRow(\"true\") << true;" << endl;
            out << indent << "QTest::newRow(\"false\") << false;" << endl;
            stubbed = true;
        }
        if (fetchMeType.count() == 1
            && fetchMeType[0] == "QString") {
            out << indent << "QTest::newRow(\"null\") << QString();" << endl;
            out << indent << "QTest::newRow(\"foo\") << QString(\"foo\");" << endl;
            stubbed = true;
        }
        if (fetchMeType.count() == 1
            && fetchMeType[0] == "int") {
            out << indent << "QTest::newRow(\"0\") << 0;" << endl;
            out << indent << "QTest::newRow(\"-1\") << -1;" << endl;
            stubbed = true;
        }

        if (!stubbed) {
            out << indent << "QTest::newRow(\"null\")";
            for (int i = 0; i < fetchMeType.count(); ++i) {
                out << " << ";
                if (fetchMeType[i] == "int")
                    out << "0";
                else if (fetchMeType[i] == "qreal")
                    out << "0.0";
                else if (fetchMeType[i] == "bool")
                    out << "false";
                else if (fetchMeType[i] == "QString")
                    out << "QString()";
                else
                    out << fetchMeType[i] << "()";
            }
            out << ";" << endl;
        }

        if (!knowAllTypes)
            out << "#endif" << endl;
        out << "}" << endl;

        out << endl;
        out << "// " << convertAccessPolicy(fun->accessPolicy()) << " " << makeFunction(fun) << endl;
        out << QString("void %1::%2()").arg(tstClassName).arg(fun->name()) << endl;
        out << "{" << endl;
//.........这里部分代码省略.........
开发者ID:icefox,项目名称:qautotestgenerator,代码行数:101,代码来源:main.cpp

示例8: outputFile

void outputFile(ClassModelItem clazz, FunctionList functions,
                QList<QPair<QString,QString> > extraFunctions)
{
    // setup
    QString className = clazz->name();
    QString shortName = className.mid(className.lastIndexOf(QRegExp("[A-Z][a-z]*"))).toLower();
    QString tstClassName = "tst_" + className;
    QString indent = "    ";
    QTextStream out(stdout);

    // Includes
    out << endl;
    out << "#include <QtTest/QtTest>" << endl;
    QString classFileName = clazz->fileName().mid(clazz->fileName().indexOf('/'));
    if (classFileName[0] == '/')
        classFileName = classFileName.mid(1);
    out << "#include <" << classFileName << ">" << endl;

    // Generate class definition
    out << endl;
    out << QString("class %1 : public QObject").arg(tstClassName) << endl;
    out << "{" << endl;
    {
        out << indent << "Q_OBJECT" << endl;

        out << endl;
        out << "public slots:" << endl;
        for(int i = 0; i < extraFunctions.count(); ++i) {
            out << indent << QString("void %1();").arg(extraFunctions.at(i).first) << endl;

        }

        out << endl;
        out << "private slots:" << endl;
        out << indent << QString("void %1_data();").arg(className.toLower()) << endl;
        out << indent << QString("void %1();").arg(className.toLower()) << endl;
        out << endl;
        QStringList done;
        foreach (FunctionModelItem fun, functions) {
            if (done.contains(fun->name()))
                continue;
            out << indent << QString("void %1_data();").arg(fun->name()) << endl;
            out << indent << QString("void %1();").arg(fun->name()) << endl;
            done.append(fun->name());
        }
    }
    out << "};" << endl;


    // Generate subclass
    out << endl;
    out << "// Subclass that exposes the protected functions." << endl;
    out << "class Sub" + className + " : public " << className << endl;
    out << "{" << endl;
    {
        out << "public:" << endl;
        foreach (FunctionModelItem fun, functions) {
            // implement protected or virtual functions
            if (fun->accessPolicy() != CodeModel::Protected && !fun->isAbstract())
                continue;

            if (fun->isAbstract())
                out << indent << QString("// %1::%2 is a pure virtual function.").arg(className).arg(fun->name()) << endl;
            out << indent << makeFunction(fun, fun->isAbstract() ? "" : "call_") << endl;

            out << indent << indent << "{ ";
            {
                ArgumentList arguments = fun->arguments();
                if (!fun->isAbstract()) {
                    QStringList args;
                    for (int j = 0; j < arguments.count(); ++j) {
                        QString arg = arguments[j]->name();
                        if (arg.isEmpty())
                            arg = QString("arg%1").arg(j);
                        args += arg;
                    }
                    out << QString("return Sub%1::%2(%3);").arg(className).arg(fun->name()).arg(args.join(", "));
                }
            }
            out << " }" << endl;
            out << endl;
        }
    }
    out << "};" << endl;


    // Generate extra functions
    for(int i = 0; i < extraFunctions.count(); ++i) {
        out << endl;
        out << QString("// %1").arg(extraFunctions.at(i).second) << endl;
        out << QString("void %1::%2()\n{\n}").arg(tstClassName).arg(extraFunctions.at(i).first) << endl;
    }

    QStringList declared;

    // Make the test that calls every function
    out << endl;
    out << QString("void %1::%2_data()\n{\n}\n").arg(tstClassName).arg(className.toLower()) << endl;
    out << QString("void %1::%2()").arg(tstClassName).arg(className.toLower()) << endl;
    out << "{" << endl;
//.........这里部分代码省略.........
开发者ID:icefox,项目名称:qautotestgenerator,代码行数:101,代码来源:main.cpp

示例9: insertMember

bool GroupDef::insertMember(MemberDef *md,bool docOnly)
{
  if (md->isHidden()) return FALSE;
  updateLanguage(md);
  //printf("GroupDef(%s)::insertMember(%s)\n", title.data(), md->name().data());
  MemberNameInfo *mni=0;
  if ((mni=(*allMemberNameInfoSDict)[md->name()]))
  { // member with this name already found
    MemberNameInfoIterator srcMnii(*mni); 
    MemberInfo *srcMi;
    for ( ; (srcMi=srcMnii.current()) ; ++srcMnii )
    {
      MemberDef *srcMd = srcMi->memberDef;
      if (srcMd==md) return FALSE; // already added before!

      bool sameScope = srcMd->getOuterScope()==md->getOuterScope() || // same class or namespace
          // both inside a file => definition and declaration do not have to be in the same file
           (srcMd->getOuterScope()->definitionType()==Definition::TypeFile &&
               md->getOuterScope()->definitionType()==Definition::TypeFile); 

      ArgumentList *srcMdAl  = srcMd->argumentList();
      ArgumentList *mdAl     = md->argumentList();
      ArgumentList *tSrcMdAl = srcMd->templateArguments();
      ArgumentList *tMdAl    = md->templateArguments();
      
      if (srcMd->isFunction() && md->isFunction() && // both are a function
          ((tSrcMdAl==0 && tMdAl==0) || 
           (tSrcMdAl!=0 && tMdAl!=0 && tSrcMdAl->count()==tMdAl->count())
          ) &&       // same number of template arguments
          matchArguments2(srcMd->getOuterScope(),srcMd->getFileDef(),srcMdAl,
                          md->getOuterScope(),md->getFileDef(),mdAl,
                          TRUE
                         ) && // matching parameters
          sameScope // both are found in the same scope
         )
      {
        if (srcMd->getGroupAlias()==0) 
        {
          md->setGroupAlias(srcMd); 
        }
        else if (md!=srcMd->getGroupAlias())
        {
          md->setGroupAlias(srcMd->getGroupAlias()); 
        }
        return FALSE; // member is the same as one that is already added
      }
    }
    mni->append(new MemberInfo(md,md->protection(),md->virtualness(),FALSE));
  }
  else
  {
    mni = new MemberNameInfo(md->name());
    mni->append(new MemberInfo(md,md->protection(),md->virtualness(),FALSE));
    allMemberNameInfoSDict->append(mni->memberName(),mni);
  }
  //printf("Added member!\n");
  allMemberList->append(md); 
  switch(md->memberType())
  {
    case MemberType_Variable:     
      if (!docOnly)
      {
        addMemberToList(MemberListType_decVarMembers,md);
      }
      addMemberToList(MemberListType_docVarMembers,md);
      break;
    case MemberType_Function: 
      if (!docOnly)
      {
        addMemberToList(MemberListType_decFuncMembers,md);
      }
      addMemberToList(MemberListType_docFuncMembers,md);
      break;
    case MemberType_Typedef:      
      if (!docOnly)
      {
        addMemberToList(MemberListType_decTypedefMembers,md);
      }
      addMemberToList(MemberListType_docTypedefMembers,md);
      break;
    case MemberType_Enumeration:  
      if (!docOnly)
      {
        addMemberToList(MemberListType_decEnumMembers,md);
      }
      addMemberToList(MemberListType_docEnumMembers,md);
      break;
    case MemberType_EnumValue:    
      if (!docOnly)
      {
        addMemberToList(MemberListType_decEnumValMembers,md);
      }
      addMemberToList(MemberListType_docEnumValMembers,md);
      break;
    case MemberType_Define:       
      if (!docOnly)
      {
        addMemberToList(MemberListType_decDefineMembers,md);
      }
      addMemberToList(MemberListType_docDefineMembers,md);
//.........这里部分代码省略.........
开发者ID:wufengyi,项目名称:doxygen,代码行数:101,代码来源:groupdef.cpp

示例10: if


//.........这里部分代码省略.........
    if (typeStr.data())
    {
      bindTextParameter(i_s_memberdef,":type",typeStr.data(),FALSE);
    }

    if (md->definition())
    {
      bindTextParameter(i_s_memberdef,":definition",md->definition());
    }

    if (md->argsString())
    {
      bindTextParameter(i_s_memberdef,":argsstring",md->argsString());
    }
  }

  bindTextParameter(i_s_memberdef,":name",md->name());

  if (md->memberType() == MemberType_Property)
  {
    if (md->isReadable())
    {
      DBG_CTX(("<read>\n"));
    }
    if (md->isWritable())
    {
      DBG_CTX(("<write>\n"));
    }
  }
  if (isFunc) //function
  {
    ArgumentList *declAl = md->declArgumentList();
    ArgumentList *defAl = md->argumentList();
    if (declAl!=0 && declAl->count()>0)
    {
      ArgumentListIterator declAli(*declAl);
      ArgumentListIterator defAli(*defAl);
      Argument *a;
      for (declAli.toFirst();(a=declAli.current());++declAli)
      {
        Argument *defArg = defAli.current();
        DBG_CTX(("<param>\n"));
        if (!a->attrib.isEmpty())
        {
          DBG_CTX(("<attributes>:%s\n",a->attrib.data()));
        }
        if (!a->type.isEmpty())
        {
          StringList l;
          linkifyText(TextGeneratorSqlite3Impl(l),def,md->getBodyDef(),md,a->type);

          StringListIterator li(l);
          QCString *s;
          while ((s=li.current()))
          {
            insertMemberReference(db,md->anchor().data(),s->data(),def->getDefFileName().data(),md->getDefLine(),1);
            ++li;
          }
        }
        if (!a->name.isEmpty())
        {
          DBG_CTX(("<declname>%s\n",a->name.data()));
        }
        if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name)
        {
          DBG_CTX(("<defname>%s\n",defArg->name.data()));
开发者ID:hakanardo,项目名称:doxygen,代码行数:67,代码来源:sqlite3gen.cpp


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