bool SerializedType::isEquivalent (const SerializedType& t) const
{
    assert (getSType () == STI_NOTPRESENT);
    if (t.getSType () == STI_NOTPRESENT)
        return true;
    WriteLog (lsDEBUG, SerializedType) << "notEquiv " << getFullText() << " not STI_NOTPRESENT";
    return false;
}
Ejemplo n.º 2
0
bool STArray::isEquivalent (const STBase& t) const
{
    const STArray* v = dynamic_cast<const STArray*> (&t);

    if (!v)
    {
        WriteLog (lsDEBUG, STObject) <<
            "notEquiv " << getFullText() << " not array";
        return false;
    }

    return v_ == v->v_;
}
Ejemplo n.º 3
0
bool STObject::isEquivalent (const STBase& t) const
{
    const STObject* v = dynamic_cast<const STObject*> (&t);

    if (!v)
    {
        WriteLog (lsDEBUG, STObject) <<
            "notEquiv " << getFullText() << " not object";
        return false;
    }

    if (mType != nullptr && (v->mType == mType))
        return equivalentSTObjectSameTemplate (*this, *v);

    return equivalentSTObject (*this, *v);
}
bool STObject::isEquivalent (const SerializedType& t) const
{
    const STObject* v = dynamic_cast<const STObject*> (&t);

    if (!v)
    {
        WriteLog (lsDEBUG, STObject) << "notEquiv " << getFullText() << " not object";
        return false;
    }

    boost::ptr_vector<SerializedType>::const_iterator it1 = mData.begin (), end1 = mData.end ();
    boost::ptr_vector<SerializedType>::const_iterator it2 = v->mData.begin (), end2 = v->mData.end ();

    while ((it1 != end1) && (it2 != end2))
    {
        if ((it1->getSType () != it2->getSType ()) || !it1->isEquivalent (*it2))
        {
            if (it1->getSType () != it2->getSType ())
            {
                WriteLog (lsDEBUG, STObject) << "notEquiv type " << it1->getFullText() << " != "
                    <<  it2->getFullText();
            }
            else
            {
                WriteLog (lsDEBUG, STObject) << "notEquiv " << it1->getFullText() << " != "
                    <<  it2->getFullText();
            }
            return false;
        }

        ++it1;
        ++it2;
    }

    return (it1 == end1) && (it2 == end2);
}
Ejemplo n.º 5
0
FileSystemPile *FileSystemActor::pileize()
{
	StrList dirListing;
	QString dirPath;
	vector<Actor *> objListing;
	FileSystemActor *obj = NULL;
	FileSystemPile *p = NULL;

	// Don't allow Piles to be created recursively
	if (isParentType(BumpPile))
	{
		MessageClearPolicy clearPolicy;
			clearPolicy.setTimeout(4);
		scnManager->messages()->addMessage(new Message("pileize_recPiles", QT_TR_NOOP("Sorry, Items within Piles cannot be viewed as Piles at this time.\nThis feature will be implemented in a later version of BumpTop"), Message::Ok, clearPolicy));
		return NULL;
	}

	// If this item has been pileized, then just return its pile
	if (pileizedPile)
	{
		return pileizedPile;
	}

	if (isFileSystemType(Folder))
	{
		// Get a Directory listing of this folder
		dirPath = getTargetPath();
		dirListing = fsManager->getDirectoryContents(dirPath);

		// Check if this Folder has anything in it
		if (dirListing.empty())
		{
			MessageClearPolicy clearPolicy;
				clearPolicy.setTimeout(4);
			scnManager->messages()->addMessage(new Message("pileize_emptyFolder", QT_TR_NOOP("This folder is empty, so it can't be expanded to a pile"), Message::Ok, clearPolicy));
			return NULL;
		}

		// Create a new Pile
		p = new FileSystemPile();
		if (p)
		{
			for (uint i = 0; i < dirListing.size(); i++)
			{
				obj =  FileSystemActorFactory::createFileSystemActor(dirListing[i]);

				// Create new Actors that represent each item in that directory
				// NOTE: we need to set the initial size of the object, since we try and sync the post it
				//		 in the setFilePath call, which means that it will try and fill to the dims of the
				//		 object, which, in it's default size, is not visible text-wise.
				if (_prevPileizedActorDims.contains(dirListing[i].toLower()))
					obj->setDims(Vec3(_prevPileizedActorDims.value(dirListing[i].toLower())));
				else
					obj->setDims(getDims());
				obj->setGlobalPose(getGlobalPose());
				obj->setFilePath(dirListing[i]);

				objListing.push_back(obj);
			}

			// Add items to this Pile
			for (uint i = 0; i < objListing.size(); i++)
			{
				p->addToPile(objListing[i]);
			}

			// Save and setup initial states
			p->setOwner(this);
			p->setText(getFullText());
			p->stack(getGlobalPosition());
			
			// set the icon to be this actor's 
			if (isFileSystemType(Folder))
				p->setTextIcon(getTextureID());

			// Create custom Animations
			for (uint i = 0; i < objListing.size(); i++)
			{
				objListing[i]->setAlphaAnim(0.0f, 1.0f, 15);
			}

			// Make this actor Non-existent
			this->hideAndDisable();

			// Finish up by setting the pile as the current selection
			pileizedPile = p;
			sel->remove((BumpObject *) this);
			sel->add((Pile *) p);

			textManager->invalidate();

			// record this pilization
			statsManager->getStats().bt.interaction.piles.pilized++;
			return p;
		}		
	}

	return NULL;
}