<commit_before>// Copyright 2012 <NAME> <<EMAIL>>
// License: MIT (see COPYING.MIT file)

#ifndef LPC_ERRORS_H_INCLUDE_GUARD_WED_FEB__1_16_34_50_WET_2012
#define LPC_ERRORS_H_INCLUDE_GUARD_WED_FEB__1_16_34_50_WET_2012
#include <exception>

struct NotImplementedError : std::exception {
    NotImplementedError()
        :w(0)
        { }
    NotImplementedError(const char* w)
        :w(w)
        { }

    const char* what() const throw() { return w ? w : "Not Implemented"; }

    const char* w;
};

struct ProgrammingError : std::exception {
    ProgrammingError()
        :w(0)
        { }
    ProgrammingError(const char* w)
        :w(w)
        { }

    const char* what() const throw() { return w ? w : "Programming Error"; }

    const char* w;
};

struct CannotReadError : std::exception {
    CannotReadError(const char* w)
        :w(w)
        { }
    CannotReadError()
        :w(0)
        { }

    const char* what() const throw() { return w ? w : "Read Error"; }
    const char* w;

};
struct CannotWriteError : std::exception {
    CannotWriteError(const char* w)
        :w(w)
        { }
    CannotWriteError()
        :w(0)
        { }

    const char* what() const throw() { return w ? w : "Write Error"; }
    const char* w;
};

#endif // LPC_ERRORS_H_INCLUDE_GUARD_WED_FEB__1_16_34_50_WET_2012<commit_msg>RFCT Simplify code with macros<commit_after>// Copyright 2012 <NAME> <<EMAIL>>
// License: MIT (see COPYING.MIT file)

#ifndef LPC_ERRORS_H_INCLUDE_GUARD_WED_FEB__1_16_34_50_WET_2012
#define LPC_ERRORS_H_INCLUDE_GUARD_WED_FEB__1_16_34_50_WET_2012
#include <string>
#include <exception>

#define DECLARE_IMREAD_ERROR_TYPE(TypeName, DefaultMsg) \
    struct TypeName : std::exception { \
        TypeName(const char* e) \
            :w(e) \
            { } \
        TypeName(std::string e) \
            :w(e) \
            { } \
        TypeName() \
            :w(DefaultMsg) \
            { } \
        ~TypeName() throw() { } \
        \
        \
        const char* what() const throw() { return w.c_str(); } \
        \
        std::string w;\
    }

DECLARE_IMREAD_ERROR_TYPE(CannotReadError, "Read Error");
DECLARE_IMREAD_ERROR_TYPE(CannotWriteError, "Write Error");
DECLARE_IMREAD_ERROR_TYPE(NotImplementedError, "Not Implemented");
DECLARE_IMREAD_ERROR_TYPE(ProgrammingError, "Programming Error");

#endif // LPC_ERRORS_H_INCLUDE_GUARD_WED_FEB__1_16_34_50_WET_2012
{'fraction_non_alphanumeric': 0.11975051975051976, 'fraction_numerical': 0.032432432432432434, 'mean_word_length': 2.7830188679245285, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '1414259', 'n_tokens_mistral': 923, 'n_tokens_neox': 847, 'n_words': 167}