<commit_before>/******************************************************************************
 * This file is part of the Gluon Development Platform
 * Copyright (c) 2010 <NAME> <<EMAIL>>
 * Copyright (C) 2010 <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef GLUON_ENGINE_ASSET_H
#define GLUON_ENGINE_ASSET_H

#include "gluon_engine_export.h"

#include <core/gluonobject.h>
#include <core/referencecounter.h>

#include <QtCore/QtPlugin>
#include <QtCore/QUrl>
#include <QtCore/QMimeData>
#include <QtGui/QIcon>

// class QAction;
class QMimeData;

namespace GluonEngine
{
    class AssetPrivate;
    class AssetAction;

    /**
     * \brief Representation of a template for a specific GluonEngine::Asset
     *
     * A simple data container class for template information for GluonEngine::Asset
     *
     * Note: To see which Asset the template is referring to, the parent() function
     * will be pointing to an instance of that class.
     */
    class GLUON_ENGINE_EXPORT AssetTemplate : public QObject
    {
            Q_OBJECT
        public:
            AssetTemplate( QString name, QString filename, QString pluginname, QObject* parent = 0 )
                : QObject( parent )
                , name( name )
                , filename( filename )
                , pluginname( pluginname )
            { }
            virtual ~AssetTemplate() {};

            /**
            * The name which the newly created asset object will be given
            */
            QString name;

            /**
            * The filename of the template, as found inside the template directory for
            * this asset (for example /usr/share/gluon/template/assetclassname/filename)
            */
            QString filename;

            /**
             * The name of the plugin (that is, the subdir inside which the template file is found)
             */
            QString pluginname;
    };

    /**
     * \brief The base class on which all Asset handlers are constructed
     *
     * The Asset class is a fat interface used to allow file access to GluonEngine based
     * games without allowing direct access to the file system.
     *
     * Assets are designed to be plugins, use the GLUON_ASSET_PLUGIN( metadatafile ) to
     * declare them as such. The metadata file is a JSON file as used by the Qt plugin
     * system. The following data can be contained in the JSON file:
     *
     * <code>
     * {
     *    "name": The name of the asset.
     *    "icon": The icon used for the asset.
     *    "category": The category of the asset.
     *    "mimeTypes": An array of strings with supported mime types.
     *    "templates": An array of objects describing the templates to use.
     *          Each object is expected to have a name and template property.
     *    "actions": An array of objects describing the actions that can be
     *          performed on this asset. Each object is expected to have a name
     *          and method property, where method should be the name of a slot on the asset.<commit_msg>engine: Replace pluginName with typeName<commit_after>/******************************************************************************
 * This file is part of the Gluon Development Platform
 * Copyright (c) 2010 <NAME> <<EMAIL>>
 * Copyright (C) 2010 <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef GLUON_ENGINE_ASSET_H
#define GLUON_ENGINE_ASSET_H

#include "gluon_engine_export.h"

#include <core/gluonobject.h>
#include <core/referencecounter.h>

#include <QtCore/QtPlugin>
#include <QtCore/QUrl>
#include <QtCore/QMimeData>
#include <QtGui/QIcon>

// class QAction;
class QMimeData;

namespace GluonEngine
{
    class AssetPrivate;
    class AssetAction;

    /**
     * \brief Representation of a template for a specific GluonEngine::Asset
     *
     * A simple data container class for template information for GluonEngine::Asset
     *
     * Note: To see which Asset the template is referring to, the parent() function
     * will be pointing to an instance of that class.
     */
    class GLUON_ENGINE_EXPORT AssetTemplate : public QObject
    {
            Q_OBJECT
        public:
            AssetTemplate( QString name, QString filename, QString typeName, QObject* parent = 0 )
                : QObject( parent )
                , name( name )
                , filename( filename )
                , typeName( typeName )
            { }
            virtual ~AssetTemplate() {};

            /**
            * The name which the newly created asset object will be given
            */
            QString name;

            /**
            * The filename of the template, as found inside the template directory for
            * this asset (for example /usr/share/gluon/template/assetclassname/filename)
            */
            QString filename;

            /**
             * The name of the type to be created from this template.
             */
            QString typeName;
    };

    /**
     * \brief The base class on which all Asset handlers are constructed
     *
     * The Asset class is a fat interface used to allow file access to GluonEngine based
     * games without allowing direct access to the file system.
     *
     * Assets are designed to be plugins, use the GLUON_ASSET_PLUGIN( metadatafile ) to
     * declare them as such. The metadata file is a JSON file as used by the Qt plugin
     * system. The following data can be contained in the JSON file:
     *
     * <code>
     * {
     *    "name": The name of the asset.
     *    "icon": The icon used for the asset.
     *    "category": The category of the asset.
     *    "mimeTypes": An array of strings with supported mime types.
     *    "templates": An array of objects describing the templates to use.
     *          Each object is expected to have a name and template property.
     *    "actions": An array of objects describing the actions that can be
     *          performed on this asset. Each object is expected to have a name
     *          and method property, where method should be the name of a slot on the asset.
{'fraction_non_alphanumeric': 0.08613138686131387, 'fraction_numerical': 0.00583941605839416, 'mean_word_length': 2.4648275862068965, 'pattern_counts': {'":': 12, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2587464', 'n_tokens_mistral': 1972, 'n_tokens_neox': 1882, 'n_words': 886}