<commit_before>/******************************************************************************
 * This file is part of the Gluon Development Platform
 * Copyright (c) 2009 <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_CORE_GLUONOBJECT_H
#define GLUON_CORE_GLUONOBJECT_H

#include "gluonobjectfactory.h"
#include "gluon_core_export.h"

#include <QtCore/QObject>
#include <QtCore/QSharedData>
#include <QtCore/QList>
#include <QtCore/QUrl>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtScript/QScriptValue>

Q_DECLARE_METATYPE( QList<QUrl> )

/**
 * Please insert this macro into the definition of your class when implementing a
 * GluonObject subclass. The following is the code as found in GluonObject itself:
\code
class GLUON_CORE_EXPORT GluonObject : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString name READ name WRITE setName)
    GLUON_OBJECT(GluonCore::GluonObject);

    public:
        Q_INVOKABLE GluonObject(QObject * parent = 0);
\endcode
 *
 * \note Please make sure that you also add two Q_DECLARE_METATYPE declarations at
 * the end of your header as seen below (also a sample from GluonObject):
\code
Q_DECLARE_METATYPE(GluonCore::GluonObject)
Q_DECLARE_METATYPE(GluonCore::GluonObject*)
\endcode
 */
#define GLUON_OBJECT(CLASSNAME)\
    public:\
    virtual GluonCore::GluonObject* instantiate();\
    virtual GluonCore::GluonObject* fromVariant(const QVariant &wrappedObject);\
    virtual QVariant toVariant(GluonCore::GluonObject *wrapThis);\
    static QScriptValue objectToScriptValue( QScriptEngine* engine, CLASSNAME* const& in );\
    static void objectFromScriptValue( const QScriptValue& object, CLASSNAME*& out );\
    virtual void registerOnScriptEngine(QScriptEngine* engine) const;\
    private:

namespace GluonCore
{
    class GameProject;
    class GluonObjectPrivate;
    class MetaInfo;

    /**
     * \brief Convenience-extended version of QObjects for use with Gluon
     *
     * The central object class for Gluon - it contains much convenience functionality
     * used throughout Gluon, specifically geared towards searching and the like.
     * It further extends QObject with extra functionality to help with certain specifics
     * for properties, that Qt's properties do not support, such as value borders and
     * steps for numerical values.
     *
     * <b>Subclassing</b>
     *
     * When implementing GluonObject subclasses in C++, please remember the following
     * items in your code:
     *
     * Definition (yourclassname.h):
    \code
    #include <gluonobject.h>

    namespace YourNamespace
    {
    class YourClassName : public GluonCore::GluonObject
    {
        Q_OBJECT
        GLUON_OBJECT(YourNamespace::YourClassName);

        public:
            Q_INVOKABLE YourClassName(QObject *parent = 0);
            virtual ~YourClassName();

            // More functions here...

        private:

    }
    }

    Q_DECLARE_METATYPE(YourNamespace::YourClassName);
    Q_DECLARE_METATYPE(YourNamespace::YourClassName*);
    \endcode
     *
     * Implementation (yourclassname.cpp):
    \code
    #include "yourclassname.h"

    REGISTER_OBJECT_TYPE(YourNamespace, YourClassName);

    using YourNamespace;

    YourClassName::YourClassName(QObject *parent)
    : GluonObject(parent)
    {
    }

    YourClassName::~YourClassName()
    {
    }

    // further implementation here...

    #include "yourclassname.moc"
    \endcode
     *
     * Please also ensure that all public functions are slots, as this will enable their
     * access from the QtScript based game code in GluonEngine based games.
     */
    class GLUON_CORE_EXPORT GluonObject : public QObject
    {
            Q_OBJECT
            /**
             * The local name of the object. Setting the name will sanitize it according to
             * the following rules:
             *
             *   - Names cannot contain the / symbol
             *   - Two objects on the same parent cannot have the same name
             *
             * To ensure the second rule, numbers are added until such time that the name becomes
             * unique (setting name would result in first attempting "name", then "name 1", then
             * "name 2" and so forth, until the name is unique).
             */
            Q_PROPERTY( QString name READ name WRITE setName )
            // There is deliberately no gameProject property
            GLUON_OBJECT( GluonCore::GluonObject );
<commit_msg>Document the naming of GluonObjects according to our new scheme<commit_after>/******************************************************************************
 * This file is part of the Gluon Development Platform
 * Copyright (c) 2009 <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_CORE_GLUONOBJECT_H
#define GLUON_CORE_GLUONOBJECT_H

#include "gluonobjectfactory.h"
#include "gluon_core_export.h"

#include <QtCore/QObject>
#include <QtCore/QSharedData>
#include <QtCore/QList>
#include <QtCore/QUrl>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtScript/QScriptValue>

Q_DECLARE_METATYPE( QList<QUrl> )

/**
 * Please insert this macro into the definition of your class when implementing a
 * GluonObject subclass. The following is the code as found in GluonObject itself:
\code
class GLUON_CORE_EXPORT GluonObject : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString name READ name WRITE setName)
    GLUON_OBJECT(GluonCore::GluonObject);

    public:
        Q_INVOKABLE GluonObject(QObject * parent = 0);
\endcode
 *
 * \note Please make sure that you also add two Q_DECLARE_METATYPE declarations at
 * the end of your header as seen below (also a sample from GluonObject):
\code
Q_DECLARE_METATYPE(GluonCore::GluonObject)
Q_DECLARE_METATYPE(GluonCore::GluonObject*)
\endcode
 */
#define GLUON_OBJECT(CLASSNAME)\
    public:\
    virtual GluonCore::GluonObject* instantiate();\
    virtual GluonCore::GluonObject* fromVariant(const QVariant &wrappedObject);\
    virtual QVariant toVariant(GluonCore::GluonObject *wrapThis);\
    static QScriptValue objectToScriptValue( QScriptEngine* engine, CLASSNAME* const& in );\
    static void objectFromScriptValue( const QScriptValue& object, CLASSNAME*& out );\
    virtual void registerOnScriptEngine(QScriptEngine* engine) const;\
    private:

namespace GluonCore
{
    class GameProject;
    class GluonObjectPrivate;
    class MetaInfo;

    /**
     * \brief Convenience-extended version of QObjects for use with Gluon
     *
     * The central object class for Gluon - it contains much convenience functionality
     * used throughout Gluon, specifically geared towards searching and the like.
     * It further extends QObject with extra functionality to help with certain specifics
     * for properties, that Qt's properties do not support, such as value borders and
     * steps for numerical values.
     *
     * <b>Subclassing</b>
     *
     * When implementing GluonObject subclasses in C++, please remember the following
     * items in your code:
     *
     * Definition (yourclassname.h):
    \code
    #include <gluonobject.h>

    namespace YourNamespace
    {
    class YourClassName : public GluonCore::GluonObject
    {
        Q_OBJECT
        GLUON_OBJECT(YourNamespace::YourClassName);

        public:
            Q_INVOKABLE YourClassName(QObject *parent = 0);
            virtual ~YourClassName();

            // More functions here...

        private:

    }
    }

    Q_DECLARE_METATYPE(YourNamespace::YourClassName);
    Q_DECLARE_METATYPE(YourNamespace::YourClassName*);
    \endcode
     *
     * Implementation (yourclassname.cpp):
    \code
    #include "yourclassname.h"

    REGISTER_OBJECT_TYPE(YourNamespace, YourClassName);

    using YourNamespace;

    YourClassName::YourClassName(QObject *parent)
    : GluonObject(parent)
    {
    }

    YourClassName::~YourClassName()
    {
    }

    // further implementation here...

    #include "yourclassname.moc"
    \endcode
     *
     * Please also ensure that all public functions are slots, as this will enable their
     * access from the QtScript based game code in GluonEngine based games.
     */
    class GLUON_CORE_EXPORT GluonObject : public QObject
    {
            Q_OBJECT
            /**
             * The local name of the object. Setting the name will sanitize it according to
             * the following rules:
             *
             *   - Names cannot contain the / symbol, and will be simplified (all whitespace
             *     turned into a single space, and no starting and trailing spaces)
             *   - Two objects on the same parent cannot have the same name
             *
             * To ensure the second rule, numbers are added until such time that the name becomes
             * unique (setting name would result in first attempting "name", then "name 1", then
             * "name 2" and so forth, until the name is unique).
             * 
             * <strong>Accessing objects in scripts</strong>
             * 
             * When accessing the object in scripts, the object name is sanitized further by
             * allowing only alphanumerical parts, with all other parts of the name removed.
             * This means that, for example, an object in a hierarchy which looks like this:
             * 
             * Some Object/A Child Object/Some Object - with a little comment
             * 
             * would be addressed like so:
             *
             * SomeObject.AChildObject.SomeObjectwithalittlecomment
             */
            Q_PROPERTY( QString name READ name WRITE setName )
            // There is deliberately no gameProject property
            GLUON_OBJECT( GluonCore::GluonObject );

{'fraction_non_alphanumeric': 0.08291547277936963, 'fraction_numerical': 0.0037607449856733523, 'mean_word_length': 2.9989258861439314, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '3554567', 'n_tokens_mistral': 3124, 'n_tokens_neox': 2936, 'n_words': 1110}