<commit_before>/******************************************************************************\
* File:          file.h
* Purpose:       Declaration of wxWidgets file extension classes
* Author:        <NAME>
* RCS-ID:        $Id$
*
* Copyright (c) 1998-2008, <NAME>
* All rights are reserved. Reproduction in whole or part is prohibited
* without the written consent of the copyright owner.
\******************************************************************************/

#ifndef _EXFILE_H
#define _EXFILE_H

#include <sys/stat.h> // for stat
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/file.h>
#include <wx/filename.h>
#include <wx/extension/lexer.h>

/// Adds IsOk to the stat base class, and several methods
/// to get/update on the stat members.
class wxExStat : public stat
{
public:
  /// Default constructor. Calls Sync.
  wxExStat(const wxString& fullpath = wxEmptyString) {
    Sync(fullpath);}

  /// Gets fullpath member.
  const wxString& GetFullPath() const {return m_FullPath;};

  /// Gets the modification time.
  /// From wxFileName class GetModificationTime is available as well,
  /// this one returns string and only uses the stat member, and is fast.
  const wxString GetModificationTime(
    const wxString& format = wxDefaultDateTimeFormat) const;

  /// Returns true if the stat is okay (last update was okay).
  bool IsOk() const {return m_IsOk;};

  /// Returns true if this stat is readonly.
  bool IsReadOnly() const {
    return (m_IsOk && ((st_mode & wxS_IWUSR) == 0));};

  /// Updates this stat, returns result and keeps it in IsOk.
  bool Sync();

  /// Updates fullpath member, then Syncs.
  bool Sync(const wxString& fullpath);
private:
  wxString m_FullPath;
  bool m_IsOk;
};

/// Adds an wxExStat and an wxExLexer member to wxFileName.
class wxExFileName : public wxFileName
{
public:
  /// Default constructor.
  wxExFileName(
    const wxString& fullpath = wxEmptyString,
    wxPathFormat format = wxPATH_NATIVE)
    : wxFileName(fullpath, format)
    , m_Stat(fullpath) {
    SetLexer();}

  /// Copy constructor from a wxFileName.
  wxExFileName(const wxFileName& filename)
    : wxFileName(filename)
    , m_Stat(filename.GetFullPath()) {
    SetLexer();}<commit_msg>added assignment operator<commit_after>/******************************************************************************\
* File:          file.h
* Purpose:       Declaration of wxWidgets file extension classes
* Author:        <NAME>
* RCS-ID:        $Id$
*
* Copyright (c) 1998-2008, <NAME>
* All rights are reserved. Reproduction in whole or part is prohibited
* without the written consent of the copyright owner.
\******************************************************************************/

#ifndef _EXFILE_H
#define _EXFILE_H

#include <sys/stat.h> // for stat
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/file.h>
#include <wx/filename.h>
#include <wx/extension/lexer.h>

/// Adds IsOk to the stat base class, and several methods
/// to get/update on the stat members.
class wxExStat : public stat
{
public:
  /// Default constructor. Calls Sync.
  wxExStat(const wxString& fullpath = wxEmptyString) {
    Sync(fullpath);}

  /// Gets fullpath member.
  const wxString& GetFullPath() const {return m_FullPath;};

  /// Gets the modification time.
  /// From wxFileName class GetModificationTime is available as well,
  /// this one returns string and only uses the stat member, and is fast.
  const wxString GetModificationTime(
    const wxString& format = wxDefaultDateTimeFormat) const;

  /// Returns true if the stat is okay (last update was okay).
  bool IsOk() const {return m_IsOk;};

  /// Returns true if this stat is readonly.
  bool IsReadOnly() const {
    return (m_IsOk && ((st_mode & wxS_IWUSR) == 0));};

  /// Updates this stat, returns result and keeps it in IsOk.
  bool Sync();

  /// Updates fullpath member, then Syncs.
  bool Sync(const wxString& fullpath);
private:
  wxString m_FullPath;
  bool m_IsOk;
};

/// Adds an wxExStat and an wxExLexer member to wxFileName.
class wxExFileName : public wxFileName
{
public:
  /// Default constructor.
  wxExFileName(
    const wxString& fullpath = wxEmptyString,
    wxPathFormat format = wxPATH_NATIVE)
    : wxFileName(fullpath, format)
    , m_Stat(fullpath) {
    SetLexer();}

  /// Copy constructor from a wxFileName.
  wxExFileName(const wxFileName& filename)
    : wxFileName(filename)
    , m_Stat(filename.GetFullPath()) {
    SetLexer();}

  /// Assignment operator.
  wxExFileName& operator=(const wxExFileName& f)
  {
    m_Lexer = f.m_Lexer;
    m_Stat = f.m_Stat;
    Assign(f);
    return *this;
  };
{'fraction_non_alphanumeric': 0.1699807568954458, 'fraction_numerical': 0.003848620910840282, 'mean_word_length': 3.640873015873016, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '664207', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1395, 'n_words': 466}