<commit_before>/* This file is part of the KDE libraries
   Copyright (C) 2001 <NAME> <<EMAIL>>
   Copyright (C) 2000 <NAME> <<EMAIL>>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
*/

#ifndef _KATE_SYNTAXDOCUMENT_H_
#define _KATE_SYNTAXDOCUMENT_H_

//BEGING INCLUDES
#include <qdom.h>
#include <qptrlist.h>
#include <qstringlist.h>
//END INCLUDES

/** Information about each syntax hl Mode
*/
class syntaxModeListItem{
  public:
    QString name;
    QString section;
    QString mimetype;
    QString extension;
    QString identifier;
    QString version;
    QString priority;
};

/** List of the SyntaxModeListItems holding all the syntax mode list items
*/
typedef QPtrList<syntaxModeListItem> SyntaxModeList;

/** Class holding the data arround the current QDomElement
*/
class syntaxContextData{
  public:
    QDomElement parent;
    QDomElement currentGroup;
    QDomElement item;
};

/** Store and manage the information about Syntax Highlighting.
*/
class SyntaxDocument : public QDomDocument
{
  public:
    /**
     * Constructor:
     * Sets the current file to nothing and build the ModeList (katesyntaxhighlightingrc)
     */
    SyntaxDocument();

    /**
     * Desctructor
     */
    ~SyntaxDocument();

    /** If the open hl file is different from the one needed, it opens
     * the new one and assign some other things.
     * identifier = File name and path of the new xml needed
     */
    bool setIdentifier(const QString& identifier);

    /**
     * Get the mode list
     */
    SyntaxModeList modeList();

    /**
     * Jump to the next group, syntaxContextData::currentGroup will point to the next group
     */
    bool nextGroup(syntaxContextData* data);

    /**
     * Jump to the next item, syntaxContextData::item will point to the next item
     */
    bool nextItem(syntaxContextData* data);

    /**
     * This function is used to fetch the atributes of the tags.
     */
    QString groupItemData(const syntaxContextData* data,const QString& name);
    QString groupData(const syntaxContextData* data,const QString& name);

    void freeGroupInfo(syntaxContextData* data);
    syntaxContextData* getSubItems(syntaxContextData* data);

    bool getElement (QDomElement &element, const QString &mainGroupName, const QString &config);

    /**
     * Get the syntaxContextData of the DomElement Config inside mainGroupName
     * It just fills syntaxContextData::item
     */
    syntaxContextData* getConfig(const QString& mainGroupName, const QString &config);

    /**
     * Get the syntaxContextData of the QDomElement Config inside mainGroupName
     * syntaxContextData::parent will contain the QDomElement found
     */
    syntaxContextData* getGroupInfo(const QString& mainGroupName, const QString &group);

    /**
     * Returns a list with all the keywords inside the list type
     */
    QStringList& finddata(const QString& mainGroup,const QString& type,bool clearList=true);


  private:
    /**
     * Generate the list of hl modes, store them in myModeList
     * force: if true forces to rebuild the Mode List from the xml files (instead of katesyntax...rc)
    */
    void setupModeList(bool force=false);

    /**
     * List of mode items
     */
    SyntaxModeList myModeList;

    QString currentFile;
    QStringList m_data;
};

#endif<commit_msg>public -> private<commit_after>/* This file is part of the KDE libraries
   Copyright (C) 2001 <NAME> <<EMAIL>>
   Copyright (C) 2000 <NAME> <<EMAIL>>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
*/

#ifndef _KATE_SYNTAXDOCUMENT_H_
#define _KATE_SYNTAXDOCUMENT_H_

//BEGING INCLUDES
#include <qdom.h>
#include <qptrlist.h>
#include <qstringlist.h>
//END INCLUDES

/** Information about each syntax hl Mode
*/
class syntaxModeListItem{
  public:
    QString name;
    QString section;
    QString mimetype;
    QString extension;
    QString identifier;
    QString version;
    QString priority;
};

/** List of the SyntaxModeListItems holding all the syntax mode list items
*/
typedef QPtrList<syntaxModeListItem> SyntaxModeList;

/** Class holding the data arround the current QDomElement
*/
class syntaxContextData{
  public:
    QDomElement parent;
    QDomElement currentGroup;
    QDomElement item;
};

/** Store and manage the information about Syntax Highlighting.
*/
class SyntaxDocument : public QDomDocument
{
  public:
    /**
     * Constructor:
     * Sets the current file to nothing and build the ModeList (katesyntaxhighlightingrc)
     */
    SyntaxDocument();

    /**
     * Desctructor
     */
    ~SyntaxDocument();

    /** If the open hl file is different from the one needed, it opens
     * the new one and assign some other things.
     * identifier = File name and path of the new xml needed
     */
    bool setIdentifier(const QString& identifier);

    /**
     * Get the mode list
     */
    SyntaxModeList modeList();

    /**
     * Jump to the next group, syntaxContextData::currentGroup will point to the next group
     */
    bool nextGroup(syntaxContextData* data);

    /**
     * Jump to the next item, syntaxContextData::item will point to the next item
     */
    bool nextItem(syntaxContextData* data);

    /**
     * This function is used to fetch the atributes of the tags.
     */
    QString groupItemData(const syntaxContextData* data,const QString& name);
    QString groupData(const syntaxContextData* data,const QString& name);

    void freeGroupInfo(syntaxContextData* data);
    syntaxContextData* getSubItems(syntaxContextData* data);

    /**
     * Get the syntaxContextData of the DomElement Config inside mainGroupName
     * It just fills syntaxContextData::item
     */
    syntaxContextData* getConfig(const QString& mainGroupName, const QString &config);

    /**
     * Get the syntaxContextData of the QDomElement Config inside mainGroupName
     * syntaxContextData::parent will contain the QDomElement found
     */
    syntaxContextData* getGroupInfo(const QString& mainGroupName, const QString &group);

    /**
     * Returns a list with all the keywords inside the list type
     */
    QStringList& finddata(const QString& mainGroup,const QString& type,bool clearList=true);


  private:
    /**
     * Generate the list of hl modes, store them in myModeList
     * force: if true forces to rebuild the Mode List from the xml files (instead of katesyntax...rc)
    */
    void setupModeList(bool force=false);

    /**
     * Used by getConfig and getGroupInfo to traverse the xml nodes and
     * evenually return the found element
    */
    bool getElement (QDomElement &element, const QString &mainGroupName, const QString &config);

    /**
     * List of mode items
     */
    SyntaxModeList myModeList;

    QString currentFile;
    QStringList m_data;
};

#endif
{'fraction_non_alphanumeric': 0.07347292776607607, 'fraction_numerical': 0.005699417668194771, 'mean_word_length': 3.257383966244726, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3197331', 'n_tokens_mistral': 2262, 'n_tokens_neox': 2164, 'n_words': 886}