void ContainerSizeEmptyCheck::registerMatchers(MatchFinder *Finder) {
  const auto WrongUse = anyOf(
      hasParent(
          binaryOperator(
              anyOf(has(integerLiteral(equals(0))),
                    allOf(anyOf(hasOperatorName("<"), hasOperatorName(">="),
                                hasOperatorName(">"), hasOperatorName("<=")),
                          hasEitherOperand(integerLiteral(equals(1))))))
              .bind("SizeBinaryOp")),
      hasParent(implicitCastExpr(
          hasImplicitDestinationType(isBoolType()),
          anyOf(
              hasParent(unaryOperator(hasOperatorName("!")).bind("NegOnSize")),
              anything()))),
      hasParent(explicitCastExpr(hasDestinationType(isBoolType()))));

  Finder->addMatcher(
      memberCallExpr(
          on(expr(anyOf(hasType(namedDecl(stlContainer())),
                        hasType(pointsTo(namedDecl(stlContainer()))),
                        hasType(references(namedDecl(stlContainer())))))
                 .bind("STLObject")),
          callee(methodDecl(hasName("size"))), WrongUse).bind("SizeCallExpr"),
      this);
}
namespace EffectiveCPP {

    StatementMatcher ctorCallVtlMatcherEC = compoundStmt(
            hasParent(constructorDecl().bind("cDecl")),
            hasDescendant(callExpr(callee(methodDecl(isVirtual()))))
            );
    
    StatementMatcher dtorCallVtlMatcherEC = compoundStmt(
            hasParent(destructorDecl().bind("dDecl")),
            hasDescendant(callExpr(callee(methodDecl(isVirtual()))))
            );
}
void MultiwayPathsCoveredCheck::registerMatchers(MatchFinder *Finder) {
  Finder->addMatcher(
      switchStmt(
          hasCondition(allOf(
              // Match on switch statements that have either a bit-field or
              // an integer condition. The ordering in 'anyOf()' is
              // important because the last condition is the most general.
              anyOf(ignoringImpCasts(memberExpr(hasDeclaration(
                        fieldDecl(isBitField()).bind("bitfield")))),
                    ignoringImpCasts(declRefExpr().bind("non-enum-condition"))),
              // 'unless()' must be the last match here and must be bound,
              // otherwise the matcher does not work correctly, because it
              // will not explicitly ignore enum conditions.
              unless(ignoringImpCasts(
                  declRefExpr(hasType(enumType())).bind("enum-condition"))))))
          .bind("switch"),
      this);

  // This option is noisy, therefore matching is configurable.
  if (WarnOnMissingElse) {
    Finder->addMatcher(
        ifStmt(allOf(hasParent(ifStmt()), unless(hasElse(anything()))))
            .bind("else-if"),
        this);
  }
}
Пример #4
0
void Node::updateWorldTransform() const
{
    // make sure we are not doing any unnecessary function calls
    GRAPHICS_RUNTIME_ASSERT(worldTransformValid_ == false);

    if (hasParent())
    {
        // world transform of the parent node
        const Transform3 t = parent_->worldTransform();

        worldTransform_.translation = ::transform(localTransform_.translation, t);
        worldTransform_.rotation = localTransform_.rotation;
        worldTransform_.scaling = localTransform_.scaling;

        if (rotationLocked_ == false)
        {
            worldTransform_.rotation *= t.rotation;
        }

        if (scalingLocked_ == false)
        {
            worldTransform_.scaling *= t.scaling;
        }
    }
    else
    {
        // no parent node, world transform is equal to the local transform
        worldTransform_ = localTransform_;
    }

    worldTransformValid_ = true;
}
Пример #5
0
Node::~Node()
{
    // make sure we are not deleting a node that is still attached
    GRAPHICS_RUNTIME_ASSERT(hasParent() == false);

    // TODO: unregister from scene
}
void ForwardingReferenceOverloadCheck::registerMatchers(MatchFinder *Finder) {
  // Forwarding references require C++11 or later.
  if (!getLangOpts().CPlusPlus11)
    return;

  auto ForwardingRefParm =
      parmVarDecl(
          hasType(qualType(rValueReferenceType(),
                           references(templateTypeParmType(hasDeclaration(
                               templateTypeParmDecl().bind("type-parm-decl")))),
                           unless(references(isConstQualified())))))
          .bind("parm-var");

  DeclarationMatcher findOverload =
      cxxConstructorDecl(
          hasParameter(0, ForwardingRefParm),
          unless(hasAnyParameter(
              // No warning: enable_if as constructor parameter.
              parmVarDecl(hasType(isEnableIf())))),
          unless(hasParent(functionTemplateDecl(has(templateTypeParmDecl(
              // No warning: enable_if as type parameter.
              hasDefaultArgument(isEnableIf())))))))
          .bind("ctor");
  Finder->addMatcher(findOverload, this);
}
Пример #7
0
//! ---|> Component
void Connector::doLayout(){

	Geometry::Vec2 parentsAbsPos=hasParent()?getParent()->getAbsPosition():Geometry::Vec2();

	Geometry::Rect r;
	r.invalidate();
//	std::cout << r.getX();

	if( getFirstComponent() )
		r.include( getFirstComponent()->getAbsRect().getCenter()-parentsAbsPos );
//	std::cout << (getFirstComponent()->getAbsRect().getCenter()-parentsAbsPos).getX();

	if( getSecondComponent() )
		r.include( getSecondComponent()->getAbsRect().getCenter()-parentsAbsPos );

	if(getContentsCount()>2){
		// TODO!!!!!
	}
	setPosition(Geometry::Vec2(r.getX(),r.getY()));
	setSize(r.getWidth(),r.getHeight());
	Geometry::Vec2 myAbsPos=getAbsPosition();

	if(getFirstChild() && getFirstComponent()){
		getFirstChild()->setPosition( getFirstComponent()->getAbsRect().getCenter()-myAbsPos );
	}
	if(getLastChild() && getSecondComponent()){
		getLastChild()->setPosition( getSecondComponent()->getAbsRect().getCenter()-myAbsPos );
//		getLastChild()->setPosition(Vec2(r.getWidth(),r.getHeight()));
	}

	if(getContentsCount()>2){
		// TODO!!!!!
	}
}
bool BinaryNode::isRightChild(){
    if(hasParent()){
        return (this == parent->rightChild);
    }
    
    return false;
}
Пример #9
0
int PropertyItem::index() const
{
    if (!hasParent())
        return -1;
    
    return m_parent->indexOf(this);
}
Пример #10
0
bool AIComponent::hasTarget()
{
    auto t = getTarget();
    if (t != nullptr)
    {
        es::ComponentFilter targetFilter;
        targetFilter.requires(FactionComponent::getId());
        targetFilter.requires(TransformComponent::getId());
        targetFilter.requires(StatComponent::getId());
        if (t->hasComponents(targetFilter) && hasParent())
        {
            sf::Vector2f ePos = mParent->getComponent<TransformComponent>().getPosition();
            sf::Vector2f tPos = t->getComponent<TransformComponent>().getPosition();
            if (t->getId() != mParent->getId() && t->getComponent<StatComponent>().isAlive() && thor::length(ePos - tPos) < mOutOfView && mParent->hasComponent<FactionComponent>())
            {
                if (mParent->getComponent<FactionComponent>().getFaction().isEnemy(t->getComponent<FactionComponent>().getFactionId()))
                {
                    return true;
                }
            }
            else
            {
                mTarget = 0;
            }
        }
        else
        {
            mTarget = 0;
        }
    }
    return false;
}
Пример #11
0
void NotePlayHandle::noteOff( const f_cnt_t _s )
{
	if( m_released )
	{
		return;
	}

	// first note-off all sub-notes
	for( NotePlayHandleList::Iterator it = m_subNotes.begin(); it != m_subNotes.end(); ++it )
	{
		( *it )->noteOff( _s );
	}

	// then set some variables indicating release-state
	m_framesBeforeRelease = _s;
	m_releaseFramesToDo = qMax<f_cnt_t>( 0, actualReleaseFramesToDo() );

	if( hasParent() || ! m_instrumentTrack->isArpeggioEnabled() )
	{
		// send MidiNoteOff event
		m_instrumentTrack->processOutEvent(
				MidiEvent( MidiNoteOff, midiChannel(), midiKey(), 0 ),
				MidiTime::fromFrames( _s, engine::framesPerTick() ), 
				_s );
	}

	// inform attached components about MIDI finished (used for recording in Piano Roll)
	if( m_origin == OriginMidiInput )
	{
		setLength( MidiTime( static_cast<f_cnt_t>( totalFramesPlayed() / engine::framesPerTick() ) ) );
		m_instrumentTrack->midiNoteOff( *this );
	}

	m_released = true;
}
Пример #12
0
void NotePlayHandle::done()
{
	lock();
	noteOff( 0 );

	if( hasParent() == false )
	{
		delete m_baseDetuning;
		m_instrumentTrack->m_processHandles.removeAll( this );
	}
	else
	{
		m_parent->m_subNotes.removeOne( this );
	}

	if( m_pluginData != NULL )
	{
		m_instrumentTrack->deleteNotePluginData( this );
	}

	if( m_instrumentTrack->m_notes[key()] == this )
	{
		m_instrumentTrack->m_notes[key()] = NULL;
	}

	m_subNotes.clear();

	delete m_filter;

	if( buffer() ) releaseBuffer();

	unlock();
}
Пример #13
0
NotePlayHandle::~NotePlayHandle()
{
	noteOff( 0 );
	
	if( hasParent() == false )
	{
		delete m_baseDetuning;
		m_instrumentTrack->m_processHandles.removeAll( this );
	}

	if( m_pluginData != NULL )
	{
		m_instrumentTrack->deleteNotePluginData( this );
	}

	if( m_instrumentTrack->m_notes[key()] == this )
	{
		m_instrumentTrack->m_notes[key()] = NULL;
	}

	for( NotePlayHandleList::Iterator it = m_subNotes.begin(); it != m_subNotes.end(); ++it )
	{
		delete *it;
	}
	m_subNotes.clear();

	delete m_filter;
}
void UseEqualsDeleteCheck::registerMatchers(MatchFinder *Finder) {
  auto PrivateSpecialFn = cxxMethodDecl(
      isPrivate(),
      anyOf(cxxConstructorDecl(anyOf(isDefaultConstructor(),
                                     isCopyConstructor(), isMoveConstructor())),
            cxxMethodDecl(
                anyOf(isCopyAssignmentOperator(), isMoveAssignmentOperator())),
            cxxDestructorDecl()));

  Finder->addMatcher(
      cxxMethodDecl(
          PrivateSpecialFn,
          unless(anyOf(hasBody(stmt()), isDefaulted(), isDeleted(),
                       ast_matchers::isTemplateInstantiation(),
                       // Ensure that all methods except private special member
                       // functions are defined.
                       hasParent(cxxRecordDecl(hasMethod(unless(
                           anyOf(PrivateSpecialFn, hasBody(stmt()), isPure(),
                                 isDefaulted(), isDeleted()))))))))
          .bind(SpecialFunction),
      this);

  Finder->addMatcher(
      cxxMethodDecl(isDeleted(), unless(isPublic())).bind(DeletedNotPublic),
      this);
}
Пример #15
0
 void Node::setChildrenModified(TimeStamp t)
 {
   if (t > properties.childrenMTime) {
     properties.childrenMTime = t;
     if (hasParent())
       parent().setChildrenModified(properties.childrenMTime);
   }
 }
Пример #16
0
void MObject3d::updateMatrix(void)
{
	computeLocalMatrix();

	if(hasParent()){
		m_matrix = m_parent->m_matrix * m_matrix;
	}
}
Пример #17
0
SumoXMLTag
GNEAttributeCarrier::getParentType(SumoXMLTag tag) {
    if(hasParent(tag)) {
        return myAllowedAdditionalWithParentTags[tag];
    } else {
        return SUMO_TAG_NOTHING;
    }
}
Пример #18
0
void Object::setTakesLayoutSpaceIfHidden(bool a) {
	takesLayoutSpaceIfHidden = a;
	// if parent is layout recompute
	if(hasParent() && DanvilIsOfType<Layout, Object>(parent)) {
		PTR(Layout) layout = DanvilConvert<Layout, Object>(parent);
		layout->update();
	}
}
Пример #19
0
 void TreeNode::_setParent( TreeNode * node ){
     if( !hasParent() ){
         _parent = node;
         dispatchEvent( new hrfm::events::Event(hrfm::events::Event::ADDED) );
     }else{
         _parent = node;
     }
 }
Пример #20
0
std::string Component::toString() const {
    std::string ret;
    if (hasParent()) {
        ret += parent()->toString() + ".";
    }

    ret += name();
    return ret;
}
Пример #21
0
void MObject3d::updateMatrix(void)
{
    M_PROFILE_SCOPE(MObject3d::updateMatrix);
	computeLocalMatrix();

	if(hasParent()){
		m_matrix = m_parent->m_matrix * m_matrix;
	}
}
Пример #22
0
StringVector Component::path() const {
    StringVector ret;
    if (hasParent()) {
        StringVector b = parent()->path();
        ret.insert(ret.begin(), b.begin(), b.end());
    }
    ret.push_back(name());
    return ret;
}
Пример #23
0
void ProtocolSpectator::syncOpenContainers()
{
	const auto openContainers = player->getOpenContainers();
	for (const auto& it : openContainers) {
		auto openContainer = it.second;
		auto container = openContainer.container;
		sendContainer(it.first, container, container->hasParent(), openContainer.index);
	}
}
Пример #24
0
bool hasParent(QObject* child, QObject* parent)
{
    if (!child)
        return false;

    if (child == parent)
        return true;

    return hasParent(child->parent(), parent);
}
Пример #25
0
bool				THIS::hasScene() const
{
	if(!hasParent()) return false;

	auto shape = dynamic_cast<neb::fnd::core::shape::base*>(getParent());
	
	assert(shape);
	
	return shape->hasScene();
}
Пример #26
0
Component* Component::setParent(Component* c) {
    if (hasParent()) {
        parent()->remove(this);
    }
    _parent = c;
    if (0 != _parent) {
        parent()->add(this);
    }
    return parent();
}
Пример #27
0
void Component::setParent(Component* p) {
    if (hasParent()) {
        if (p != parent()) {
            parent()->removeChild(this);
        }
    }
    _parent = p;
    if (0 != _parent) {
        _parent->addChild(this);
    }
}
Пример #28
0
void DLPAggreg::computeAggregation(double parameter) {
	if (!hasParent()) {
		_EVALSTARTBC;
		computeBestCuts(parameter);
		_EVALSTOPBC;
		_EVALSTARTBP;
		computeBestPartitions();
		_EVALSTOPBP;
		cleanChilds();
	}
}
bool WRMPDDirectoryTreeProvider::upLevel()
{
    if (!hasParent()) return false;
    std::string dir;
    for (size_t i=0; i<m_uriSplit.size()-1; i++) {
        if (dir.size()>0 && dir[dir.size()-1]!='/') dir += '/';
        dir+=m_uriSplit[i];
    }
    cd(dir);
    return true;
}
Пример #30
0
TEST(FriendDecl, InstantiationSourceRange) {
  RangeVerifier<FriendDecl> Verifier;
  Verifier.expectRange(4, 3, 4, 35);
  EXPECT_TRUE(Verifier.match(
      "template <typename T> class S;\n"
      "template<class T> void operator+(S<T> x);\n"
      "template<class T> struct S {\n"
      "  friend void operator+<>(S<T> src);\n"
      "};\n"
      "void test(S<double> s) { +s; }",
      friendDecl(hasParent(recordDecl(isTemplateInstantiation())))));
}