<commit_before>/**
 * Appcelerator Titanium - licensed under the Apache Public License 2
 * see LICENSE in the root folder for details on the license.
 * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
 */
#include <kroll/kroll.h>
#include <Poco/Environment.h>
#include "app_binding.h"
#include "app_config.h"
#include "Properties/properties_binding.h"

namespace ti
{
	AppBinding::AppBinding(Host *host, SharedKObject global) : host(host),global(global)
	{
		/**
		 * @tiapi(method=True,immutable=True,name=App.getID,since=0.2) get the application id
		 * @tiresult(for=App.getID,type=string) returns the id
		 */
		this->SetMethod("getID", &AppBinding::GetID);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getName,since=0.2) get the application name
	     * @tiresult(for=App.getName,type=string) returns the name
		 */
		this->SetMethod("getName", &AppBinding::GetName);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getVersion,since=0.2) get the application version
		 * @tiresult(for=App.getVersion,type=string) returns the version
		 */
		this->SetMethod("getVersion", &AppBinding::GetVersion);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getPublisher,since=0.4) get the application publisher
	     * @tiresult(for=App.getPublisher,type=string) returns the publisher
		 */
		this->SetMethod("getPublisher", &AppBinding::GetPublisher);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getURL,since=0.4) get the application url
	     * @tiresult(for=App.getURL,type=string) returns the url for the app
		 */
		this->SetMethod("getURL", &AppBinding::GetURL);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getDescription,since=0.4) get the application description
	     * @tiresult(for=App.getDescription,type=string) returns the description for the app
		 */
		this->SetMethod("getDescription", &AppBinding::GetDescription);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getCopyright,since=0.4) get the application copyright
	     * @tiresult(for=App.getCopyright,type=string) returns the copyright for the app
		 */
		this->SetMethod("getCopyright", &AppBinding::GetCopyright);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getGUID,since=0.2) get the application globally unique id
	     * @tiresult(for=App.getGUID,type=string) returns the unique id
		 */
		this->SetMethod("getGUID", &AppBinding::GetGUID);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getStreamURL,since=0.4) get the application stream URL for the update channel
	     * @tiresult(for=App.getStreamURL,type=string) returns the stream URL
		 */
		this->SetMethod("getStreamURL", &AppBinding::GetStreamURL);
		/**
		 * @tiapi(method=True,immutable=True,name=App.appURLToPath,since=0.2) get a full path from an application using app: URL
		 * @tiresult(for=App.appURLToPath,type=string) returns the path
		 */
		this->SetMethod("appURLToPath", &AppBinding::AppURLToPath);
		
		/**
		 * @tiapi(property=True,immutable=True,type=string,name=App.path,since=0.2) get a full path to the application
		 */
#ifdef OS_OSX
		NSString *path = [[NSBundle mainBundle] bundlePath];
		this->Set("path",Value::NewString([path UTF8String]));
#else
		this->Set("path",Value::NewString(host->GetCommandLineArg(0)));
#endif

		/**
		 * @tiapi(property=True,immutable=True,type=double,name=App.version,since=0.2) returns the Titanium product version
		 */
		SharedValue version = Value::NewDouble(PRODUCT_VERSION);
		global->Set("version", version);

		/**
		 * @tiapi(property=True,immutable=True,type=string,name=App.platform,since=0.2) returns the Titanium platform
		 */
		SharedValue platform = Value::NewString(host->GetPlatform());
		global->Set("platform",platform);

		// skip the first argument which is the filepath to the
		// executable
		SharedKList argList = new StaticBoundList();
		for (int i = 1; i < Host::GetInstance()->GetCommandLineArgCount(); i++) {
			argList->Append(Value::NewString(Host::GetInstance()->GetCommandLineArg(i)));
		}
		SharedValue arguments = Value::NewList(argList);
		/**
		 * @tiapi(property=True,immutable=True,type=list,name=App.arguments,since=0.2) returns the arguments from the command line
		 */
		Set("arguments", arguments);

		/**
		 * @tiapi(method=True,immutable=True,name=App.exit,since=0.2) causes the application to exit
		 */
		this->SetMethod("exit",&AppBinding::Exit);
<commit_msg>PRODUCT_VERSION should've been converted to a string for Titanium.App.version<commit_after>/**
 * Appcelerator Titanium - licensed under the Apache Public License 2
 * see LICENSE in the root folder for details on the license.
 * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
 */
#include <kroll/kroll.h>
#include <Poco/Environment.h>
#include "app_binding.h"
#include "app_config.h"
#include "Properties/properties_binding.h"

namespace ti
{
	AppBinding::AppBinding(Host *host, SharedKObject global) : host(host),global(global)
	{
		/**
		 * @tiapi(method=True,immutable=True,name=App.getID,since=0.2) get the application id
		 * @tiresult(for=App.getID,type=string) returns the id
		 */
		this->SetMethod("getID", &AppBinding::GetID);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getName,since=0.2) get the application name
	     * @tiresult(for=App.getName,type=string) returns the name
		 */
		this->SetMethod("getName", &AppBinding::GetName);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getVersion,since=0.2) get the application version
		 * @tiresult(for=App.getVersion,type=string) returns the version
		 */
		this->SetMethod("getVersion", &AppBinding::GetVersion);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getPublisher,since=0.4) get the application publisher
	     * @tiresult(for=App.getPublisher,type=string) returns the publisher
		 */
		this->SetMethod("getPublisher", &AppBinding::GetPublisher);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getURL,since=0.4) get the application url
	     * @tiresult(for=App.getURL,type=string) returns the url for the app
		 */
		this->SetMethod("getURL", &AppBinding::GetURL);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getDescription,since=0.4) get the application description
	     * @tiresult(for=App.getDescription,type=string) returns the description for the app
		 */
		this->SetMethod("getDescription", &AppBinding::GetDescription);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getCopyright,since=0.4) get the application copyright
	     * @tiresult(for=App.getCopyright,type=string) returns the copyright for the app
		 */
		this->SetMethod("getCopyright", &AppBinding::GetCopyright);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getGUID,since=0.2) get the application globally unique id
	     * @tiresult(for=App.getGUID,type=string) returns the unique id
		 */
		this->SetMethod("getGUID", &AppBinding::GetGUID);
		/**
		 * @tiapi(method=True,immutable=True,name=App.getStreamURL,since=0.4) get the application stream URL for the update channel
	     * @tiresult(for=App.getStreamURL,type=string) returns the stream URL
		 */
		this->SetMethod("getStreamURL", &AppBinding::GetStreamURL);
		/**
		 * @tiapi(method=True,immutable=True,name=App.appURLToPath,since=0.2) get a full path from an application using app: URL
		 * @tiresult(for=App.appURLToPath,type=string) returns the path
		 */
		this->SetMethod("appURLToPath", &AppBinding::AppURLToPath);
		
		/**
		 * @tiapi(property=True,immutable=True,type=string,name=App.path,since=0.2) get a full path to the application
		 */
#ifdef OS_OSX
		NSString *path = [[NSBundle mainBundle] bundlePath];
		this->Set("path",Value::NewString([path UTF8String]));
#else
		this->Set("path",Value::NewString(host->GetCommandLineArg(0)));
#endif

		/**
		 * @tiapi(property=True,immutable=True,type=string,name=App.version,since=0.2) returns the Titanium product version
		 */
		SharedValue version = Value::NewString(STRING(PRODUCT_VERSION));
		global->Set("version", version);

		/**
		 * @tiapi(property=True,immutable=True,type=string,name=App.platform,since=0.2) returns the Titanium platform
		 */
		SharedValue platform = Value::NewString(host->GetPlatform());
		global->Set("platform",platform);

		// skip the first argument which is the filepath to the
		// executable
		SharedKList argList = new StaticBoundList();
		for (int i = 1; i < Host::GetInstance()->GetCommandLineArgCount(); i++) {
			argList->Append(Value::NewString(Host::GetInstance()->GetCommandLineArg(i)));
		}
		SharedValue arguments = Value::NewList(argList);
		/**
		 * @tiapi(property=True,immutable=True,type=list,name=App.arguments,since=0.2) returns the arguments from the command line
		 */
		Set("arguments", arguments);

		/**
		 * @tiapi(method=True,immutable=True,name=App.exit,since=0.2) causes the application to exit
		 */
		this->SetMethod("exit",&AppBinding::Exit);

{'fraction_non_alphanumeric': 0.15088555858310626, 'fraction_numerical': 0.00862851952770209, 'mean_word_length': 5.397240377632534, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 47, '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': '4127118', 'n_tokens_mistral': 3066, 'n_tokens_neox': 2831, 'n_words': 534}