Exemplo n.º 1
0
        public NativeYAJLParser(YAJLAllocationFunctions allocationFunctions)
        {
            AllocationFunctions = allocationFunctions;

            this_callbacks.yajl_null    = yajl_null;
            this_callbacks.yajl_boolean = yajl_boolean;
            this_callbacks.yajl_integer = yajl_integer;
            this_callbacks.yajl_double  = yajl_double;
            this_callbacks.yajl_number  = yajl_number;
            this_callbacks.yajl_string  = yajl_string;

            this_callbacks.yajl_start_map = yajl_start_map;
            this_callbacks.yajl_map_key   = yajl_map_key;
            this_callbacks.yajl_end_map   = yajl_end_map;

            this_callbacks.yajl_start_array = start_array;
            this_callbacks.yajl_end_array   = end_array;

            Initialize();

            gchandle = GCHandle.Alloc(callbacks, GCHandleType.Pinned);
            Handle   = yajl_alloc(gchandle.AddrOfPinnedObject(), (AllocationFunctions == null ? IntPtr.Zero : AllocationFunctions.Handle), IntPtr.Zero);
        }
Exemplo n.º 2
0
        public NativeYAJLParser(YAJLAllocationFunctions allocationFunctions)
        {
            AllocationFunctions = allocationFunctions;

            this_callbacks.yajl_null = yajl_null;
            this_callbacks.yajl_boolean = yajl_boolean;
            this_callbacks.yajl_integer = yajl_integer;
            this_callbacks.yajl_double = yajl_double;
            this_callbacks.yajl_number = yajl_number;
            this_callbacks.yajl_string = yajl_string;

            this_callbacks.yajl_start_map = yajl_start_map;
            this_callbacks.yajl_map_key = yajl_map_key;
            this_callbacks.yajl_end_map = yajl_end_map;

            this_callbacks.yajl_start_array = start_array;
            this_callbacks.yajl_end_array = end_array;

            Initialize();

            gchandle = GCHandle.Alloc(callbacks, GCHandleType.Pinned);
            Handle = yajl_alloc(gchandle.AddrOfPinnedObject(), (AllocationFunctions == null ? IntPtr.Zero : AllocationFunctions.Handle), IntPtr.Zero);
        }