public override bool beginArray(ulong size, Common.StringView name)
        {
            JsonValue val = new JsonValue(JsonValue.ARRAY);
            JsonValue res = chain[chain.Count - 1].insert.functorMethod((string)name, val);

            chain.Add(res);
            return(true);
        }
Exemple #2
0
        public static override bool functorMethod(ref string value, Common.StringView name)
        {
            var ptr = getValue.functorMethod(new Common.StringView(name));

            if (ptr == null)
            {
                return(false);
            }
            value = ptr.getString();
            return(true);
        }
Exemple #3
0
        public override bool Binary(object value, ulong size, Common.StringView name)
        {
            var ptr = getValue.functorMethod(new Common.StringView(name));

            if (ptr == null)
            {
                return(false);
            }

            Common.fromHex(ptr.getString(), value, size);
            return(true);
        }
        public static bool serialize <T>(T value, Common.StringView name, ISerializer serializer)
        {
            if (!serializer.BeginObject(new Common.StringView(name)))
            {
                return(false);
            }

            //TODO: Do something with this
            //serialize(value, serializer.FunctorMethod);
            serializer.EndObject();
            return(true);
        }
Exemple #5
0
//C++ TO C# CONVERTER TODO TASK: The original C++ template specifier was replaced with a C# generic specifier, which may not produce the same behavior:
//ORIGINAL LINE: template <typename T>
        private bool getNumber <T>(Common.StringView name, ref T v)
        {
            var ptr = getValue.functorMethod(new Common.StringView(name));

            if (ptr == null)
            {
                return(false);
            }

            v = (T)ptr.getInteger();
            return(true);
        }
Exemple #6
0
        private JsonValue getValue(Common.StringView name)
        {
            JsonValue val = chain[chain.Count - 1].functorMethod;

            if (val.isArray())
            {
                return(val[idxs[idxs.Count - 1]++]);
            }

            string strName = name;

            return(val.contains(strName) ? &val(strName) : null);
        }
Exemple #7
0
        public override bool binary(ref string value, Common.StringView name)
        {
            var ptr = getValue.functorMethod(new Common.StringView(name));

            if (ptr == null)
            {
                return(false);
            }

            string valueHex = ptr.getString();

            value = Common.asString(Common.fromHex(valueHex));

            return(true);
        }
        public override bool BeginObject(Common.StringView name)
        {
            JsonValue parent = chain[chain.Count - 1].functorMethod;
            JsonValue obj    = new JsonValue(JsonValue.OBJECT);

            if (parent.isObject())
            {
                chain.Add(parent.insert((string)name, obj));
            }
            else
            {
                chain.Add(parent.pushBack(obj));
            }

            return(true);
        }
Exemple #9
0
        public override bool BeginArray(ref ulong size, Common.StringView name)
        {
            JsonValue parent  = chain[chain.Count - 1].functorMethod;
            string    strName = name;

            if (parent.contains(strName))
            {
                JsonValue arr = parent(strName);
                size = arr.size();
                chain.Add(arr);
                idxs.Add(0);
                return(true);
            }

            size = 0;
            return(false);
        }
Exemple #10
0
        public override bool BeginObject(Common.StringView name)
        {
            JsonValue parent = chain[chain.Count - 1].functorMethod;

            if (parent.isArray())
            {
                JsonValue v = parent[idxs[idxs.Count - 1]++];
                chain.Add(v);
                return(true);
            }

            if (parent.contains((string)name))
            {
                JsonValue v = parent((string)name);
                chain.Add(v);
                return(true);
            }

            return(false);
        }
Exemple #11
0
 public abstract bool Binary(string value, Common.StringView name);
 public static override bool functorMethod(ushort value, Common.StringView name)
 {
     GlobalMembers.insertOrPush(*chain[chain.Count - 1].functorMethod, new Common.StringView(name), (long)value);
     return(true);
 }
Exemple #13
0
//C++ TO C# CONVERTER TODO TASK: The original C++ template specifier was replaced with a C# generic specifier, which may not produce the same behavior:
//ORIGINAL LINE: template<typename T>
        public static new bool functorMethod <T>(T value, Common.StringView name)
        {
            return(base.FunctorMethod(value, name));
        }
        public static override bool functorMethod(int value, Common.StringView name)
        {
            long v = (long)value;

            return(operator ()(v, new Common.StringView(name)));
        }
Exemple #15
0
 public abstract bool BeginObject(Common.StringView name);
Exemple #16
0
 public abstract bool BeginArray(ref ulong size, Common.StringView name);
Exemple #17
0
 public static override bool functorMethod(ref double value, Common.StringView name)
 {
     return(getNumber(new Common.StringView(name), ref value));
 }
Exemple #18
0
        //public static abstract bool operator ()(ref byte value, Common.StringView name);
        //public static abstract bool operator ()(ref short value, Common.StringView name);
        //public static abstract bool operator ()(ref ushort value, Common.StringView name);
        //public static abstract bool operator ()(ref int value, Common.StringView name);
        //public static abstract bool operator ()(ref uint value, Common.StringView name);
        //public static abstract bool operator ()(ref long value, Common.StringView name);
        //public static abstract bool operator ()(ref ulong value, Common.StringView name);
        //public static abstract bool operator ()(ref double value, Common.StringView name);
        //public static abstract bool operator ()(ref bool value, Common.StringView name);
        //public static abstract bool operator ()(string value, Common.StringView name);

        // read/write binary block
        public abstract bool Binary(object value, ulong size, Common.StringView name);
        public override bool Binary(string value, Common.StringView name)
        {
//C++ TO C# CONVERTER TODO TASK: There is no equivalent to 'const_cast' in C#:
            return(binary(const_cast <char>(value.data()), value.Length, new Common.StringView(name)));
        }
Exemple #20
0
 public bool FunctorMethod <T>(T value, Common.StringView name)
 {
     //TODO: Revist this
     //return CryptoNote.GlobalMembers.serialize(value, new Common.StringView(name), this.functorMethod);
     return(false);
 }
        public override bool Binary(object value, ulong size, Common.StringView name)
        {
            string hex = Common.toHex(value, size);

            return(this.functorMethod(hex, name));
        }