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


C++ IndexedString::index方法代码示例

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


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

示例1: visitSimpleTypeSpecifier


//.........这里部分代码省略.........
            break;
          case Token_char32_t:
            type = IntegralType::TypeChar32_t;
            break;
          case Token_wchar_t:
            type = IntegralType::TypeWchar_t;
            break;
          case Token_bool:
            type = IntegralType::TypeBoolean;
            break;
          case Token_short:
            modifiers |= AbstractType::ShortModifier;
            break;
          case Token_int:
            type = IntegralType::TypeInt;
            break;
          case Token_long:
            if (modifiers & AbstractType::LongModifier)
              modifiers |= AbstractType::LongLongModifier;
            else
              modifiers |= AbstractType::LongModifier;
            break;
          case Token_signed:
            modifiers |= AbstractType::SignedModifier;
            break;
          case Token_unsigned:
            modifiers |= AbstractType::UnsignedModifier;
            break;
          case Token_float:
            type = IntegralType::TypeFloat;
            break;
          case Token_double:
            type = IntegralType::TypeDouble;
            break;
          case Token_void:
            type = IntegralType::TypeVoid;
            break;
        }

        it2 = it2->next;
      } while (it2 != end);

      if(type == IntegralType::TypeNone)
        type = IntegralType::TypeInt; //Happens, example: "unsigned short"

      KDevelop::IntegralType::Ptr integral ( new KDevelop::IntegralType(type) );
      integral->setModifiers(modifiers);

      m_type = integral.cast<AbstractType>();

      m_typeId = QualifiedIdentifier(integral->toString());
    }
  else if (node->isTypeof || node->isDecltype)
    {
      if (node->expression)
      {
         bool isDecltypeInParen = false;
        if (node->isDecltype && node->expression->kind == AST::Kind_PrimaryExpression) {
          int startPosition = m_session->token_stream->position(node->expression->start_token);
          static IndexedString paren("(");
          isDecltypeInParen = m_session->contentsVector()[startPosition] == paren.index();
        }

        ExpressionParser parser(false, false, isDecltypeInParen);
        node->expression->ducontext = const_cast<DUContext*>(m_context);
        ExpressionEvaluationResult result = parser.evaluateType(node->expression, m_session);
        m_type = result.type.abstractType();
        m_typeId = QualifiedIdentifier(result.toString());

        {
          LOCKDUCHAIN;
          // Transform specific constants like '5' into their type 'int'
          m_type = TypeUtils::removeConstants(m_type, m_source);
        }
        // make reference for decltype in additional parens - but only if it's not already a reference
        // see spec 7.1.6/4
        if (isDecltypeInParen && m_type && !TypeUtils::isReferenceType(m_type))
        {
          // type might already be a ref type
          ReferenceType::Ptr refType = ReferenceType::Ptr(new ReferenceType);
          refType->setBaseType(m_type);
          m_type = refType.cast<AbstractType>();
          ///TODO: anything todo with m_typeId ?
        }

        if(m_visitor)
          m_visitor->parse(node->expression); // Give the visitor a chance to build uses
      }
    }

  {
    LOCKDUCHAIN;
    find.closeQualifiedIdentifier();
    m_declarations = find.lastDeclarations();
    if(!m_declarations.isEmpty() && m_declarations[0])
      m_type = m_declarations[0]->abstractType();
  }

  visit(node->name);
}
开发者ID:alstef,项目名称:kdevelop,代码行数:101,代码来源:type_visitor.cpp


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