void FasterStringFindCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) return; const auto SingleChar = expr(ignoringParenCasts(stringLiteral(hasSize(1)).bind("literal"))); const auto StringFindFunctions = anyOf(hasName("find"), hasName("rfind"), hasName("find_first_of"), hasName("find_first_not_of"), hasName("find_last_of"), hasName("find_last_not_of")); llvm::Optional<ast_matchers::internal::Matcher<NamedDecl>> IsStringClass; for (const auto &ClassName : StringLikeClasses) { const auto HasName = hasName(ClassName); IsStringClass = IsStringClass ? anyOf(*IsStringClass, HasName) : HasName; } if (IsStringClass) { Finder->addMatcher( cxxMemberCallExpr( callee(functionDecl(StringFindFunctions).bind("func")), anyOf(argumentCountIs(1), argumentCountIs(2)), hasArgument(0, SingleChar), on(expr(hasType(recordDecl(*IsStringClass)), unless(hasSubstitutedType())))), this); } }
void FasterStringFindCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) return; const auto SingleChar = expr(ignoringParenCasts(stringLiteral(hasSize(1)).bind("literal"))); const auto StringFindFunctions = hasAnyName("find", "rfind", "find_first_of", "find_first_not_of", "find_last_of", "find_last_not_of"); Finder->addMatcher( cxxMemberCallExpr( callee(functionDecl(StringFindFunctions).bind("func")), anyOf(argumentCountIs(1), argumentCountIs(2)), hasArgument(0, SingleChar), on(expr( hasType(hasUnqualifiedDesugaredType(recordType(hasDeclaration( recordDecl(hasAnyName(SmallVector<StringRef, 4>( StringLikeClasses.begin(), StringLikeClasses.end()))))))), unless(hasSubstitutedType())))), this); }
void insert(const vle::value::ConstVectorView& col) { unsigned int nbEl = col.size(); bool hasName = not col[0]->isDouble(); if (hasName) {//first element is the col name nbEl --; } if (not hasSize()) { setSize(nbEl); } else { if (nbEl != mstats.size()) { throw "error"; } } for (unsigned int i=0; i < nbEl ; i++) { if (hasName) { mstats[i].insert(col[i+1]->toDouble().value()); } else { mstats[i].insert(col[i]->toDouble().value()); } } }
void CC3UniformlyEvolvingPointParticle::updateBeforeTransform( CC3NodeUpdatingVisitor* visitor ) { super::updateBeforeTransform( visitor ); if( !isAlive() ) return; GLfloat dt = visitor->getDeltaTime(); if ( hasSize() ) setSize( getSize() + (m_sizeVelocity * dt) ); if ( hasColor() ) { // We have to do the math on each component instead of using the color math functions // because the functions clamp prematurely, and we need negative values for the velocity. ccColor4F currColor = getColor4F(); setColor4F( ccc4f(CLAMP(currColor.r + (m_colorVelocity.r * dt), 0.0f, 1.0f), CLAMP(currColor.g + (m_colorVelocity.g * dt), 0.0f, 1.0f), CLAMP(currColor.b + (m_colorVelocity.b * dt), 0.0f, 1.0f), CLAMP(currColor.a + (m_colorVelocity.a * dt), 0.0f, 1.0f)) ); } }
DataTypeInformation::size_t DataTypeInformation::getSize() const { assert::that(hasSize()); return _size; }
GLfloat CC3PointParticle::getSize() { CC3PointParticleEmitter* pe = (CC3PointParticleEmitter*)m_pEmitter; return hasSize() ? pe->getParticleSizeAt(m_particleIndex) : pe->getParticleSize(); }