Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1.8 KB
Raw Blame
/* This file is part of the KDE project
 * SPDX-FileCopyrightText: 2006 Boudewijn Rempt ([email protected])
 * SPDX-FileCopyrightText: 2006, 2010 Thomas Zander <[email protected]>
 *
 * SPDX-License-Identifier: LGPL-2.0-or-later
 */

#ifndef KOSHAPEREGISTRY_H
#define KOSHAPEREGISTRY_H

#include <KoGenericRegistry.h>
#include <KoShapeFactoryBase.h>
#include <QDomDocument>

#include "kritaflake_export.h"

class KoShape;
class KoShapeLoadingContext;


/**
 * This singleton class keeps a register of all available flake shapes,
 * or rather, of the factories that applications can use to create flake
 * shape objects.
 */
class KRITAFLAKE_EXPORT KoShapeRegistry : public KoGenericRegistry<KoShapeFactoryBase*>
{
public:
    KoShapeRegistry();
    ~KoShapeRegistry() override;

    /**
     * Return an instance of the KoShapeRegistry
     * Creates an instance if that has never happened before and returns the singleton instance.
     */
    static KoShapeRegistry *instance();

    /**
     * Add shape factory for a shape that is not a plugin
     * This can be used also if you want to have a shape only in one application
     *
     * @param factory The factory of the shape
     */
    void addFactory(KoShapeFactoryBase *factory);

    /**
     * Returns a list of shape factories supporting the specified xml element.
     * @param nameSpace the namespace of the xml element, see KoXmlNS for valid namespaces
     * @param elementName the tag name of the element
     * @return the list of shape factories supporting the specified xml element
     */
    QList<KoShapeFactoryBase*> factoriesForElement(const QString &nameSpace, const QString &elementName);

private:
    KoShapeRegistry(const KoShapeRegistry&);
    KoShapeRegistry operator=(const KoShapeRegistry&);

    class Private;
    Private * const d;
};

#endif