<commit_before>//#include <ApplicationServices/ApplicationServices.h>
#import <UIKit/UIKit.h>
#include <Utils.h>

namespace nme {

bool LaunchBrowser(const char *inUtf8URL)
{
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *str = [[NSString alloc] initWithUTF8String:inUtf8URL];	
	[[UIApplication sharedApplication] openURL:[NSURL URLWithString: str]];
	#ifndef OBJC_ARC
	[str release];
	[pool drain];
    #endif
	return true;
}

std::string CapabilitiesGetLanguage()
{
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
	std::string result(language?[language UTF8String]:"");
	#ifndef OBJC_ARC
	[language release];
	[pool drain];
    #endif
	return result;
}

std::string GetUserPreference(const char *inId)
{
	NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *strId = [[NSString alloc] initWithUTF8String:inId];
	NSString *pref = [userDefaults stringForKey:strId];
	std::string result(pref?[pref UTF8String]:"");
	#ifndef OBJC_ARC
	[strId release];
	[pool drain];
    #endif
	return result;
}
	
bool SetUserPreference(const char *inId, const char *inPreference)
{
	NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *strId = [[NSString alloc] initWithUTF8String:inId];
	NSString *strPref = [[NSString alloc] initWithUTF8String:inPreference];
	[userDefaults setObject:strPref forKey:strId];
	#ifndef OBJC_ARC
	[strId release];
	[strPref release];
	[pool drain];
    #endif
	return true;
}

bool ClearUserPreference(const char *inId)
{
	NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *strId = [[NSString alloc] initWithUTF8String:inId];
	[userDefaults setObject:@"" forKey:strId];
	#ifndef OBJC_ARC
	[strId release];
	[pool drain];
    #endif
	return true;
}

const std::string GetUniqueDeviceIdentifier()
{
	// @todo this is deprecated as of iOS 5. switch this out ASAP for UUID generation into user defaults.
  	return [[[UIDevice currentDevice] uniqueIdentifier] cStringUsingEncoding:1];
}

const std::string &GetResourcePath()
{
   static bool tried = false;
   static std::string path;
   if (!tried)
   {
      tried = true;
	  #ifndef OBJC_ARC
	  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
      #endif
      NSString *resourcePath = [ [NSBundle mainBundle]  resourcePath];
      path = [resourcePath cStringUsingEncoding:1];
	  #ifndef OBJC_ARC
      [pool release];
	  #endif
      path += "/";
   }

   return path;
}<commit_msg>Disable UUID, per Apple restrictions<commit_after>//#include <ApplicationServices/ApplicationServices.h>
#import <UIKit/UIKit.h>
#include <Utils.h>

namespace nme {

bool LaunchBrowser(const char *inUtf8URL)
{
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *str = [[NSString alloc] initWithUTF8String:inUtf8URL];	
	[[UIApplication sharedApplication] openURL:[NSURL URLWithString: str]];
	#ifndef OBJC_ARC
	[str release];
	[pool drain];
    #endif
	return true;
}

std::string CapabilitiesGetLanguage()
{
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
	std::string result(language?[language UTF8String]:"");
	#ifndef OBJC_ARC
	[language release];
	[pool drain];
    #endif
	return result;
}

std::string GetUserPreference(const char *inId)
{
	NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *strId = [[NSString alloc] initWithUTF8String:inId];
	NSString *pref = [userDefaults stringForKey:strId];
	std::string result(pref?[pref UTF8String]:"");
	#ifndef OBJC_ARC
	[strId release];
	[pool drain];
    #endif
	return result;
}
	
bool SetUserPreference(const char *inId, const char *inPreference)
{
	NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *strId = [[NSString alloc] initWithUTF8String:inId];
	NSString *strPref = [[NSString alloc] initWithUTF8String:inPreference];
	[userDefaults setObject:strPref forKey:strId];
	#ifndef OBJC_ARC
	[strId release];
	[strPref release];
	[pool drain];
    #endif
	return true;
}

bool ClearUserPreference(const char *inId)
{
	NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
	#ifndef OBJC_ARC
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    #endif
	NSString *strId = [[NSString alloc] initWithUTF8String:inId];
	[userDefaults setObject:@"" forKey:strId];
	#ifndef OBJC_ARC
	[strId release];
	[pool drain];
    #endif
	return true;
}

const std::string GetUniqueDeviceIdentifier()
{
	// @todo this is deprecated as of iOS 5. switch this out ASAP for UUID generation into user defaults.
  	//return [[[UIDevice currentDevice] uniqueIdentifier] cStringUsingEncoding:1];
  	return "";
}

const std::string &GetResourcePath()
{
   static bool tried = false;
   static std::string path;
   if (!tried)
   {
      tried = true;
	  #ifndef OBJC_ARC
	  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
      #endif
      NSString *resourcePath = [ [NSBundle mainBundle]  resourcePath];
      path = [resourcePath cStringUsingEncoding:1];
	  #ifndef OBJC_ARC
      [pool release];
	  #endif
      path += "/";
   }

   return path;
}
{'fraction_non_alphanumeric': 0.11377348732977073, 'fraction_numerical': 0.004481985864506119, 'mean_word_length': 5.185501066098081, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6477857', 'n_tokens_mistral': 2021, 'n_tokens_neox': 1903, 'n_words': 491}