<commit_before>/* dtkContainerVector.tpp --- 
 * 
 * Author: tkloczko
 * Copyright (C) 2011 - <NAME>, Inria.
 * Created: Fri Apr 27 17:02:22 2012 (+0200)
 * Version: $Id$
 * Last-Updated: Mon May  7 16:13:58 2012 (+0200)
 *           By: tkloczko
 *     Update #: 97
 */

/* Commentary: 
 * 
 */

/* Change log:
 * 
 */

#ifndef DTKCONTAINERVECTOR_TPP
#define DTKCONTAINERVECTOR_TPP

// /////////////////////////////////////////////////////////////////
// dtkContainerVector implementation
// /////////////////////////////////////////////////////////////////

template <typename T> dtkContainerVector<T>::dtkContainerVector(dtkAbstractData *parent) : dtkAbstractContainer(parent)
{

};

template <typename T> dtkContainerVector<T>::dtkContainerVector(const QVector<T>& vector, dtkAbstractData *parent) : dtkAbstractContainer(parent), m_vector(vector)
{

};

template <typename T> dtkContainerVector<T>::dtkContainerVector(const dtkContainerVector& other) : dtkAbstractContainer(), m_vector(other.m_vector)
{
    dtkAbstractData::operator=(other);
    this->init();
};

template <typename T> dtkContainerVector<T>::~dtkContainerVector(void)
{

};

template <typename T> dtkContainerVector<T>& dtkContainerVector<T>::operator = (const dtkContainerVector<T>& other)
{
    dtkAbstractData::operator=(other);

    m_vector = other.m_vector;
    
    return *this;
};

template <typename T> dtkContainerVector<T> *dtkContainerVector<T>::clone(void) const
{
    return new dtkContainerVector<T>(*this);
};

template <typename T> inline void dtkContainerVector<T>::setVector(const QVector<T>& vector)
{
    m_vector = vector;
};

template <typename T> inline QVector<T>& dtkContainerVector<T>::vector(void)
{
    return m_vector;
};

template <typename T> dtkAbstractContainer::Type dtkContainerVector<T>::type(void) const
{
    return dtkAbstractContainer::Vector;
};

template <typename T> inline void dtkContainerVector<T>::clear(void)
{
    m_vector.clear();
};

template <typename T> inline void dtkContainerVector<T>::append(const QVariant& data)
{
    m_vector.append(qvariant_cast<T>(data));
};

template <typename T> inline void dtkContainerVector<T>::prepend(const QVariant& data)
{
    m_vector.prepend(qvariant_cast<T>(data));
};

template <typename T> void dtkContainerVector<T>::remove(const QVariant& data)
{
    T t = qvariant_cast<T>(data);
    dtkxarch_int index = m_vector.indexOf(t);
    while (index >= 0) {
        m_vector.remove(index);
        index = m_vector.indexOf(t);
    }
};

template <typename T> inline void dtkContainerVector<T>::insert(const QVariant& data, dtkxarch_int index)
{
    m_vector.insert(index, qvariant_cast<T>(data));
};

template <typename T> inline void dtkContainerVector<T>::replace(const QVariant& data, dtkxarch_int index)
{
    m_vector.replace(index, qvariant_cast<T>(data));
};

template <typename T> inline void dtkContainerVector<T>::resize(dtkxarch_int size)
{
    m_vector.resize(size);
};

template <typename T> inline bool dtkContainerVector<T>::isEmpty(void) const
{
    return m_vector.isEmpty();
};

template <typename T> inline bool dtkContainerVector<T>::contains(const QVariant& data) const
{
    return m_vector.contains(qvariant_cast<T>(data));
};

template <typename T> inline dtkxarch_int dtkContainerVector<T>::count(void) const
{
    return m_vector.count();
};<commit_msg>Modification of resize function for vector container.<commit_after>/* dtkContainerVector.tpp --- 
 * 
 * Author: tkloczko
 * Copyright (C) 2011 - <NAME>, Inria.
 * Created: Fri Apr 27 17:02:22 2012 (+0200)
 * Version: $Id$
 * Last-Updated: Thu May 10 10:16:56 2012 (+0200)
 *           By: tkloczko
 *     Update #: 104
 */

/* Commentary: 
 * 
 */

/* Change log:
 * 
 */

#ifndef DTKCONTAINERVECTOR_TPP
#define DTKCONTAINERVECTOR_TPP

// /////////////////////////////////////////////////////////////////
// dtkContainerVector implementation
// /////////////////////////////////////////////////////////////////

template <typename T> dtkContainerVector<T>::dtkContainerVector(dtkAbstractData *parent) : dtkAbstractContainer(parent)
{

};

template <typename T> dtkContainerVector<T>::dtkContainerVector(const QVector<T>& vector, dtkAbstractData *parent) : dtkAbstractContainer(parent), m_vector(vector)
{

};

template <typename T> dtkContainerVector<T>::dtkContainerVector(const dtkContainerVector& other) : dtkAbstractContainer(), m_vector(other.m_vector)
{
    dtkAbstractData::operator=(other);
    this->init();

    qDebug() << __func__ << m_vector.count() << other.m_vector.count();
};

template <typename T> dtkContainerVector<T>::~dtkContainerVector(void)
{

};

template <typename T> dtkContainerVector<T>& dtkContainerVector<T>::operator = (const dtkContainerVector<T>& other)
{
    dtkAbstractData::operator=(other);

    m_vector = other.m_vector;
    
    return *this;
};

template <typename T> dtkContainerVector<T> *dtkContainerVector<T>::clone(void) const
{

    qDebug() << __func__ << m_vector.count();

    return new dtkContainerVector<T>(*this);
};

template <typename T> inline void dtkContainerVector<T>::setVector(const QVector<T>& vector)
{
    m_vector = vector;
};

template <typename T> inline QVector<T>& dtkContainerVector<T>::vector(void)
{
    return m_vector;
};

template <typename T> dtkAbstractContainer::Type dtkContainerVector<T>::type(void) const
{
    return dtkAbstractContainer::Vector;
};

template <typename T> inline void dtkContainerVector<T>::clear(void)
{
    m_vector.clear();
};

template <typename T> inline void dtkContainerVector<T>::append(const QVariant& data)
{
    m_vector.append(qvariant_cast<T>(data));
};

template <typename T> inline void dtkContainerVector<T>::prepend(const QVariant& data)
{
    m_vector.prepend(qvariant_cast<T>(data));
};

template <typename T> void dtkContainerVector<T>::remove(const QVariant& data)
{
    T t = qvariant_cast<T>(data);
    dtkxarch_int index = m_vector.indexOf(t);
    while (index >= 0) {
        m_vector.remove(index);
        index = m_vector.indexOf(t);
    }
};

template <typename T> inline void dtkContainerVector<T>::insert(const QVariant& data, dtkxarch_int index)
{
    m_vector.insert(index, qvariant_cast<T>(data));
};

template <typename T> inline void dtkContainerVector<T>::replace(const QVariant& data, dtkxarch_int index)
{
    m_vector.replace(index, qvariant_cast<T>(data));
};

template <typename T> inline void dtkContainerVector<T>::resize(dtkxarch_int size)
{
    m_vector.reserve(size);
};

template <typename T> inline bool dtkContainerVector<T>::isEmpty(void) const
{
    return m_vector.isEmpty();
};

template <typename T> inline bool dtkContainerVector<T>::contains(const QVariant& data) const
{
    return m_vector.contains(qvariant_cast<T>(data));
};

template <typename T> inline dtkxarch_int dtkContainerVector<T>::count(void) const
{
    qDebug() << __func__ << m_vector.count();

    return m_vector.count();
};
{'fraction_non_alphanumeric': 0.17159849144183348, 'fraction_numerical': 0.011314186248912098, 'mean_word_length': 4.316114109483423, 'pattern_counts': {'":': 0, '<': 121, '<?xml version=': 0, '>': 111, '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': '4534955', 'n_tokens_mistral': 2276, 'n_tokens_neox': 2186, 'n_words': 458}