// Copyright (c) Microsoft Corporation
// All rights reserved. 
//
// Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
//
// THIS CODE IS PROVIDED ON AN  *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. 
//
// See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.

#define NTDDI_VERSION 0x06010000

#include <v8.h>
#include <string>
#include <node_object_wrap.h>
#include <ppltasks.h>
#include "CollectionsConverter.h"
#include "CollectionsWrap.h"
#include "node-async.h"
#include "NodeRtUtils.h"
#include "OpaqueWrapper.h"
#include "WrapperBase.h"

#using <Windows.WinMD>

// this undefs fixes the issues of compiling Windows.Data.Json, Windows.Storag.FileProperties, and Windows.Stroage.Search
// Some of the node header files brings windows definitions with the same names as some of the WinRT methods
#undef DocumentProperties
#undef GetObject
#undef CreateEvent
#undef FindText
#undef SendMessage

const char* REGISTRATION_TOKEN_MAP_PROPERTY_NAME = "__registrationTokenMap__";

using namespace v8;
using namespace node;
using namespace concurrency;

namespace NodeRT { namespace Windows { namespace Globalization { namespace NumberFormatting { 
  v8::Handle<v8::Value> WrapINumberRounder(::Windows::Globalization::NumberFormatting::INumberRounder^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::INumberRounder^ UnwrapINumberRounder(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapSignificantDigitsNumberRounder(::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^ UnwrapSignificantDigitsNumberRounder(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapIncrementNumberRounder(::Windows::Globalization::NumberFormatting::IncrementNumberRounder^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::IncrementNumberRounder^ UnwrapIncrementNumberRounder(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapINumberFormatter(::Windows::Globalization::NumberFormatting::INumberFormatter^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::INumberFormatter^ UnwrapINumberFormatter(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapINumberFormatter2(::Windows::Globalization::NumberFormatting::INumberFormatter2^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::INumberFormatter2^ UnwrapINumberFormatter2(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapINumberParser(::Windows::Globalization::NumberFormatting::INumberParser^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::INumberParser^ UnwrapINumberParser(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapINumberFormatterOptions(::Windows::Globalization::NumberFormatting::INumberFormatterOptions^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::INumberFormatterOptions^ UnwrapINumberFormatterOptions(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapISignificantDigitsOption(::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^ UnwrapISignificantDigitsOption(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapINumberRounderOption(::Windows::Globalization::NumberFormatting::INumberRounderOption^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::INumberRounderOption^ UnwrapINumberRounderOption(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapISignedZeroOption(::Windows::Globalization::NumberFormatting::ISignedZeroOption^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::ISignedZeroOption^ UnwrapISignedZeroOption(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapDecimalFormatter(::Windows::Globalization::NumberFormatting::DecimalFormatter^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::DecimalFormatter^ UnwrapDecimalFormatter(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapPercentFormatter(::Windows::Globalization::NumberFormatting::PercentFormatter^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::PercentFormatter^ UnwrapPercentFormatter(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapPermilleFormatter(::Windows::Globalization::NumberFormatting::PermilleFormatter^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::PermilleFormatter^ UnwrapPermilleFormatter(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapCurrencyFormatter(::Windows::Globalization::NumberFormatting::CurrencyFormatter^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::CurrencyFormatter^ UnwrapCurrencyFormatter(Handle<Value> value);
  
  v8::Handle<v8::Value> WrapNumeralSystemTranslator(::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^ wintRtInstance);
  ::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^ UnwrapNumeralSystemTranslator(Handle<Value> value);
  


  static v8::Handle<v8::Value> InitRoundingAlgorithmEnum(const Handle<Object> exports)
  {
    HandleScope scope;
    
    Handle<Object> enumObject = Object::New();
    exports->Set(String::NewSymbol("RoundingAlgorithm"), enumObject);

    enumObject->Set(String::NewSymbol("none"), Integer::New(0));
    enumObject->Set(String::NewSymbol("roundDown"), Integer::New(1));
    enumObject->Set(String::NewSymbol("roundUp"), Integer::New(2));
    enumObject->Set(String::NewSymbol("roundTowardsZero"), Integer::New(3));
    enumObject->Set(String::NewSymbol("roundAwayFromZero"), Integer::New(4));
    enumObject->Set(String::NewSymbol("roundHalfDown"), Integer::New(5));
    enumObject->Set(String::NewSymbol("roundHalfUp"), Integer::New(6));
    enumObject->Set(String::NewSymbol("roundHalfTowardsZero"), Integer::New(7));
    enumObject->Set(String::NewSymbol("roundHalfAwayFromZero"), Integer::New(8));
    enumObject->Set(String::NewSymbol("roundHalfToEven"), Integer::New(9));
    enumObject->Set(String::NewSymbol("roundHalfToOdd"), Integer::New(10));

    return scope.Close(Undefined());
  }


  static v8::Handle<v8::Value> InitCurrencyFormatterModeEnum(const Handle<Object> exports)
  {
    HandleScope scope;
    
    Handle<Object> enumObject = Object::New();
    exports->Set(String::NewSymbol("CurrencyFormatterMode"), enumObject);

    enumObject->Set(String::NewSymbol("useSymbol"), Integer::New(0));
    enumObject->Set(String::NewSymbol("useCurrencyCode"), Integer::New(1));

    return scope.Close(Undefined());
  }



  
  class INumberRounder : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("INumberRounder"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundInt32"), FunctionTemplate::New(RoundInt32)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundUInt32"), FunctionTemplate::New(RoundUInt32)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundInt64"), FunctionTemplate::New(RoundInt64)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundUInt64"), FunctionTemplate::New(RoundUInt64)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundSingle"), FunctionTemplate::New(RoundSingle)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundDouble"), FunctionTemplate::New(RoundDouble)->GetFunction());
      
                        
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("INumberRounder"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    INumberRounder(::Windows::Globalization::NumberFormatting::INumberRounder^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::INumberRounder^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::INumberRounder^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      INumberRounder *wrapperInstance = new INumberRounder(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> RoundInt32(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberRounder *wrapper = INumberRounder::Unwrap<INumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsInt32())
      {
        try
        {
          int arg0 = static_cast<int>(args[0]->Int32Value());
          
          int result;
          result = wrapper->_instance->RoundInt32(arg0);
          return scope.Close(Integer::New(result));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundUInt32(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberRounder *wrapper = INumberRounder::Unwrap<INumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsUint32())
      {
        try
        {
          unsigned int arg0 = static_cast<unsigned int>(args[0]->IntegerValue());
          
          unsigned int result;
          result = wrapper->_instance->RoundUInt32(arg0);
          return scope.Close(Integer::New(result));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundInt64(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberRounder *wrapper = INumberRounder::Unwrap<INumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          __int64 result;
          result = wrapper->_instance->RoundInt64(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundUInt64(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberRounder *wrapper = INumberRounder::Unwrap<INumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          unsigned __int64 result;
          result = wrapper->_instance->RoundUInt64(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundSingle(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberRounder *wrapper = INumberRounder::Unwrap<INumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          float arg0 = static_cast<float>(args[0]->NumberValue());
          
          float result;
          result = wrapper->_instance->RoundSingle(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberRounder *wrapper = INumberRounder::Unwrap<INumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          double result;
          result = wrapper->_instance->RoundDouble(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }





  private:
    ::Windows::Globalization::NumberFormatting::INumberRounder^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapINumberRounder(::Windows::Globalization::NumberFormatting::INumberRounder^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::INumberRounder^ UnwrapINumberRounder(Handle<Value> value);
    friend bool IsINumberRounderWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> INumberRounder::s_constructorTemplate;

  v8::Handle<v8::Value> WrapINumberRounder(::Windows::Globalization::NumberFormatting::INumberRounder^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(INumberRounder::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::INumberRounder^ UnwrapINumberRounder(Handle<Value> value)
  {
     return INumberRounder::Unwrap<INumberRounder>(value.As<Object>())->_instance;
  }

  void InitINumberRounder(Handle<Object> exports)
  {
    INumberRounder::Init(exports);
  }

  class SignificantDigitsNumberRounder : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("SignificantDigitsNumberRounder"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundInt32"), FunctionTemplate::New(RoundInt32)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundUInt32"), FunctionTemplate::New(RoundUInt32)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundInt64"), FunctionTemplate::New(RoundInt64)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundUInt64"), FunctionTemplate::New(RoundUInt64)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundSingle"), FunctionTemplate::New(RoundSingle)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundDouble"), FunctionTemplate::New(RoundDouble)->GetFunction());
      
                        
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("significantDigits"), SignificantDigitsGetter, SignificantDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("roundingAlgorithm"), RoundingAlgorithmGetter, RoundingAlgorithmSetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("SignificantDigitsNumberRounder"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    SignificantDigitsNumberRounder(::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 0)
      {
        try
        {
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      SignificantDigitsNumberRounder *wrapperInstance = new SignificantDigitsNumberRounder(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> RoundInt32(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsInt32())
      {
        try
        {
          int arg0 = static_cast<int>(args[0]->Int32Value());
          
          int result;
          result = wrapper->_instance->RoundInt32(arg0);
          return scope.Close(Integer::New(result));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundUInt32(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsUint32())
      {
        try
        {
          unsigned int arg0 = static_cast<unsigned int>(args[0]->IntegerValue());
          
          unsigned int result;
          result = wrapper->_instance->RoundUInt32(arg0);
          return scope.Close(Integer::New(result));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundInt64(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          __int64 result;
          result = wrapper->_instance->RoundInt64(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundUInt64(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          unsigned __int64 result;
          result = wrapper->_instance->RoundUInt64(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundSingle(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          float arg0 = static_cast<float>(args[0]->NumberValue());
          
          float result;
          result = wrapper->_instance->RoundSingle(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          double result;
          result = wrapper->_instance->RoundDouble(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }



    static Handle<Value> SignificantDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(info.This());

      try 
      {
        unsigned int result = wrapper->_instance->SignificantDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void SignificantDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsUint32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(info.This()))
      {
        return;
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(info.This());

      try 
      {
        
        unsigned int winRtValue = static_cast<unsigned int>(value->IntegerValue());

        wrapper->_instance->SignificantDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> RoundingAlgorithmGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(info.This());

      try 
      {
        ::Windows::Globalization::NumberFormatting::RoundingAlgorithm result = wrapper->_instance->RoundingAlgorithm;
        return scope.Close(Integer::New(static_cast<int>(result)));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void RoundingAlgorithmSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^>(info.This()))
      {
        return;
      }

      SignificantDigitsNumberRounder *wrapper = SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(info.This());

      try 
      {
        
        ::Windows::Globalization::NumberFormatting::RoundingAlgorithm winRtValue = static_cast<::Windows::Globalization::NumberFormatting::RoundingAlgorithm>(value->Int32Value());

        wrapper->_instance->RoundingAlgorithm = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapSignificantDigitsNumberRounder(::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^ UnwrapSignificantDigitsNumberRounder(Handle<Value> value);
    friend bool IsSignificantDigitsNumberRounderWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> SignificantDigitsNumberRounder::s_constructorTemplate;

  v8::Handle<v8::Value> WrapSignificantDigitsNumberRounder(::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(SignificantDigitsNumberRounder::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::SignificantDigitsNumberRounder^ UnwrapSignificantDigitsNumberRounder(Handle<Value> value)
  {
     return SignificantDigitsNumberRounder::Unwrap<SignificantDigitsNumberRounder>(value.As<Object>())->_instance;
  }

  void InitSignificantDigitsNumberRounder(Handle<Object> exports)
  {
    SignificantDigitsNumberRounder::Init(exports);
  }

  class IncrementNumberRounder : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("IncrementNumberRounder"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundInt32"), FunctionTemplate::New(RoundInt32)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundUInt32"), FunctionTemplate::New(RoundUInt32)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundInt64"), FunctionTemplate::New(RoundInt64)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundUInt64"), FunctionTemplate::New(RoundUInt64)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundSingle"), FunctionTemplate::New(RoundSingle)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("roundDouble"), FunctionTemplate::New(RoundDouble)->GetFunction());
      
                        
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("roundingAlgorithm"), RoundingAlgorithmGetter, RoundingAlgorithmSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("increment"), IncrementGetter, IncrementSetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("IncrementNumberRounder"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    IncrementNumberRounder(::Windows::Globalization::NumberFormatting::IncrementNumberRounder^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::IncrementNumberRounder^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::IncrementNumberRounder^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 0)
      {
        try
        {
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::IncrementNumberRounder();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      IncrementNumberRounder *wrapperInstance = new IncrementNumberRounder(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> RoundInt32(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsInt32())
      {
        try
        {
          int arg0 = static_cast<int>(args[0]->Int32Value());
          
          int result;
          result = wrapper->_instance->RoundInt32(arg0);
          return scope.Close(Integer::New(result));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundUInt32(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsUint32())
      {
        try
        {
          unsigned int arg0 = static_cast<unsigned int>(args[0]->IntegerValue());
          
          unsigned int result;
          result = wrapper->_instance->RoundUInt32(arg0);
          return scope.Close(Integer::New(result));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundInt64(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          __int64 result;
          result = wrapper->_instance->RoundInt64(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundUInt64(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          unsigned __int64 result;
          result = wrapper->_instance->RoundUInt64(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundSingle(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          float arg0 = static_cast<float>(args[0]->NumberValue());
          
          float result;
          result = wrapper->_instance->RoundSingle(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> RoundDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          double result;
          result = wrapper->_instance->RoundDouble(arg0);
          return scope.Close(Number::New(static_cast<double>(result)));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }



    static Handle<Value> RoundingAlgorithmGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(info.This());

      try 
      {
        ::Windows::Globalization::NumberFormatting::RoundingAlgorithm result = wrapper->_instance->RoundingAlgorithm;
        return scope.Close(Integer::New(static_cast<int>(result)));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void RoundingAlgorithmSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(info.This()))
      {
        return;
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(info.This());

      try 
      {
        
        ::Windows::Globalization::NumberFormatting::RoundingAlgorithm winRtValue = static_cast<::Windows::Globalization::NumberFormatting::RoundingAlgorithm>(value->Int32Value());

        wrapper->_instance->RoundingAlgorithm = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IncrementGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(info.This());

      try 
      {
        double result = wrapper->_instance->Increment;
        return scope.Close(Number::New(static_cast<double>(result)));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IncrementSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsNumber())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::IncrementNumberRounder^>(info.This()))
      {
        return;
      }

      IncrementNumberRounder *wrapper = IncrementNumberRounder::Unwrap<IncrementNumberRounder>(info.This());

      try 
      {
        
        double winRtValue = value->NumberValue();

        wrapper->_instance->Increment = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::IncrementNumberRounder^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapIncrementNumberRounder(::Windows::Globalization::NumberFormatting::IncrementNumberRounder^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::IncrementNumberRounder^ UnwrapIncrementNumberRounder(Handle<Value> value);
    friend bool IsIncrementNumberRounderWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> IncrementNumberRounder::s_constructorTemplate;

  v8::Handle<v8::Value> WrapIncrementNumberRounder(::Windows::Globalization::NumberFormatting::IncrementNumberRounder^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(IncrementNumberRounder::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::IncrementNumberRounder^ UnwrapIncrementNumberRounder(Handle<Value> value)
  {
     return IncrementNumberRounder::Unwrap<IncrementNumberRounder>(value.As<Object>())->_instance;
  }

  void InitIncrementNumberRounder(Handle<Object> exports)
  {
    IncrementNumberRounder::Init(exports);
  }

  class INumberFormatter : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("INumberFormatter"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("format"), FunctionTemplate::New(Format)->GetFunction());
      
                        
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("INumberFormatter"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    INumberFormatter(::Windows::Globalization::NumberFormatting::INumberFormatter^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::INumberFormatter^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatter^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::INumberFormatter^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      INumberFormatter *wrapperInstance = new INumberFormatter(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> Format(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatter *wrapper = INumberFormatter::Unwrap<INumberFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }





  private:
    ::Windows::Globalization::NumberFormatting::INumberFormatter^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapINumberFormatter(::Windows::Globalization::NumberFormatting::INumberFormatter^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::INumberFormatter^ UnwrapINumberFormatter(Handle<Value> value);
    friend bool IsINumberFormatterWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> INumberFormatter::s_constructorTemplate;

  v8::Handle<v8::Value> WrapINumberFormatter(::Windows::Globalization::NumberFormatting::INumberFormatter^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(INumberFormatter::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::INumberFormatter^ UnwrapINumberFormatter(Handle<Value> value)
  {
     return INumberFormatter::Unwrap<INumberFormatter>(value.As<Object>())->_instance;
  }

  void InitINumberFormatter(Handle<Object> exports)
  {
    INumberFormatter::Init(exports);
  }

  class INumberFormatter2 : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("INumberFormatter2"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatInt"), FunctionTemplate::New(FormatInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatUInt"), FunctionTemplate::New(FormatUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatDouble"), FunctionTemplate::New(FormatDouble)->GetFunction());
      
                        
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("INumberFormatter2"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    INumberFormatter2(::Windows::Globalization::NumberFormatting::INumberFormatter2^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::INumberFormatter2^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatter2^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::INumberFormatter2^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      INumberFormatter2 *wrapperInstance = new INumberFormatter2(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> FormatInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatter2^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatter2 *wrapper = INumberFormatter2::Unwrap<INumberFormatter2>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatter2^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatter2 *wrapper = INumberFormatter2::Unwrap<INumberFormatter2>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->FormatUInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatter2^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatter2 *wrapper = INumberFormatter2::Unwrap<INumberFormatter2>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatDouble(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }





  private:
    ::Windows::Globalization::NumberFormatting::INumberFormatter2^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapINumberFormatter2(::Windows::Globalization::NumberFormatting::INumberFormatter2^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::INumberFormatter2^ UnwrapINumberFormatter2(Handle<Value> value);
    friend bool IsINumberFormatter2Wrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> INumberFormatter2::s_constructorTemplate;

  v8::Handle<v8::Value> WrapINumberFormatter2(::Windows::Globalization::NumberFormatting::INumberFormatter2^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(INumberFormatter2::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::INumberFormatter2^ UnwrapINumberFormatter2(Handle<Value> value)
  {
     return INumberFormatter2::Unwrap<INumberFormatter2>(value.As<Object>())->_instance;
  }

  void InitINumberFormatter2(Handle<Object> exports)
  {
    INumberFormatter2::Init(exports);
  }

  class INumberParser : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("INumberParser"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseInt"), FunctionTemplate::New(ParseInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseUInt"), FunctionTemplate::New(ParseUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseDouble"), FunctionTemplate::New(ParseDouble)->GetFunction());
      
                        
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("INumberParser"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    INumberParser(::Windows::Globalization::NumberFormatting::INumberParser^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::INumberParser^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberParser^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::INumberParser^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      INumberParser *wrapperInstance = new INumberParser(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> ParseInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberParser^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberParser *wrapper = INumberParser::Unwrap<INumberParser>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<__int64>^ result;
          result = wrapper->_instance->ParseInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberParser^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberParser *wrapper = INumberParser::Unwrap<INumberParser>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<unsigned __int64>^ result;
          result = wrapper->_instance->ParseUInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberParser^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      INumberParser *wrapper = INumberParser::Unwrap<INumberParser>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<double>^ result;
          result = wrapper->_instance->ParseDouble(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }





  private:
    ::Windows::Globalization::NumberFormatting::INumberParser^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapINumberParser(::Windows::Globalization::NumberFormatting::INumberParser^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::INumberParser^ UnwrapINumberParser(Handle<Value> value);
    friend bool IsINumberParserWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> INumberParser::s_constructorTemplate;

  v8::Handle<v8::Value> WrapINumberParser(::Windows::Globalization::NumberFormatting::INumberParser^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(INumberParser::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::INumberParser^ UnwrapINumberParser(Handle<Value> value)
  {
     return INumberParser::Unwrap<INumberParser>(value.As<Object>())->_instance;
  }

  void InitINumberParser(Handle<Object> exports)
  {
    INumberParser::Init(exports);
  }

  class INumberFormatterOptions : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("INumberFormatterOptions"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
                              
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("fractionDigits"), FractionDigitsGetter, FractionDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("geographicRegion"), GeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("integerDigits"), IntegerDigitsGetter, IntegerDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isDecimalPointAlwaysDisplayed"), IsDecimalPointAlwaysDisplayedGetter, IsDecimalPointAlwaysDisplayedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isGrouped"), IsGroupedGetter, IsGroupedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("languages"), LanguagesGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numeralSystem"), NumeralSystemGetter, NumeralSystemSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedGeographicRegion"), ResolvedGeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedLanguage"), ResolvedLanguageGetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("INumberFormatterOptions"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    INumberFormatterOptions(::Windows::Globalization::NumberFormatting::INumberFormatterOptions^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::INumberFormatterOptions^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::INumberFormatterOptions^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      INumberFormatterOptions *wrapperInstance = new INumberFormatterOptions(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  



    static Handle<Value> FractionDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        int result = wrapper->_instance->FractionDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void FractionDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return;
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->FractionDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> GeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->GeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> IntegerDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        int result = wrapper->_instance->IntegerDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IntegerDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return;
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->IntegerDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsDecimalPointAlwaysDisplayedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsDecimalPointAlwaysDisplayed;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsDecimalPointAlwaysDisplayedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return;
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsDecimalPointAlwaysDisplayed = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsGroupedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsGrouped;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsGroupedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return;
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsGrouped = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> LanguagesGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        ::Windows::Foundation::Collections::IVectorView<::Platform::String^>^ result = wrapper->_instance->Languages;
        return scope.Close(NodeRT::Collections::VectorViewWrapper<::Platform::String^>::CreateVectorViewWrapper(result, 
            [](::Platform::String^ val) -> Handle<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Handle<Value> value) -> bool {
              return value->IsString();
            },
            [](Handle<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
            }
          ));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> NumeralSystemGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->NumeralSystem;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumeralSystemSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsString())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return;
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        
        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));

        wrapper->_instance->NumeralSystem = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> ResolvedGeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedGeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedLanguageGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberFormatterOptions^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberFormatterOptions *wrapper = INumberFormatterOptions::Unwrap<INumberFormatterOptions>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedLanguage;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::INumberFormatterOptions^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapINumberFormatterOptions(::Windows::Globalization::NumberFormatting::INumberFormatterOptions^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::INumberFormatterOptions^ UnwrapINumberFormatterOptions(Handle<Value> value);
    friend bool IsINumberFormatterOptionsWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> INumberFormatterOptions::s_constructorTemplate;

  v8::Handle<v8::Value> WrapINumberFormatterOptions(::Windows::Globalization::NumberFormatting::INumberFormatterOptions^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(INumberFormatterOptions::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::INumberFormatterOptions^ UnwrapINumberFormatterOptions(Handle<Value> value)
  {
     return INumberFormatterOptions::Unwrap<INumberFormatterOptions>(value.As<Object>())->_instance;
  }

  void InitINumberFormatterOptions(Handle<Object> exports)
  {
    INumberFormatterOptions::Init(exports);
  }

  class ISignificantDigitsOption : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("ISignificantDigitsOption"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
                              
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("significantDigits"), SignificantDigitsGetter, SignificantDigitsSetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("ISignificantDigitsOption"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    ISignificantDigitsOption(::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      ISignificantDigitsOption *wrapperInstance = new ISignificantDigitsOption(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  



    static Handle<Value> SignificantDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      ISignificantDigitsOption *wrapper = ISignificantDigitsOption::Unwrap<ISignificantDigitsOption>(info.This());

      try 
      {
        int result = wrapper->_instance->SignificantDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void SignificantDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^>(info.This()))
      {
        return;
      }

      ISignificantDigitsOption *wrapper = ISignificantDigitsOption::Unwrap<ISignificantDigitsOption>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->SignificantDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapISignificantDigitsOption(::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^ UnwrapISignificantDigitsOption(Handle<Value> value);
    friend bool IsISignificantDigitsOptionWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> ISignificantDigitsOption::s_constructorTemplate;

  v8::Handle<v8::Value> WrapISignificantDigitsOption(::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(ISignificantDigitsOption::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::ISignificantDigitsOption^ UnwrapISignificantDigitsOption(Handle<Value> value)
  {
     return ISignificantDigitsOption::Unwrap<ISignificantDigitsOption>(value.As<Object>())->_instance;
  }

  void InitISignificantDigitsOption(Handle<Object> exports)
  {
    ISignificantDigitsOption::Init(exports);
  }

  class INumberRounderOption : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("INumberRounderOption"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
                              
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numberRounder"), NumberRounderGetter, NumberRounderSetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("INumberRounderOption"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    INumberRounderOption(::Windows::Globalization::NumberFormatting::INumberRounderOption^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::INumberRounderOption^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounderOption^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::INumberRounderOption^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      INumberRounderOption *wrapperInstance = new INumberRounderOption(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  



    static Handle<Value> NumberRounderGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounderOption^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      INumberRounderOption *wrapper = INumberRounderOption::Unwrap<INumberRounderOption>(info.This());

      try 
      {
        ::Windows::Globalization::NumberFormatting::INumberRounder^ result = wrapper->_instance->NumberRounder;
        return scope.Close(WrapINumberRounder(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumberRounderSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(value))
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounderOption^>(info.This()))
      {
        return;
      }

      INumberRounderOption *wrapper = INumberRounderOption::Unwrap<INumberRounderOption>(info.This());

      try 
      {
        
        ::Windows::Globalization::NumberFormatting::INumberRounder^ winRtValue = dynamic_cast<::Windows::Globalization::NumberFormatting::INumberRounder^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->NumberRounder = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::INumberRounderOption^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapINumberRounderOption(::Windows::Globalization::NumberFormatting::INumberRounderOption^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::INumberRounderOption^ UnwrapINumberRounderOption(Handle<Value> value);
    friend bool IsINumberRounderOptionWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> INumberRounderOption::s_constructorTemplate;

  v8::Handle<v8::Value> WrapINumberRounderOption(::Windows::Globalization::NumberFormatting::INumberRounderOption^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(INumberRounderOption::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::INumberRounderOption^ UnwrapINumberRounderOption(Handle<Value> value)
  {
     return INumberRounderOption::Unwrap<INumberRounderOption>(value.As<Object>())->_instance;
  }

  void InitINumberRounderOption(Handle<Object> exports)
  {
    INumberRounderOption::Init(exports);
  }

  class ISignedZeroOption : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("ISignedZeroOption"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
                              
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isZeroSigned"), IsZeroSignedGetter, IsZeroSignedSetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("ISignedZeroOption"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    ISignedZeroOption(::Windows::Globalization::NumberFormatting::ISignedZeroOption^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::ISignedZeroOption^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::ISignedZeroOption^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::ISignedZeroOption^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      ISignedZeroOption *wrapperInstance = new ISignedZeroOption(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  



    static Handle<Value> IsZeroSignedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::ISignedZeroOption^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      ISignedZeroOption *wrapper = ISignedZeroOption::Unwrap<ISignedZeroOption>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsZeroSigned;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsZeroSignedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::ISignedZeroOption^>(info.This()))
      {
        return;
      }

      ISignedZeroOption *wrapper = ISignedZeroOption::Unwrap<ISignedZeroOption>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsZeroSigned = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::ISignedZeroOption^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapISignedZeroOption(::Windows::Globalization::NumberFormatting::ISignedZeroOption^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::ISignedZeroOption^ UnwrapISignedZeroOption(Handle<Value> value);
    friend bool IsISignedZeroOptionWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> ISignedZeroOption::s_constructorTemplate;

  v8::Handle<v8::Value> WrapISignedZeroOption(::Windows::Globalization::NumberFormatting::ISignedZeroOption^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(ISignedZeroOption::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::ISignedZeroOption^ UnwrapISignedZeroOption(Handle<Value> value)
  {
     return ISignedZeroOption::Unwrap<ISignedZeroOption>(value.As<Object>())->_instance;
  }

  void InitISignedZeroOption(Handle<Object> exports)
  {
    ISignedZeroOption::Init(exports);
  }

  class DecimalFormatter : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("DecimalFormatter"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("format"), FunctionTemplate::New(Format)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatInt"), FunctionTemplate::New(FormatInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatUInt"), FunctionTemplate::New(FormatUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatDouble"), FunctionTemplate::New(FormatDouble)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseInt"), FunctionTemplate::New(ParseInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseUInt"), FunctionTemplate::New(ParseUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseDouble"), FunctionTemplate::New(ParseDouble)->GetFunction());
      
                        
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numeralSystem"), NumeralSystemGetter, NumeralSystemSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isGrouped"), IsGroupedGetter, IsGroupedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isDecimalPointAlwaysDisplayed"), IsDecimalPointAlwaysDisplayedGetter, IsDecimalPointAlwaysDisplayedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("integerDigits"), IntegerDigitsGetter, IntegerDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("fractionDigits"), FractionDigitsGetter, FractionDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("geographicRegion"), GeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("languages"), LanguagesGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedGeographicRegion"), ResolvedGeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedLanguage"), ResolvedLanguageGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("significantDigits"), SignificantDigitsGetter, SignificantDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numberRounder"), NumberRounderGetter, NumberRounderSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isZeroSigned"), IsZeroSignedGetter, IsZeroSignedSetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("DecimalFormatter"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    DecimalFormatter(::Windows::Globalization::NumberFormatting::DecimalFormatter^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::DecimalFormatter^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::DecimalFormatter^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 2
        && (NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(args[0]) || args[0]->IsArray())
        && args[1]->IsString())
      {
        try
        {
          ::Windows::Foundation::Collections::IIterable<::Platform::String^>^ arg0 = 
            [] (v8::Handle<v8::Value> value) -> ::Windows::Foundation::Collections::IIterable<::Platform::String^>^
            {
              if (value->IsArray())
              {
                return NodeRT::Collections::JsArrayToWinrtVector<::Platform::String^>(value.As<Array>(), 
                 [](Handle<Value> value) -> bool {
                   return (!NodeRT::Utils::IsWinRtWrapper(value));
                 },
                 [](Handle<Value> value) -> ::Platform::String^ {
                   return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
                 }
                );
              }
              else
              {
                return dynamic_cast<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(NodeRT::Utils::GetObjectInstance(value));
              }
            } (args[0]);
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[1])));
          
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::DecimalFormatter(arg0,arg1);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 0)
      {
        try
        {
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::DecimalFormatter();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      DecimalFormatter *wrapperInstance = new DecimalFormatter(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> Format(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->FormatUInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatDouble(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<__int64>^ result;
          result = wrapper->_instance->ParseInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<unsigned __int64>^ result;
          result = wrapper->_instance->ParseUInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<double>^ result;
          result = wrapper->_instance->ParseDouble(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }



    static Handle<Value> NumeralSystemGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->NumeralSystem;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumeralSystemSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsString())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return;
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        
        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));

        wrapper->_instance->NumeralSystem = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsGroupedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsGrouped;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsGroupedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return;
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsGrouped = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsDecimalPointAlwaysDisplayedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsDecimalPointAlwaysDisplayed;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsDecimalPointAlwaysDisplayedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return;
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsDecimalPointAlwaysDisplayed = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IntegerDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->IntegerDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IntegerDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return;
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->IntegerDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> FractionDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->FractionDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void FractionDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return;
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->FractionDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> GeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->GeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> LanguagesGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        ::Windows::Foundation::Collections::IVectorView<::Platform::String^>^ result = wrapper->_instance->Languages;
        return scope.Close(NodeRT::Collections::VectorViewWrapper<::Platform::String^>::CreateVectorViewWrapper(result, 
            [](::Platform::String^ val) -> Handle<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Handle<Value> value) -> bool {
              return value->IsString();
            },
            [](Handle<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
            }
          ));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedGeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedGeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedLanguageGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedLanguage;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> SignificantDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->SignificantDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void SignificantDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return;
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->SignificantDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> NumberRounderGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        ::Windows::Globalization::NumberFormatting::INumberRounder^ result = wrapper->_instance->NumberRounder;
        return scope.Close(WrapINumberRounder(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumberRounderSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(value))
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return;
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        
        ::Windows::Globalization::NumberFormatting::INumberRounder^ winRtValue = dynamic_cast<::Windows::Globalization::NumberFormatting::INumberRounder^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->NumberRounder = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsZeroSignedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsZeroSigned;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsZeroSignedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::DecimalFormatter^>(info.This()))
      {
        return;
      }

      DecimalFormatter *wrapper = DecimalFormatter::Unwrap<DecimalFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsZeroSigned = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::DecimalFormatter^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapDecimalFormatter(::Windows::Globalization::NumberFormatting::DecimalFormatter^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::DecimalFormatter^ UnwrapDecimalFormatter(Handle<Value> value);
    friend bool IsDecimalFormatterWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> DecimalFormatter::s_constructorTemplate;

  v8::Handle<v8::Value> WrapDecimalFormatter(::Windows::Globalization::NumberFormatting::DecimalFormatter^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(DecimalFormatter::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::DecimalFormatter^ UnwrapDecimalFormatter(Handle<Value> value)
  {
     return DecimalFormatter::Unwrap<DecimalFormatter>(value.As<Object>())->_instance;
  }

  void InitDecimalFormatter(Handle<Object> exports)
  {
    DecimalFormatter::Init(exports);
  }

  class PercentFormatter : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("PercentFormatter"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("format"), FunctionTemplate::New(Format)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatInt"), FunctionTemplate::New(FormatInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatUInt"), FunctionTemplate::New(FormatUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatDouble"), FunctionTemplate::New(FormatDouble)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseInt"), FunctionTemplate::New(ParseInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseUInt"), FunctionTemplate::New(ParseUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseDouble"), FunctionTemplate::New(ParseDouble)->GetFunction());
      
                        
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numeralSystem"), NumeralSystemGetter, NumeralSystemSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isGrouped"), IsGroupedGetter, IsGroupedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isDecimalPointAlwaysDisplayed"), IsDecimalPointAlwaysDisplayedGetter, IsDecimalPointAlwaysDisplayedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("integerDigits"), IntegerDigitsGetter, IntegerDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("fractionDigits"), FractionDigitsGetter, FractionDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("geographicRegion"), GeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("languages"), LanguagesGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedGeographicRegion"), ResolvedGeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedLanguage"), ResolvedLanguageGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("significantDigits"), SignificantDigitsGetter, SignificantDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numberRounder"), NumberRounderGetter, NumberRounderSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isZeroSigned"), IsZeroSignedGetter, IsZeroSignedSetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("PercentFormatter"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    PercentFormatter(::Windows::Globalization::NumberFormatting::PercentFormatter^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::PercentFormatter^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::PercentFormatter^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 2
        && (NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(args[0]) || args[0]->IsArray())
        && args[1]->IsString())
      {
        try
        {
          ::Windows::Foundation::Collections::IIterable<::Platform::String^>^ arg0 = 
            [] (v8::Handle<v8::Value> value) -> ::Windows::Foundation::Collections::IIterable<::Platform::String^>^
            {
              if (value->IsArray())
              {
                return NodeRT::Collections::JsArrayToWinrtVector<::Platform::String^>(value.As<Array>(), 
                 [](Handle<Value> value) -> bool {
                   return (!NodeRT::Utils::IsWinRtWrapper(value));
                 },
                 [](Handle<Value> value) -> ::Platform::String^ {
                   return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
                 }
                );
              }
              else
              {
                return dynamic_cast<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(NodeRT::Utils::GetObjectInstance(value));
              }
            } (args[0]);
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[1])));
          
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::PercentFormatter(arg0,arg1);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 0)
      {
        try
        {
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::PercentFormatter();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      PercentFormatter *wrapperInstance = new PercentFormatter(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> Format(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->FormatUInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatDouble(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<__int64>^ result;
          result = wrapper->_instance->ParseInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<unsigned __int64>^ result;
          result = wrapper->_instance->ParseUInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<double>^ result;
          result = wrapper->_instance->ParseDouble(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }



    static Handle<Value> NumeralSystemGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->NumeralSystem;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumeralSystemSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsString())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return;
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        
        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));

        wrapper->_instance->NumeralSystem = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsGroupedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsGrouped;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsGroupedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return;
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsGrouped = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsDecimalPointAlwaysDisplayedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsDecimalPointAlwaysDisplayed;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsDecimalPointAlwaysDisplayedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return;
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsDecimalPointAlwaysDisplayed = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IntegerDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->IntegerDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IntegerDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return;
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->IntegerDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> FractionDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->FractionDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void FractionDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return;
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->FractionDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> GeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->GeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> LanguagesGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        ::Windows::Foundation::Collections::IVectorView<::Platform::String^>^ result = wrapper->_instance->Languages;
        return scope.Close(NodeRT::Collections::VectorViewWrapper<::Platform::String^>::CreateVectorViewWrapper(result, 
            [](::Platform::String^ val) -> Handle<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Handle<Value> value) -> bool {
              return value->IsString();
            },
            [](Handle<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
            }
          ));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedGeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedGeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedLanguageGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedLanguage;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> SignificantDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->SignificantDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void SignificantDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return;
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->SignificantDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> NumberRounderGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        ::Windows::Globalization::NumberFormatting::INumberRounder^ result = wrapper->_instance->NumberRounder;
        return scope.Close(WrapINumberRounder(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumberRounderSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(value))
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return;
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        
        ::Windows::Globalization::NumberFormatting::INumberRounder^ winRtValue = dynamic_cast<::Windows::Globalization::NumberFormatting::INumberRounder^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->NumberRounder = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsZeroSignedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsZeroSigned;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsZeroSignedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PercentFormatter^>(info.This()))
      {
        return;
      }

      PercentFormatter *wrapper = PercentFormatter::Unwrap<PercentFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsZeroSigned = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::PercentFormatter^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapPercentFormatter(::Windows::Globalization::NumberFormatting::PercentFormatter^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::PercentFormatter^ UnwrapPercentFormatter(Handle<Value> value);
    friend bool IsPercentFormatterWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> PercentFormatter::s_constructorTemplate;

  v8::Handle<v8::Value> WrapPercentFormatter(::Windows::Globalization::NumberFormatting::PercentFormatter^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(PercentFormatter::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::PercentFormatter^ UnwrapPercentFormatter(Handle<Value> value)
  {
     return PercentFormatter::Unwrap<PercentFormatter>(value.As<Object>())->_instance;
  }

  void InitPercentFormatter(Handle<Object> exports)
  {
    PercentFormatter::Init(exports);
  }

  class PermilleFormatter : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("PermilleFormatter"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("format"), FunctionTemplate::New(Format)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatInt"), FunctionTemplate::New(FormatInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatUInt"), FunctionTemplate::New(FormatUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatDouble"), FunctionTemplate::New(FormatDouble)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseInt"), FunctionTemplate::New(ParseInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseUInt"), FunctionTemplate::New(ParseUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseDouble"), FunctionTemplate::New(ParseDouble)->GetFunction());
      
                        
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numeralSystem"), NumeralSystemGetter, NumeralSystemSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isGrouped"), IsGroupedGetter, IsGroupedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isDecimalPointAlwaysDisplayed"), IsDecimalPointAlwaysDisplayedGetter, IsDecimalPointAlwaysDisplayedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("integerDigits"), IntegerDigitsGetter, IntegerDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("fractionDigits"), FractionDigitsGetter, FractionDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("geographicRegion"), GeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("languages"), LanguagesGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedGeographicRegion"), ResolvedGeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedLanguage"), ResolvedLanguageGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("significantDigits"), SignificantDigitsGetter, SignificantDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numberRounder"), NumberRounderGetter, NumberRounderSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isZeroSigned"), IsZeroSignedGetter, IsZeroSignedSetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("PermilleFormatter"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    PermilleFormatter(::Windows::Globalization::NumberFormatting::PermilleFormatter^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::PermilleFormatter^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::PermilleFormatter^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 2
        && (NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(args[0]) || args[0]->IsArray())
        && args[1]->IsString())
      {
        try
        {
          ::Windows::Foundation::Collections::IIterable<::Platform::String^>^ arg0 = 
            [] (v8::Handle<v8::Value> value) -> ::Windows::Foundation::Collections::IIterable<::Platform::String^>^
            {
              if (value->IsArray())
              {
                return NodeRT::Collections::JsArrayToWinrtVector<::Platform::String^>(value.As<Array>(), 
                 [](Handle<Value> value) -> bool {
                   return (!NodeRT::Utils::IsWinRtWrapper(value));
                 },
                 [](Handle<Value> value) -> ::Platform::String^ {
                   return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
                 }
                );
              }
              else
              {
                return dynamic_cast<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(NodeRT::Utils::GetObjectInstance(value));
              }
            } (args[0]);
          Platform::String^ arg1 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[1])));
          
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::PermilleFormatter(arg0,arg1);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 0)
      {
        try
        {
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::PermilleFormatter();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      PermilleFormatter *wrapperInstance = new PermilleFormatter(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> Format(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->FormatUInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatDouble(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<__int64>^ result;
          result = wrapper->_instance->ParseInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<unsigned __int64>^ result;
          result = wrapper->_instance->ParseUInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<double>^ result;
          result = wrapper->_instance->ParseDouble(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }



    static Handle<Value> NumeralSystemGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->NumeralSystem;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumeralSystemSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsString())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return;
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        
        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));

        wrapper->_instance->NumeralSystem = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsGroupedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsGrouped;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsGroupedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return;
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsGrouped = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsDecimalPointAlwaysDisplayedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsDecimalPointAlwaysDisplayed;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsDecimalPointAlwaysDisplayedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return;
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsDecimalPointAlwaysDisplayed = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IntegerDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->IntegerDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IntegerDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return;
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->IntegerDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> FractionDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->FractionDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void FractionDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return;
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->FractionDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> GeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->GeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> LanguagesGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        ::Windows::Foundation::Collections::IVectorView<::Platform::String^>^ result = wrapper->_instance->Languages;
        return scope.Close(NodeRT::Collections::VectorViewWrapper<::Platform::String^>::CreateVectorViewWrapper(result, 
            [](::Platform::String^ val) -> Handle<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Handle<Value> value) -> bool {
              return value->IsString();
            },
            [](Handle<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
            }
          ));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedGeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedGeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedLanguageGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedLanguage;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> SignificantDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->SignificantDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void SignificantDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return;
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->SignificantDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> NumberRounderGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        ::Windows::Globalization::NumberFormatting::INumberRounder^ result = wrapper->_instance->NumberRounder;
        return scope.Close(WrapINumberRounder(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumberRounderSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(value))
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return;
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        
        ::Windows::Globalization::NumberFormatting::INumberRounder^ winRtValue = dynamic_cast<::Windows::Globalization::NumberFormatting::INumberRounder^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->NumberRounder = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsZeroSignedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsZeroSigned;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsZeroSignedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::PermilleFormatter^>(info.This()))
      {
        return;
      }

      PermilleFormatter *wrapper = PermilleFormatter::Unwrap<PermilleFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsZeroSigned = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::PermilleFormatter^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapPermilleFormatter(::Windows::Globalization::NumberFormatting::PermilleFormatter^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::PermilleFormatter^ UnwrapPermilleFormatter(Handle<Value> value);
    friend bool IsPermilleFormatterWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> PermilleFormatter::s_constructorTemplate;

  v8::Handle<v8::Value> WrapPermilleFormatter(::Windows::Globalization::NumberFormatting::PermilleFormatter^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(PermilleFormatter::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::PermilleFormatter^ UnwrapPermilleFormatter(Handle<Value> value)
  {
     return PermilleFormatter::Unwrap<PermilleFormatter>(value.As<Object>())->_instance;
  }

  void InitPermilleFormatter(Handle<Object> exports)
  {
    PermilleFormatter::Init(exports);
  }

  class CurrencyFormatter : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("CurrencyFormatter"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("format"), FunctionTemplate::New(Format)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatInt"), FunctionTemplate::New(FormatInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatUInt"), FunctionTemplate::New(FormatUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("formatDouble"), FunctionTemplate::New(FormatDouble)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseInt"), FunctionTemplate::New(ParseInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseUInt"), FunctionTemplate::New(ParseUInt)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("parseDouble"), FunctionTemplate::New(ParseDouble)->GetFunction());
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("applyRoundingForCurrency"), FunctionTemplate::New(ApplyRoundingForCurrency)->GetFunction());
      
                        
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("currency"), CurrencyGetter, CurrencySetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numeralSystem"), NumeralSystemGetter, NumeralSystemSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isGrouped"), IsGroupedGetter, IsGroupedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isDecimalPointAlwaysDisplayed"), IsDecimalPointAlwaysDisplayedGetter, IsDecimalPointAlwaysDisplayedSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("integerDigits"), IntegerDigitsGetter, IntegerDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("fractionDigits"), FractionDigitsGetter, FractionDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("geographicRegion"), GeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("languages"), LanguagesGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedGeographicRegion"), ResolvedGeographicRegionGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedLanguage"), ResolvedLanguageGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("mode"), ModeGetter, ModeSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("significantDigits"), SignificantDigitsGetter, SignificantDigitsSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numberRounder"), NumberRounderGetter, NumberRounderSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("isZeroSigned"), IsZeroSignedGetter, IsZeroSignedSetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("CurrencyFormatter"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    CurrencyFormatter(::Windows::Globalization::NumberFormatting::CurrencyFormatter^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::CurrencyFormatter^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::CurrencyFormatter^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::CurrencyFormatter(arg0);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 3
        && args[0]->IsString()
        && (NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(args[1]) || args[1]->IsArray())
        && args[2]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          ::Windows::Foundation::Collections::IIterable<::Platform::String^>^ arg1 = 
            [] (v8::Handle<v8::Value> value) -> ::Windows::Foundation::Collections::IIterable<::Platform::String^>^
            {
              if (value->IsArray())
              {
                return NodeRT::Collections::JsArrayToWinrtVector<::Platform::String^>(value.As<Array>(), 
                 [](Handle<Value> value) -> bool {
                   return (!NodeRT::Utils::IsWinRtWrapper(value));
                 },
                 [](Handle<Value> value) -> ::Platform::String^ {
                   return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
                 }
                );
              }
              else
              {
                return dynamic_cast<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(NodeRT::Utils::GetObjectInstance(value));
              }
            } (args[1]);
          Platform::String^ arg2 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[2])));
          
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::CurrencyFormatter(arg0,arg1,arg2);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      CurrencyFormatter *wrapperInstance = new CurrencyFormatter(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> Format(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->Format(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          __int64 arg0 = args[0]->IntegerValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          unsigned __int64 arg0 = static_cast<unsigned __int64>(args[0]->IntegerValue());
          
          Platform::String^ result;
          result = wrapper->_instance->FormatUInt(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> FormatDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsNumber())
      {
        try
        {
          double arg0 = args[0]->NumberValue();
          
          Platform::String^ result;
          result = wrapper->_instance->FormatDouble(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<__int64>^ result;
          result = wrapper->_instance->ParseInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseUInt(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<unsigned __int64>^ result;
          result = wrapper->_instance->ParseUInt(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ParseDouble(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          ::Platform::IBox<double>^ result;
          result = wrapper->_instance->ParseDouble(arg0);
          return scope.Close(result ? Number::New(static_cast<double>(result->Value)): static_cast<Handle<Value>>(Undefined()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }
    static Handle<Value> ApplyRoundingForCurrency(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(args.This());

      if (args.Length() == 1
        && args[0]->IsInt32())
      {
        try
        {
          ::Windows::Globalization::NumberFormatting::RoundingAlgorithm arg0 = static_cast<::Windows::Globalization::NumberFormatting::RoundingAlgorithm>(args[0]->Int32Value());
          
          wrapper->_instance->ApplyRoundingForCurrency(arg0);
          return scope.Close(Undefined());   
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }



    static Handle<Value> CurrencyGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->Currency;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void CurrencySetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsString())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));

        wrapper->_instance->Currency = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> NumeralSystemGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->NumeralSystem;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumeralSystemSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsString())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));

        wrapper->_instance->NumeralSystem = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsGroupedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsGrouped;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsGroupedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsGrouped = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsDecimalPointAlwaysDisplayedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsDecimalPointAlwaysDisplayed;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsDecimalPointAlwaysDisplayedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsDecimalPointAlwaysDisplayed = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IntegerDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->IntegerDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IntegerDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->IntegerDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> FractionDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->FractionDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void FractionDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->FractionDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> GeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->GeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> LanguagesGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        ::Windows::Foundation::Collections::IVectorView<::Platform::String^>^ result = wrapper->_instance->Languages;
        return scope.Close(NodeRT::Collections::VectorViewWrapper<::Platform::String^>::CreateVectorViewWrapper(result, 
            [](::Platform::String^ val) -> Handle<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Handle<Value> value) -> bool {
              return value->IsString();
            },
            [](Handle<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
            }
          ));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedGeographicRegionGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedGeographicRegion;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedLanguageGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedLanguage;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ModeGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        ::Windows::Globalization::NumberFormatting::CurrencyFormatterMode result = wrapper->_instance->Mode;
        return scope.Close(Integer::New(static_cast<int>(result)));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void ModeSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        ::Windows::Globalization::NumberFormatting::CurrencyFormatterMode winRtValue = static_cast<::Windows::Globalization::NumberFormatting::CurrencyFormatterMode>(value->Int32Value());

        wrapper->_instance->Mode = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> SignificantDigitsGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        int result = wrapper->_instance->SignificantDigits;
        return scope.Close(Integer::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void SignificantDigitsSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsInt32())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        int winRtValue = static_cast<int>(value->Int32Value());

        wrapper->_instance->SignificantDigits = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> NumberRounderGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        ::Windows::Globalization::NumberFormatting::INumberRounder^ result = wrapper->_instance->NumberRounder;
        return scope.Close(WrapINumberRounder(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumberRounderSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::INumberRounder^>(value))
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        ::Windows::Globalization::NumberFormatting::INumberRounder^ winRtValue = dynamic_cast<::Windows::Globalization::NumberFormatting::INumberRounder^>(NodeRT::Utils::GetObjectInstance(value));

        wrapper->_instance->NumberRounder = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> IsZeroSignedGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        bool result = wrapper->_instance->IsZeroSigned;
        return scope.Close(Boolean::New(result));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void IsZeroSignedSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsBoolean())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::CurrencyFormatter^>(info.This()))
      {
        return;
      }

      CurrencyFormatter *wrapper = CurrencyFormatter::Unwrap<CurrencyFormatter>(info.This());

      try 
      {
        
        bool winRtValue = value->BooleanValue();

        wrapper->_instance->IsZeroSigned = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::CurrencyFormatter^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapCurrencyFormatter(::Windows::Globalization::NumberFormatting::CurrencyFormatter^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::CurrencyFormatter^ UnwrapCurrencyFormatter(Handle<Value> value);
    friend bool IsCurrencyFormatterWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> CurrencyFormatter::s_constructorTemplate;

  v8::Handle<v8::Value> WrapCurrencyFormatter(::Windows::Globalization::NumberFormatting::CurrencyFormatter^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(CurrencyFormatter::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::CurrencyFormatter^ UnwrapCurrencyFormatter(Handle<Value> value)
  {
     return CurrencyFormatter::Unwrap<CurrencyFormatter>(value.As<Object>())->_instance;
  }

  void InitCurrencyFormatter(Handle<Object> exports)
  {
    CurrencyFormatter::Init(exports);
  }

  class NumeralSystemTranslator : public WrapperBase
  {
  public:    
    static v8::Handle<v8::Value> Init(const Handle<Object> exports)
    {
      HandleScope scope;
      
      s_constructorTemplate = Persistent<FunctionTemplate>::New(FunctionTemplate::New(New));
      s_constructorTemplate->SetClassName(String::NewSymbol("NumeralSystemTranslator"));
      s_constructorTemplate->InstanceTemplate()->SetInternalFieldCount(1);
      
            
      s_constructorTemplate->PrototypeTemplate()->Set(String::NewSymbol("translateNumerals"), FunctionTemplate::New(TranslateNumerals)->GetFunction());
      
                        
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("numeralSystem"), NumeralSystemGetter, NumeralSystemSetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("languages"), LanguagesGetter);
      s_constructorTemplate->PrototypeTemplate()->SetAccessor(String::NewSymbol("resolvedLanguage"), ResolvedLanguageGetter);
      
      Local<Function> constructor = s_constructorTemplate->GetFunction();


      exports->Set(String::NewSymbol("NumeralSystemTranslator"), constructor);
      return scope.Close(Undefined());
    }


    virtual ::Platform::Object^ GetObjectInstance() const override
    {
      return _instance;
    }

  private:
    
    NumeralSystemTranslator(::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^ instance)
    {
      _instance = instance;
    }
    
    
    static v8::Handle<v8::Value> New(const v8::Arguments& args)
    {
      HandleScope scope;

      // in case the constructor was called without the new operator
      if (!s_constructorTemplate->HasInstance(args.This()))
      {
        if (args.Length() > 0)
        {
          std::unique_ptr<Handle<Value> []> constructorArgs(new Handle<Value>[args.Length()]);

          Handle<Value> *argsPtr = constructorArgs.get();
          for (int i = 0; i < args.Length(); i++)
          {
            argsPtr[i] = args[i];
          }

          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), constructorArgs.get());
        }
        else
        {
          return s_constructorTemplate->GetFunction()->CallAsConstructor(args.Length(), nullptr);
        }
      }
      
      ::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^ winRtInstance;


      if (args.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(args[0]) &&
        NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^>(args[0]))
      {
        try 
        {
          winRtInstance = (::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^) NodeRT::Utils::GetObjectInstance(args[0]);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 1
        && (NodeRT::Utils::IsWinRtWrapperOf<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(args[0]) || args[0]->IsArray()))
      {
        try
        {
          ::Windows::Foundation::Collections::IIterable<::Platform::String^>^ arg0 = 
            [] (v8::Handle<v8::Value> value) -> ::Windows::Foundation::Collections::IIterable<::Platform::String^>^
            {
              if (value->IsArray())
              {
                return NodeRT::Collections::JsArrayToWinrtVector<::Platform::String^>(value.As<Array>(), 
                 [](Handle<Value> value) -> bool {
                   return (!NodeRT::Utils::IsWinRtWrapper(value));
                 },
                 [](Handle<Value> value) -> ::Platform::String^ {
                   return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
                 }
                );
              }
              else
              {
                return dynamic_cast<::Windows::Foundation::Collections::IIterable<::Platform::String^>^>(NodeRT::Utils::GetObjectInstance(value));
              }
            } (args[0]);
          
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::NumeralSystemTranslator(arg0);
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else if (args.Length() == 0)
      {
        try
        {
          winRtInstance = ref new ::Windows::Globalization::NumberFormatting::NumeralSystemTranslator();
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
        return scope.Close(Undefined());
      }

      args.This()->SetHiddenValue(String::NewSymbol("__winRtInstance__"), True());

      NumeralSystemTranslator *wrapperInstance = new NumeralSystemTranslator(winRtInstance);
      wrapperInstance->Wrap(args.This());

      return args.This();
    }


  
    static Handle<Value> TranslateNumerals(const v8::Arguments& args)
    {
      HandleScope scope;

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^>(args.This()))
      {
        return scope.Close(Undefined());
      }

      NumeralSystemTranslator *wrapper = NumeralSystemTranslator::Unwrap<NumeralSystemTranslator>(args.This());

      if (args.Length() == 1
        && args[0]->IsString())
      {
        try
        {
          Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(args[0])));
          
          Platform::String^ result;
          result = wrapper->_instance->TranslateNumerals(arg0);
          return scope.Close(NodeRT::Utils::NewString(result->Data()));
        }
        catch (Platform::Exception ^exception)
        {
          NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
          return scope.Close(Undefined());
        }
      }
      else 
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
        return scope.Close(Undefined());
      }

      return scope.Close(Undefined());
    }



    static Handle<Value> NumeralSystemGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      NumeralSystemTranslator *wrapper = NumeralSystemTranslator::Unwrap<NumeralSystemTranslator>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->NumeralSystem;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static void NumeralSystemSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!value->IsString())
      {
        ThrowException(Exception::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
        return;
      }

      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^>(info.This()))
      {
        return;
      }

      NumeralSystemTranslator *wrapper = NumeralSystemTranslator::Unwrap<NumeralSystemTranslator>(info.This());

      try 
      {
        
        Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));

        wrapper->_instance->NumeralSystem = winRtValue;
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
      }
    }
    
    static Handle<Value> LanguagesGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      NumeralSystemTranslator *wrapper = NumeralSystemTranslator::Unwrap<NumeralSystemTranslator>(info.This());

      try 
      {
        ::Windows::Foundation::Collections::IVectorView<::Platform::String^>^ result = wrapper->_instance->Languages;
        return scope.Close(NodeRT::Collections::VectorViewWrapper<::Platform::String^>::CreateVectorViewWrapper(result, 
            [](::Platform::String^ val) -> Handle<Value> {
              return NodeRT::Utils::NewString(val->Data());
            },
            [](Handle<Value> value) -> bool {
              return value->IsString();
            },
            [](Handle<Value> value) -> ::Platform::String^ {
              return ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
            }
          ));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    
    static Handle<Value> ResolvedLanguageGetter(Local<String> property, const AccessorInfo &info)
    {
      HandleScope scope;
      
      if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^>(info.This()))
      {
        return scope.Close(Undefined());
      }

      NumeralSystemTranslator *wrapper = NumeralSystemTranslator::Unwrap<NumeralSystemTranslator>(info.This());

      try 
      {
        Platform::String^ result = wrapper->_instance->ResolvedLanguage;
        return scope.Close(NodeRT::Utils::NewString(result->Data()));
      }
      catch (Platform::Exception ^exception)
      {
        NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
        return scope.Close(Undefined());
      }
    }
    


  private:
    ::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^ _instance;
    static Persistent<FunctionTemplate> s_constructorTemplate;

    friend v8::Handle<v8::Value> WrapNumeralSystemTranslator(::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^ wintRtInstance);
    friend ::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^ UnwrapNumeralSystemTranslator(Handle<Value> value);
    friend bool IsNumeralSystemTranslatorWrapper(Handle<Value> value);
  };
  Persistent<FunctionTemplate> NumeralSystemTranslator::s_constructorTemplate;

  v8::Handle<v8::Value> WrapNumeralSystemTranslator(::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^ winRtInstance)
  {
    HandleScope scope;

    if (winRtInstance == nullptr)
    {
      return scope.Close(Undefined());
    }

    Handle<Object> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
    Handle<Value> args[] = {opaqueWrapper};
    return scope.Close(NumeralSystemTranslator::s_constructorTemplate->GetFunction()->NewInstance(_countof(args), args));
  }

  ::Windows::Globalization::NumberFormatting::NumeralSystemTranslator^ UnwrapNumeralSystemTranslator(Handle<Value> value)
  {
     return NumeralSystemTranslator::Unwrap<NumeralSystemTranslator>(value.As<Object>())->_instance;
  }

  void InitNumeralSystemTranslator(Handle<Object> exports)
  {
    NumeralSystemTranslator::Init(exports);
  }

} } } } 

void init(Handle<Object> exports)
{
  if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
  {
    ThrowException(v8::Exception::Error(NodeRT::Utils::NewString(L"error in CoInitializeEx()")));
    return;
  }
  
  NodeRT::Windows::Globalization::NumberFormatting::InitRoundingAlgorithmEnum(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitCurrencyFormatterModeEnum(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitINumberRounder(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitSignificantDigitsNumberRounder(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitIncrementNumberRounder(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitINumberFormatter(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitINumberFormatter2(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitINumberParser(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitINumberFormatterOptions(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitISignificantDigitsOption(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitINumberRounderOption(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitISignedZeroOption(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitDecimalFormatter(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitPercentFormatter(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitPermilleFormatter(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitCurrencyFormatter(exports);
  NodeRT::Windows::Globalization::NumberFormatting::InitNumeralSystemTranslator(exports);

  NodeRT::Utils::RegisterNameSpace("Windows.Globalization.NumberFormatting", exports);
}


NODE_MODULE(binding, init)