<commit_before>/*
 * =====================================================================================
 *
 *       Filename:  Clearable.h
 *
 *    Description:  Clearable virtual collection
 *
 *        Version:  1.0
 *        Created:  08/23/2014 05:28:21 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  <NAME> (dk), <EMAIL>
 *        Company:  Company and shit
 *
 * =====================================================================================
 */

#ifndef CLEARABLE_D3H5AWSJ
#define CLEARABLE_D3H5AWSJ

namespace templatious {


template <class T>
struct Clearable: public T {
    typedef typename T::Ad Ad;

    typedef typename Ad::iterator Iter;
    typedef typename Ad::const_iterator CIter;
    typedef typename Ad::value_type ValType;
    typedef typename Ad::const_value_type CValType;
    typedef typename Ad::ThisCol ThisCol;
    typedef typename Ad::ConstCol ConstCol;

    void erase(const Iter& i) {
        Ad::erase(getRef(),i);
    }

    void erase(const Iter& beg,const Iter& end) {
        Ad::erase(getRef(),beg,end);
    }

    void clear() {
        Ad::clear(getRef());
    }

    Clearable(ThisCol& t) : T(t) {}

protected:
    ThisCol& getRef() {
        return T::getRef();
    }
};

}

#endif /* end of include guard: CLEARABLE_D3H5AWSJ */<commit_msg>Clearable full<commit_after>/*
 * =====================================================================================
 *
 *       Filename:  Clearable.h
 *
 *    Description:  Clearable virtual collection
 *
 *        Version:  1.0
 *        Created:  08/23/2014 05:28:21 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  <NAME> (dk), <EMAIL>
 *        Company:  Company and shit
 *
 * =====================================================================================
 */

#ifndef CLEARABLE_D3H5AWSJ
#define CLEARABLE_D3H5AWSJ

#include <templatious/util/Exceptions.h>

namespace templatious {

template <class T>
struct Clearable: public T {
    typedef typename T::Ad Ad;

    typedef typename Ad::iterator Iter;
    typedef typename Ad::const_iterator CIter;
    typedef typename Ad::value_type ValType;
    typedef typename Ad::const_value_type CValType;
    typedef typename Ad::ThisCol ThisCol;
    typedef typename Ad::ConstCol ConstCol;

    void erase(const Iter& i) {
        Ad::erase(getRef(),i);
    }

    void erase(const Iter& beg,const Iter& end) {
        Ad::erase(getRef(),beg,end);
    }

    void clear() {
        Ad::clear(getRef());
    }

    Clearable(ThisCol& t) : T(t) {}

protected:
    ThisCol& getRef() {
        return T::getRef();
    }
};

template <class T>
struct ClearableFake: public T {
    typedef typename T::Ad Ad;

    typedef typename Ad::iterator Iter;
    typedef typename Ad::const_iterator CIter;
    typedef typename Ad::value_type ValType;
    typedef typename Ad::const_value_type CValType;
    typedef typename Ad::ThisCol ThisCol;
    typedef typename Ad::ConstCol ConstCol;

    void erase(const Iter& i) {}
    void erase(const Iter& beg,const Iter& end) {}
    void clear() {}

    ClearableFake(ThisCol& t) : T(t) {}

protected:
    ThisCol& getRef() {
        return T::getRef();
    }
};

template <class T>
struct ClearableThrow: public T {
    typedef typename T::Ad Ad;

    typedef typename Ad::iterator Iter;
    typedef typename Ad::const_iterator CIter;
    typedef typename Ad::value_type ValType;
    typedef typename Ad::const_value_type CValType;
    typedef typename Ad::ThisCol ThisCol;
    typedef typename Ad::ConstCol ConstCol;

    void erase(const Iter& i) {
        throw templatious::util::FeatureDisabled(
            "Erasing is disabled in current collection.");
    }

    void erase(const Iter& beg,const Iter& end) {
        throw templatious::util::FeatureDisabled(
            "Erasing is disabled in current collection.");
    }

    void clear() {
        throw templatious::util::FeatureDisabled(
            "Erasing is disabled in current collection.");
    }

    ClearableThrow(ThisCol& t) : T(t) {}

protected:
    ThisCol& getRef() {
        return T::getRef();
    }
};

}

#endif /* end of include guard: CLEARABLE_D3H5AWSJ */
{'fraction_non_alphanumeric': 0.18630268199233715, 'fraction_numerical': 0.01053639846743295, 'mean_word_length': 3.156218905472637, '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': '941006', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1220, 'n_words': 327}