Exemplo n.º 1
0
QByteArray QResourceInfo::data() const
{
    if(container || related.isEmpty())
        return QByteArray();

    if(!hasData) {
        hasData = true;
        QString path = searchFile;
        if(path.startsWith(QLatin1Char(':')))
            path = path.mid(1);
        mData = related.at(0).data(path);
    }
    return mData;
}
Exemplo n.º 2
0
bool
QResource::unregisterResource(const uchar *rccData, const QString &resourceRoot)
{
    QString r = qt_resource_fixResourceRoot(resourceRoot);

    QMutexLocker lock(resourceMutex());
    ResourceList *list = resourceList();
    for(int i = 0; i < list->size(); ++i) {
        QResourceRoot *res = list->at(i);
        if(res->type() == QResourceRoot::Resource_Buffer) {
	    QDynamicBufferResourceRoot *root = reinterpret_cast<QDynamicBufferResourceRoot*>(res);
	    if(root->mappingBuffer() == rccData && root->mappingRoot() == r) {
                resourceList()->removeAt(i);
                if(!root->ref.deref()) {
                    delete root;
                    return true;
                }
		return false;
            }
	}
    }
    return false;
}
Exemplo n.º 3
0
QStringList QResourceInfo::children() const
{
    if(!container || related.isEmpty())
        return QStringList();

    if(!hasChildren) {
        hasChildren = true;
        QString path = searchFile;
        if(path.startsWith(QLatin1Char(':')))
            path = path.mid(1);
        QSet<QString> kids;
        for(int i = 0; i < related.size(); ++i) {
            QStringList related_children = related.at(i).children(path);
            for(int kid = 0; kid < related_children.size(); ++kid) {
                QString k = related_children.at(kid);
                if(!kids.contains(k)) {
                    mChildren += k;
                    kids.insert(k);
                }
            }
        }
    }
    return mChildren;
}