<commit_before>// ==========================================================================
//                 SeqAn - The Library for Sequence Analysis
// ==========================================================================
// Copyright (c) 2006-2013, <NAME>, FU Berlin
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//     * Neither the name of Knut Reinert or the FU Berlin nor the names of
//       its contributors may be used to endorse or promote products derived
//       from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
// ==========================================================================
// Author: <NAME> <david.weese@fu-berlin.de>
// Author: <NAME> <manuel.holtgrewe@fu-berlin.de>
// ==========================================================================

// TODO(holtgrew): Split into modified_string_mod_view.h and modified_iterator_mod_view.h.
// TODO(holtgrew): Move out convert()

#ifndef SEQAN_MODIFIER_MODIFIER_VIEW_H_
#define SEQAN_MODIFIER_MODIFIER_VIEW_H_

namespace seqan
{

// ==========================================================================
// Forwards
// ==========================================================================

// ==========================================================================
// Classes
// ==========================================================================

// --------------------------------------------------------------------------
// Class ModView
// --------------------------------------------------------------------------

/*!
 * @class ModViewModifiedIterator
 * @extends ModifiedIterator
 * @headerfile <seqan/modifier.h>
 *
 * @brief Transforms the character of a host using a custom functor.
 *
 * @signature template <typename THost, typename TFunctor>
 *            class ModifiedIterator<THost, ModView<TFunctor> >;
 *
 * @tparam THost    The host iterator.
 * @tparam TFunctor A unary functor type.
 */

/*!
 * @class ModViewModifiedString
 * @extends ModifiedString
 * @headerfile <seqan/modifier.h>
 *
 * @brief Transforms the character of a host using a custom functor.
 *
 * @signature template <typename THost, typename TFunctor>
 *            class ModifiedString<THost, ModView<TFunctor> >;
 *
 * @tparam THost    The host iterator.
 * @tparam TFunctor A unary functor type.
 */

/**
.Spec.ModView:
..summary:Transforms the characters of the $THost$ string/iterator using a custom function.
..cat:Modifier
..general:Class.ModifiedIterator
..general:Class.ModifiedString
..signature:ModifiedIterator<THost, ModView<TFunctor> >
..signature:ModifiedString<THost, ModView<TFunctor> >
..param.THost:Original string/iterator.
...type:Concept.RandomAccessIteratorConcept
..param.TFunctor:A unary function (see STL's $unary_function$).
...remarks:The argument type of $TFunctor$ must be $VALUE<THost>::Type$.
..remarks:The @Metafunction.Value@ type of this modifier is the result type of $TFunctor$.
..include:seqan/modifier.h
*/

template <typename TFunctor>
struct ModView {};

template <typename TFunctor>
struct ModViewCargo
{
    TFunctor	func;
};

template <typename THost, typename TFunctor>
class ModifiedIterator<THost, ModView<TFunctor> >
{
public:
    typedef typename Cargo<ModifiedIterator>::Type TCargo_;

    Holder<THost, Simple>   _host;
    TCargo_ _cargo;

    mutable typename Value<ModifiedIterator>::Type	tmp_value;

    ModifiedIterator() : _host(), _cargo()
    {}

    explicit
    ModifiedIterator(THost const & host) : _host(host), _cargo()
    {}

    ModifiedIterator(THost const & host, TFunctor const & functor) : _host(host), _cargo()
    {
        cargo(*this).func = functor;
    }

//    explicit
//    ModifiedIterator(TFunctor const & functor) : _host(), _cargo()
//    {
//        cargo(*this).func = functor;
//    }
};

// --------------------------------------------------------------------------
// Class ModifiedString
// --------------------------------------------------------------------------

template <typename THost, typename TFunctor>
class ModifiedString<THost, ModView<TFunctor> >
{
public:
    typedef typename Pointer_<THost>::Type       THostPointer_;
    typedef typename Cargo<ModifiedString>::Type TCargo_;
    
    typedef typename InnermostHost_<ModifiedString>::Type TInnermostHost_;

    THostPointer_ _host;
    TCargo_ _cargo;

    mutable typename Value<ModifiedString>::Type	tmp_value;

    // Default constructor.
    ModifiedString() : _host(), _cargo()
    {}

    // Construct with the actual host.
    explicit
    ModifiedString(typename Parameter_<THost>::Type & host) : _host(_toPointer(host)), _cargo(), tmp_value()
    {}

    // Construct with the functor.
    explicit
    ModifiedString(TFunctor const & functor) : _host(), _cargo(), tmp_value()
    {
        cargo(*this).func = functor;
    }

    // Constructor for creating a ModifiedString with const host from a non-const host.
    template <typename THost_>
    explicit
    ModifiedString(THost_ & host,
                   SEQAN_CTOR_ENABLE_IF(IsConstructible<THost, THost_>)) :
            _host(_toPointer(host)), _cargo(), tmp_value()
    {
        ignoreUnusedVariableWarning(dummy);
    }

    // Construct with the actual host; variant with functor.
    ModifiedString(typename Parameter_<THost>::Type & host, TFunctor const & functor) :
            _host(_toPointer(host)), _cargo(), tmp_value()
    {
        cargo(*this).func = functor;
    }

    // Constructor for creating a ModifiedString with const host with a non-const host; variant with functor.
    template <typename THost_>
    explicit
    ModifiedString(THost_ & host,
                   TFunctor const & functor,
                   SEQAN_CTOR_ENABLE_IF(IsConstructible<THost, THost_>)) :
            _host(_toPointer(host)), _cargo(), tmp_value()
    {
        ignoreUnusedVariableWarning(dummy);
        cargo(*this).func = functor;
    }

#ifdef SEQAN_CXX11_STANDARD

    // Constructor for innermost type; hand down to _host which is a ModifiedString itself.<commit_msg>[FIX] removed extra reference after Parameter_<..><commit_after>// ==========================================================================
//                 SeqAn - The Library for Sequence Analysis
// ==========================================================================
// Copyright (c) 2006-2013, <NAME>, FU Berlin
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//     * Neither the name of <NAME> or the FU Berlin nor the names of
//       its contributors may be used to endorse or promote products derived
//       from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
// ==========================================================================
// Author: <NAME> <<EMAIL>>
// Author: <NAME> <manuel.holtgrewe@fu-berlin.de>
// ==========================================================================

// TODO(holtgrew): Split into modified_string_mod_view.h and modified_iterator_mod_view.h.
// TODO(holtgrew): Move out convert()

#ifndef SEQAN_MODIFIER_MODIFIER_VIEW_H_
#define SEQAN_MODIFIER_MODIFIER_VIEW_H_

namespace seqan
{

// ==========================================================================
// Forwards
// ==========================================================================

// ==========================================================================
// Classes
// ==========================================================================

// --------------------------------------------------------------------------
// Class ModView
// --------------------------------------------------------------------------

/*!
 * @class ModViewModifiedIterator
 * @extends ModifiedIterator
 * @headerfile <seqan/modifier.h>
 *
 * @brief Transforms the character of a host using a custom functor.
 *
 * @signature template <typename THost, typename TFunctor>
 *            class ModifiedIterator<THost, ModView<TFunctor> >;
 *
 * @tparam THost    The host iterator.
 * @tparam TFunctor A unary functor type.
 */

/*!
 * @class ModViewModifiedString
 * @extends ModifiedString
 * @headerfile <seqan/modifier.h>
 *
 * @brief Transforms the character of a host using a custom functor.
 *
 * @signature template <typename THost, typename TFunctor>
 *            class ModifiedString<THost, ModView<TFunctor> >;
 *
 * @tparam THost    The host iterator.
 * @tparam TFunctor A unary functor type.
 */

/**
.Spec.ModView:
..summary:Transforms the characters of the $THost$ string/iterator using a custom function.
..cat:Modifier
..general:Class.ModifiedIterator
..general:Class.ModifiedString
..signature:ModifiedIterator<THost, ModView<TFunctor> >
..signature:ModifiedString<THost, ModView<TFunctor> >
..param.THost:Original string/iterator.
...type:Concept.RandomAccessIteratorConcept
..param.TFunctor:A unary function (see STL's $unary_function$).
...remarks:The argument type of $TFunctor$ must be $VALUE<THost>::Type$.
..remarks:The @Metafunction.Value@ type of this modifier is the result type of $TFunctor$.
..include:seqan/modifier.h
*/

template <typename TFunctor>
struct ModView {};

template <typename TFunctor>
struct ModViewCargo
{
    TFunctor	func;
};

template <typename THost, typename TFunctor>
class ModifiedIterator<THost, ModView<TFunctor> >
{
public:
    typedef typename Cargo<ModifiedIterator>::Type TCargo_;

    Holder<THost, Simple>   _host;
    TCargo_ _cargo;

    mutable typename Value<ModifiedIterator>::Type	tmp_value;

    ModifiedIterator() : _host(), _cargo()
    {}

    explicit
    ModifiedIterator(THost const & host) : _host(host), _cargo()
    {}

    ModifiedIterator(THost const & host, TFunctor const & functor) : _host(host), _cargo()
    {
        cargo(*this).func = functor;
    }

//    explicit
//    ModifiedIterator(TFunctor const & functor) : _host(), _cargo()
//    {
//        cargo(*this).func = functor;
//    }
};

// --------------------------------------------------------------------------
// Class ModifiedString
// --------------------------------------------------------------------------

template <typename THost, typename TFunctor>
class ModifiedString<THost, ModView<TFunctor> >
{
public:
    typedef typename Pointer_<THost>::Type       THostPointer_;
    typedef typename Cargo<ModifiedString>::Type TCargo_;
    
    typedef typename InnermostHost_<ModifiedString>::Type TInnermostHost_;

    THostPointer_ _host;
    TCargo_ _cargo;

    mutable typename Value<ModifiedString>::Type	tmp_value;

    // Default constructor.
    ModifiedString() : _host(), _cargo()
    {}

    // Construct with the actual host.
    explicit
    ModifiedString(typename Parameter_<THost>::Type host) : _host(_toPointer(host)), _cargo(), tmp_value()
    {}

    // Construct with the functor.
    explicit
    ModifiedString(TFunctor const & functor) : _host(), _cargo(), tmp_value()
    {
        cargo(*this).func = functor;
    }

    // Constructor for creating a ModifiedString with const host from a non-const host.
    template <typename THost_>
    explicit
    ModifiedString(THost_ & host,
                   SEQAN_CTOR_ENABLE_IF(IsConstructible<THost, THost_>)) :
            _host(_toPointer(host)), _cargo(), tmp_value()
    {
        ignoreUnusedVariableWarning(dummy);
    }

    // Construct with the actual host; variant with functor.
    ModifiedString(typename Parameter_<THost>::Type host, TFunctor const & functor) :
            _host(_toPointer(host)), _cargo(), tmp_value()
    {
        cargo(*this).func = functor;
    }

    // Constructor for creating a ModifiedString with const host with a non-const host; variant with functor.
    template <typename THost_>
    explicit
    ModifiedString(THost_ & host,
                   TFunctor const & functor,
                   SEQAN_CTOR_ENABLE_IF(IsConstructible<THost, THost_>)) :
            _host(_toPointer(host)), _cargo(), tmp_value()
    {
        ignoreUnusedVariableWarning(dummy);
        cargo(*this).func = functor;
    }

#ifdef SEQAN_CXX11_STANDARD

    // Constructor for innermost type; hand down to _host which is a ModifiedString itself.
{'fraction_non_alphanumeric': 0.210727969348659, 'fraction_numerical': 0.0013683634373289546, 'mean_word_length': 3.143140589569161, 'pattern_counts': {'":': 0, '<': 84, '<?xml version=': 0, '>': 84, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, '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': '4497713', 'n_tokens_mistral': 4019, 'n_tokens_neox': 3689, 'n_words': 1191}