<commit_before>/*
 * Copyright (c) 2014 <NAME> (<EMAIL>)
 *
 * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
 * or copy at http://opensource.org/licenses/MIT)
 */

#include <pkmn/enums.hpp>
#include <pkmn/database/queries.hpp>
#include <pkmn/types/shared_ptr.hpp>

#include "copy_sptrs.hpp"

#include "bag_impl.hpp"
#include "base_pokemon_gen1impl.hpp"
#include "base_pokemon_gen2impl.hpp"
#include "base_pokemon_modernimpl.hpp"
#include "game_save_gen1impl.hpp"
//#include "game_save_gen1impl.hpp"
#include "game_save_gen3impl.hpp"
#include "game_save_gen4impl.hpp"
#include "game_save_gen5impl.hpp"
//#include "game_save_gen1impl.hpp"
#include "item_impl.hpp"
#include "item_berryimpl.hpp"
#include "item_machineimpl.hpp"
#include "move_impl.hpp"
#include "pocket_impl.hpp"
#include "team_pokemon_gen1impl.hpp"
#include "team_pokemon_gen2impl.hpp"
#include "team_pokemon_modernimpl.hpp"
#include "trainer_impl.hpp"

namespace pkmn
{
    bag::sptr copy_bag(bag::sptr in)
    {
        bag_impl actual = *pkmn::dynamic_pointer_cast<bag_impl>(in);
        return pkmn::dynamic_pointer_cast<bag>(pkmn::make_shared<bag_impl>(actual));
    }

    base_pokemon::sptr copy_base_pokemon(base_pokemon::sptr in)
    {
        switch(in->get_generation()) //Generation determines implementation class
        {
            case 1:
            {
                base_pokemon_gen1impl actual1 = *pkmn::dynamic_pointer_cast<base_pokemon_gen1impl>(in);
                return pkmn::dynamic_pointer_cast<base_pokemon>(pkmn::make_shared<base_pokemon_gen1impl>(actual1));
            }

            case 2:
            {
                base_pokemon_gen2impl actual2 = *pkmn::dynamic_pointer_cast<base_pokemon_gen2impl>(in);
                return pkmn::dynamic_pointer_cast<base_pokemon>(pkmn::make_shared<base_pokemon_gen2impl>(actual2));
            }

            default:
            {
                base_pokemon_modernimpl actual3 = *pkmn::dynamic_pointer_cast<base_pokemon_modernimpl>(in);
                return pkmn::dynamic_pointer_cast<base_pokemon>(pkmn::make_shared<base_pokemon_modernimpl>(actual3));
            }
        }
    }

    /*game_save::sptr copy_game_save(game_save::sptr in)
    {
        switch(database::get_generation(in->get_game_id())) //Generation determines implementation class
        {
            case 1:
            {
                game_save_gen1impl actual1 = *pkmn::dynamic_pointer_cast<game_save_gen1impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen1impl>(actual1));
            }
            case 2:
            {
                game_save_gen2impl actual2 = *pkmn::dynamic_pointer_cast<game_save_gen2impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen2impl>(actual2));
            }
            case 3:
            {
                game_save_gen3impl actual3 = *pkmn::dynamic_pointer_cast<game_save_gen3impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen3impl>(actual3));
            }
            case 4:
            {
                game_save_gen4impl actual4 = *pkmn::dynamic_pointer_cast<game_save_gen4impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen4impl>(actual4));
            }
            default:
            {
                game_save_gen5impl actual5 = *pkmn::dynamic_pointer_cast<game_save_gen5impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen5impl>(actual5));
            }
            case 6:
            {
                game_save_gen6impl actual6 = *pkmn::dynamic_pointer_cast<game_save_gen6impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen6impl>(actual6));
            }
        }
    }*/

    item::sptr copy_item(item::sptr in)
    {
        unsigned int id = in->get_item_id();
        if((id >= Items::TM01 and id <= Items::HM08)
           or (id >= Items::TM93 and id <= Items::TM95)
           or (id >= Items::TM96 and id <= Items::TM100))
        {
            item_machineimpl actual_machine = *pkmn::dynamic_pointer_cast<item_machineimpl>(in);
            return pkmn::dynamic_pointer_cast<item>(pkmn::make_shared<item_machineimpl>(actual_machine));
        }
        else if((id >= Items::CHERI_BERRY and id <= Items::ROWAP_BERRY)
                or (id >= Items::BERRY and id <= Items::MYSTERYBERRY))
        {
            item_berryimpl actual_berry = *pkmn::dynamic_pointer_cast<item_berryimpl>(in);
            return pkmn::dynamic_pointer_cast<item>(pkmn::make_shared<item_berryimpl>(actual_berry));
        }
        else
        {
            item_impl actual = *pkmn::dynamic_pointer_cast<item_impl>(in);
            return pkmn::dynamic_pointer_cast<item>(pkmn::make_shared<item_impl>(actual));
        }
    }

    move::sptr copy_move(move::sptr in)
    {
        move_impl actual = *pkmn::dynamic_pointer_cast<move_impl>(in);
        return pkmn::dynamic_pointer_cast<move>(pkmn::make_shared<move_impl>(actual));
    }

    pocket::sptr copy_pocket(pocket::sptr in)
    {
        pocket_impl actual = *pkmn::dynamic_pointer_cast<pocket_impl>(in);
        return pkmn::dynamic_pointer_cast<pocket>(pkmn::make_shared<pocket_impl>(actual));
    }

    team_pokemon::sptr copy_team_pokemon(team_pokemon::sptr in)
    {
        switch(in->get_generation()) //Generation determines implementation class
        {
            case 1:
            {
                team_pokemon_gen1impl actual1 = *pkmn::dynamic_pointer_cast<team_pokemon_gen1impl>(in);
                return pkmn::dynamic_pointer_cast<team_pokemon>(pkmn::make_shared<team_pokemon_gen1impl>(actual1));
            }

            case 2:
            {
                team_pokemon_gen2impl actual2 = *pkmn::dynamic_pointer_cast<team_pokemon_gen2impl>(in);
                return pkmn::dynamic_pointer_cast<team_pokemon>(pkmn::make_shared<team_pokemon_gen2impl>(actual2));
            }

            default:
            {
                team_pokemon_modernimpl actual3 = *pkmn::dynamic_pointer_cast<team_pokemon_modernimpl>(in);
                return pkmn::dynamic_pointer_cast<team_pokemon>(pkmn::make_shared<team_pokemon_modernimpl>(actual3));
            }
        }
    }

    trainer::sptr copy_trainer(trainer::sptr in)
    {
        trainer_impl actual = *pkmn::dynamic_pointer_cast<trainer_impl>(in);
        return pkmn::dynamic_pointer_cast<trainer>(pkmn::make_shared<trainer_impl>(actual));
    }
}
<commit_msg>copy_sptrs: remove unnecessary #defines<commit_after>/*
 * Copyright (c) 2014 <NAME> (<EMAIL>)
 *
 * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
 * or copy at http://opensource.org/licenses/MIT)
 */

#include <pkmn/enums.hpp>
#include <pkmn/database/queries.hpp>
#include <pkmn/types/shared_ptr.hpp>

#include "copy_sptrs.hpp"

#include "bag_impl.hpp"
#include "base_pokemon_gen1impl.hpp"
#include "base_pokemon_gen2impl.hpp"
#include "base_pokemon_modernimpl.hpp"
#include "game_save_gen1impl.hpp"
//#include "game_save_gen1impl.hpp"
//#include "game_save_gen3impl.hpp"
//#include "game_save_gen4impl.hpp"
//#include "game_save_gen5impl.hpp"
#include "item_impl.hpp"
#include "item_berryimpl.hpp"
#include "item_machineimpl.hpp"
#include "move_impl.hpp"
#include "pocket_impl.hpp"
#include "team_pokemon_gen1impl.hpp"
#include "team_pokemon_gen2impl.hpp"
#include "team_pokemon_modernimpl.hpp"
#include "trainer_impl.hpp"

namespace pkmn
{
    bag::sptr copy_bag(bag::sptr in)
    {
        bag_impl actual = *pkmn::dynamic_pointer_cast<bag_impl>(in);
        return pkmn::dynamic_pointer_cast<bag>(pkmn::make_shared<bag_impl>(actual));
    }

    base_pokemon::sptr copy_base_pokemon(base_pokemon::sptr in)
    {
        switch(in->get_generation()) //Generation determines implementation class
        {
            case 1:
            {
                base_pokemon_gen1impl actual1 = *pkmn::dynamic_pointer_cast<base_pokemon_gen1impl>(in);
                return pkmn::dynamic_pointer_cast<base_pokemon>(pkmn::make_shared<base_pokemon_gen1impl>(actual1));
            }

            case 2:
            {
                base_pokemon_gen2impl actual2 = *pkmn::dynamic_pointer_cast<base_pokemon_gen2impl>(in);
                return pkmn::dynamic_pointer_cast<base_pokemon>(pkmn::make_shared<base_pokemon_gen2impl>(actual2));
            }

            default:
            {
                base_pokemon_modernimpl actual3 = *pkmn::dynamic_pointer_cast<base_pokemon_modernimpl>(in);
                return pkmn::dynamic_pointer_cast<base_pokemon>(pkmn::make_shared<base_pokemon_modernimpl>(actual3));
            }
        }
    }

    /*game_save::sptr copy_game_save(game_save::sptr in)
    {
        switch(database::get_generation(in->get_game_id())) //Generation determines implementation class
        {
            case 1:
            {
                game_save_gen1impl actual1 = *pkmn::dynamic_pointer_cast<game_save_gen1impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen1impl>(actual1));
            }
            case 2:
            {
                game_save_gen2impl actual2 = *pkmn::dynamic_pointer_cast<game_save_gen2impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen2impl>(actual2));
            }
            case 3:
            {
                game_save_gen3impl actual3 = *pkmn::dynamic_pointer_cast<game_save_gen3impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen3impl>(actual3));
            }
            case 4:
            {
                game_save_gen4impl actual4 = *pkmn::dynamic_pointer_cast<game_save_gen4impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen4impl>(actual4));
            }
            default:
            {
                game_save_gen5impl actual5 = *pkmn::dynamic_pointer_cast<game_save_gen5impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen5impl>(actual5));
            }
            case 6:
            {
                game_save_gen6impl actual6 = *pkmn::dynamic_pointer_cast<game_save_gen6impl>(in);
                return pkmn::dynamic_pointer_cast<game_save>(pkmn::make_shared<game_save_gen6impl>(actual6));
            }
        }
    }*/

    item::sptr copy_item(item::sptr in)
    {
        unsigned int id = in->get_item_id();
        if((id >= Items::TM01 and id <= Items::HM08)
           or (id >= Items::TM93 and id <= Items::TM95)
           or (id >= Items::TM96 and id <= Items::TM100))
        {
            item_machineimpl actual_machine = *pkmn::dynamic_pointer_cast<item_machineimpl>(in);
            return pkmn::dynamic_pointer_cast<item>(pkmn::make_shared<item_machineimpl>(actual_machine));
        }
        else if((id >= Items::CHERI_BERRY and id <= Items::ROWAP_BERRY)
                or (id >= Items::BERRY and id <= Items::MYSTERYBERRY))
        {
            item_berryimpl actual_berry = *pkmn::dynamic_pointer_cast<item_berryimpl>(in);
            return pkmn::dynamic_pointer_cast<item>(pkmn::make_shared<item_berryimpl>(actual_berry));
        }
        else
        {
            item_impl actual = *pkmn::dynamic_pointer_cast<item_impl>(in);
            return pkmn::dynamic_pointer_cast<item>(pkmn::make_shared<item_impl>(actual));
        }
    }

    move::sptr copy_move(move::sptr in)
    {
        move_impl actual = *pkmn::dynamic_pointer_cast<move_impl>(in);
        return pkmn::dynamic_pointer_cast<move>(pkmn::make_shared<move_impl>(actual));
    }

    pocket::sptr copy_pocket(pocket::sptr in)
    {
        pocket_impl actual = *pkmn::dynamic_pointer_cast<pocket_impl>(in);
        return pkmn::dynamic_pointer_cast<pocket>(pkmn::make_shared<pocket_impl>(actual));
    }

    team_pokemon::sptr copy_team_pokemon(team_pokemon::sptr in)
    {
        switch(in->get_generation()) //Generation determines implementation class
        {
            case 1:
            {
                team_pokemon_gen1impl actual1 = *pkmn::dynamic_pointer_cast<team_pokemon_gen1impl>(in);
                return pkmn::dynamic_pointer_cast<team_pokemon>(pkmn::make_shared<team_pokemon_gen1impl>(actual1));
            }

            case 2:
            {
                team_pokemon_gen2impl actual2 = *pkmn::dynamic_pointer_cast<team_pokemon_gen2impl>(in);
                return pkmn::dynamic_pointer_cast<team_pokemon>(pkmn::make_shared<team_pokemon_gen2impl>(actual2));
            }

            default:
            {
                team_pokemon_modernimpl actual3 = *pkmn::dynamic_pointer_cast<team_pokemon_modernimpl>(in);
                return pkmn::dynamic_pointer_cast<team_pokemon>(pkmn::make_shared<team_pokemon_modernimpl>(actual3));
            }
        }
    }

    trainer::sptr copy_trainer(trainer::sptr in)
    {
        trainer_impl actual = *pkmn::dynamic_pointer_cast<trainer_impl>(in);
        return pkmn::dynamic_pointer_cast<trainer>(pkmn::make_shared<trainer_impl>(actual));
    }
}

{'fraction_non_alphanumeric': 0.11440677966101695, 'fraction_numerical': 0.013544188861985473, 'mean_word_length': 2.9846246608381066, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 145, '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': '612029', 'n_tokens_mistral': 4553, 'n_tokens_neox': 4384, 'n_words': 515}