<commit_before>//
//  Factory.cpp
//  ee_x
//
//  Created by eps on 3/20/18.
//

#include "ee/core/PluginManager.hpp"

#include <string>
#include <unordered_map>

#include "ee/core/Platform.hpp"
#include "ee/core/internal/MessageBridge.hpp"

namespace ee {
namespace core {
using Self = PluginManager;

#if defined(EE_X_ANDROID)
template <>
bool Self::initializePlugins<Library::Core>() {
    auto&& bridge = MessageBridge::getInstance();
    Platform::registerHandlers(bridge);
    return true;
}

bool Self::addPlugin(Plugin plugin) {
    // FIXME.
    return false;
}

bool Self::removePlugin(Plugin plugin) {
    // FIXME.
    return false;
}
#endif // EE_X_ANDROID

#if defined(EE_X_IOS) || defined(EE_X_OSX)
extern "C" {
bool ee_staticInitializePlugins();
bool ee_staticAddPlugin(const std::string& name);
bool ee_staticRemovePlugin(const std::string& name);
} // extern "C"

template <>
bool Self::initializePlugins<Library::Core>() {
    auto&& bridge = MessageBridge::getInstance();
    Platform::registerHandlers(bridge);
    return ee_staticInitializePlugins();
}

namespace {
std::unordered_map<Plugin, std::string> pluginNames_ = {{
    {Plugin::AdMob, "AdMob"},
    {Plugin::AppLovin, "AppLovin"},
    {Plugin::AppsFlyer, "AppsFlyer"},
    {Plugin::CampaignReceiver, "CampaignReceiver"},
    {Plugin::Facebook, "Facebook"},
    {Plugin::FacebookAds, "FacebookAds"},
    {Plugin::FirebaseCore, "FirebaseCore"},
    {Plugin::FirebaseCrashlytics, "FirebaseCrashlytics"},
    {Plugin::FirebasePerformance, "FirebasePerformance"},
    {Plugin::GoogleAnalytics, "GoogleAnalytics"},
    {Plugin::IronSource, "IronSource"},
    {Plugin::Notification, "Notification"},
    {Plugin::Play, "Play"},
    {Plugin::Recorder, "Recorder"},
    {Plugin::Store, "Store"},
    {Plugin::Tenjin, "Tenjin"},
    {Plugin::UnityAds, "UnityAds"},
    {Plugin::Vungle, "Vungle"},
}};
} // namespace

bool Self::addPlugin(Plugin plugin) {
    auto&& name = pluginNames_.at(plugin);
    return ee_staticAddPlugin(name);
}

bool Self::removePlugin(Plugin plugin) {
    auto&& name = pluginNames_.at(plugin);
    return ee_staticRemovePlugin(name);
}
#endif // defined(EE_X_IOS) || defined(EE_X_OSX)
} // namespace core
} // namespace ee<commit_msg>Fix to use const char* for bridging methods.<commit_after>//
//  Factory.cpp
//  ee_x
//
//  Created by eps on 3/20/18.
//

#include "ee/core/PluginManager.hpp"

#include <string>
#include <unordered_map>

#include "ee/core/Platform.hpp"
#include "ee/core/internal/MessageBridge.hpp"

namespace ee {
namespace core {
using Self = PluginManager;

#if defined(EE_X_ANDROID)
template <>
bool Self::initializePlugins<Library::Core>() {
    auto&& bridge = MessageBridge::getInstance();
    Platform::registerHandlers(bridge);
    return true;
}

bool Self::addPlugin(Plugin plugin) {
    // FIXME.
    return false;
}

bool Self::removePlugin(Plugin plugin) {
    // FIXME.
    return false;
}
#endif // EE_X_ANDROID

#if defined(EE_X_IOS) || defined(EE_X_OSX)
extern "C" {
bool ee_staticInitializePlugins();
bool ee_staticAddPlugin(const char* name);
bool ee_staticRemovePlugin(const char* name);
} // extern "C"

template <>
bool Self::initializePlugins<Library::Core>() {
    auto&& bridge = MessageBridge::getInstance();
    Platform::registerHandlers(bridge);
    return ee_staticInitializePlugins();
}

namespace {
std::unordered_map<Plugin, std::string> pluginNames_ = {{
    {Plugin::AdMob, "AdMob"},
    {Plugin::AppLovin, "AppLovin"},
    {Plugin::AppsFlyer, "AppsFlyer"},
    {Plugin::CampaignReceiver, "CampaignReceiver"},
    {Plugin::Facebook, "Facebook"},
    {Plugin::FacebookAds, "FacebookAds"},
    {Plugin::FirebaseCore, "FirebaseCore"},
    {Plugin::FirebaseCrashlytics, "FirebaseCrashlytics"},
    {Plugin::FirebasePerformance, "FirebasePerformance"},
    {Plugin::GoogleAnalytics, "GoogleAnalytics"},
    {Plugin::IronSource, "IronSource"},
    {Plugin::Notification, "Notification"},
    {Plugin::Play, "Play"},
    {Plugin::Recorder, "Recorder"},
    {Plugin::Store, "Store"},
    {Plugin::Tenjin, "Tenjin"},
    {Plugin::UnityAds, "UnityAds"},
    {Plugin::Vungle, "Vungle"},
}};
} // namespace

bool Self::addPlugin(Plugin plugin) {
    auto&& name = pluginNames_.at(plugin);
    return ee_staticAddPlugin(name.c_str());
}

bool Self::removePlugin(Plugin plugin) {
    auto&& name = pluginNames_.at(plugin);
    return ee_staticRemovePlugin(name.c_str());
}
#endif // defined(EE_X_IOS) || defined(EE_X_OSX)
} // namespace core
} // namespace ee
{'fraction_non_alphanumeric': 0.1635919093131807, 'fraction_numerical': 0.002222716159146477, 'mean_word_length': 4.9445178335535, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5423866', 'n_tokens_mistral': 1551, 'n_tokens_neox': 1500, 'n_words': 286}