コード例 #1
0
        /// <summary>Get the int8_t value from the current element value</summary>
        /// <param name="parser">The parser</param>
        /// <param name="val">The value will be written to this pointer</param>
        /// <returns>`true` if the current element value could be successfully parsed into int8_t</returns>
        public static bool ATJSONParserGetInt8Value(Foundation.ATJSONParserUnsafe parser, sbyte *val)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;
            var _ret  = _Internal.ATJSONParserGetInt8Value(_arg0, val);

            return(_ret);
        }
コード例 #2
0
        /// <summary>Lock the current level. Use when passing the parser to code which should only have access to the current level, not higher levels. Will prevent progression beyond the end of the current parent</summary>
        /// <param name="parser">The parser</param>
        /// <returns>An integer required to unlock the level</returns>
        public static uint ATJSONParserLockLevel(Foundation.ATJSONParserUnsafe parser)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;
            var _ret  = _Internal.ATJSONParserLockLevel(_arg0);

            return(_ret);
        }
コード例 #3
0
        /// <summary>Determine if the current object key equals a given string</summary>
        /// <param name="parser">The JSON parser</param>
        /// <param name="key">The key to compare with</param>
        /// <returns>`true` if the key is equal</returns>
        public static bool ATJSONParserKeyEquals(Foundation.ATJSONParserUnsafe parser, string key)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;
            var _ret  = _Internal.ATJSONParserKeyEquals(_arg0, key);

            return(_ret);
        }
コード例 #4
0
 public ATJSONParserUnsafe(Foundation.ATJSONParserUnsafe _0)
 {
     _Instance                     = Marshal.AllocHGlobal(sizeof(Foundation.ATJSONParserUnsafe._Internal));
     _ownsNativeInstance           = true;
     NativeToManagedMap[_Instance] = this;
     *((Foundation.ATJSONParserUnsafe._Internal *)_Instance) = *((Foundation.ATJSONParserUnsafe._Internal *)_0._Instance);
 }
コード例 #5
0
        /// <summary>Get bytes from the current element value</summary>
        /// <param name="parser">The parser</param>
        /// <param name="bytes">A pointer to storage</param>
        /// <param name="maxSize">The maximum size that can be stored in bytes</param>
        /// <param name="parsedBytesLength">On return, the number of bytes copied into `bytes` will be stored in this</param>
        /// <returns>`true` if the current element value could be successfully parsed into the bytes buffer</returns>
        public static bool ATJSONParserGetHexBytesValue(Foundation.ATJSONParserUnsafe parser, byte *bytes, ulong maxSize, ref ulong parsedBytesLength)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;

            fixed(ulong *_parsedBytesLength3 = &parsedBytesLength)
            {
                var _arg3 = _parsedBytesLength3;
                var _ret  = _Internal.ATJSONParserGetHexBytesValue(_arg0, bytes, maxSize, _arg3);

                return(_ret);
            }
        }
コード例 #6
0
        /// <summary>Get the long value from the current element value</summary>
        /// <param name="parser">The parser</param>
        /// <param name="val">The value will be written to this pointer</param>
        /// <returns>`true` if the current element value could be successfully parsed into long</returns>
        public static bool ATJSONParserGetLongValue(Foundation.ATJSONParserUnsafe parser, ref long val)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;

            fixed(long *_val1 = &val)
            {
                var _arg1 = _val1;
                var _ret  = _Internal.ATJSONParserGetLongValue(_arg0, _arg1);

                return(_ret);
            }
        }
コード例 #7
0
        /// <summary>Initialize a JSON parser object</summary>
        /// <param name="parser">The object to initialize. Can be `NULL` so the result from `ATJSONParserNew` can be passed directly, in which case it will simply return `NULL`</param>
        /// <param name="jsonString">The JSON string to parse</param>
        /// <param name="jsonStringLength">The length of the JSON string</param>
        /// <returns>The initialized object or `NULL` if initialization failed</returns>
        public static Foundation.ATJSONParserUnsafe ATJSONParserInitWithString(Foundation.ATJSONParserUnsafe parser, string jsonString, ulong jsonStringLength)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;
            var _ret  = _Internal.ATJSONParserInitWithString(_arg0, jsonString, jsonStringLength);

            Foundation.ATJSONParserUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATJSONParserUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATJSONParserUnsafe)Foundation.ATJSONParserUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATJSONParserUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }
コード例 #8
0
        /// <summary>Create a new JSON parser</summary>
        /// <param name="optionalStorage">Optionally, a pointer to a struct or memory where the object can be stored</param>
        /// <returns>A pointer to the new object. `NULL` if allocation could not be completed</returns>
        public static Foundation.ATJSONParserUnsafe ATJSONParserNew(Foundation.ATJSONParserUnsafe optionalStorage)
        {
            var _arg0 = ReferenceEquals(optionalStorage, null) ? IntPtr.Zero : optionalStorage._Instance;
            var _ret  = _Internal.ATJSONParserNew(_arg0);

            Foundation.ATJSONParserUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATJSONParserUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATJSONParserUnsafe)Foundation.ATJSONParserUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATJSONParserUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }
コード例 #9
0
        /// <summary>Unlock the current level to allow progression beyond the current parent and move the parser to the end of the previously locked level. Useful for ensuring that if child code has not traversed all the elements in the locked level, the parent code is not affected</summary>
        /// <param name="parser">The parser</param>
        /// <param name="levelLock">The level lock returned from `ATJSONParserLockLevel`</param>
        public static void ATJSONParserUnlockLevelAndMoveToEnd(Foundation.ATJSONParserUnsafe parser, uint levelLock)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;

            _Internal.ATJSONParserUnlockLevelAndMoveToEnd(_arg0, levelLock);
        }
コード例 #10
0
        /// <summary>Go to the end of the current object or array. The next call to `ATJSONParserNextElement` will move to the next element in the parent</summary>
        /// <param name="parser">The parser</param>
        public static void ATJSONParserGoToObjectOrArrayEnd(Foundation.ATJSONParserUnsafe parser)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;

            _Internal.ATJSONParserGoToObjectOrArrayEnd(_arg0);
        }
コード例 #11
0
        /// <summary>Move the parser to the next element</summary>
        /// <param name="parser">The parser</param>
        public static void ATJSONParserNextElement(Foundation.ATJSONParserUnsafe parser)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;

            _Internal.ATJSONParserNextElement(_arg0);
        }
コード例 #12
0
        /// <summary>Push the current key path to the last json parse error. Call if an error has occurred parsing.</summary>
        /// <param name="parser">The parser</param>
        public static void ATJSONParserPushKeysToError(Foundation.ATJSONParserUnsafe parser)
        {
            var _arg0 = ReferenceEquals(parser, null) ? IntPtr.Zero : parser._Instance;

            _Internal.ATJSONParserPushKeysToError(_arg0);
        }