Exemplo n.º 1
0
        public static MutableString ToJson(RubyContext context, IList self, GeneratorState state, int? depth)
        {
            MutableString result;

            if (state == null) {
                result = MutableString.CreateMutable(2 + Math.Max(self.Count * 4, 0), RubyEncoding.UTF8);
                result.Append('[');
                context.TaintObjectBy<Object>(result, self);
                if (self.Count > 0) {
                    for (int i = 0; i < self.Count; i++) {
                        Object element = self[i];
                        result.Append(Generator.ToJson(context, element, null, 0));
                        context.TaintObjectBy<Object>(result, element);
                        if (i < self.Count - 1) {
                            result.Append(',');
                        }
                    }
                }
                result.Append(']');
            }
            else {
                result = Transform(context, self, state, depth.HasValue ? depth.Value : 0);
            }

            return context.TaintObjectBy<MutableString>(result, self);
        }
Exemplo n.º 2
0
        public static MutableString ToJson(RubyContext context, IList self, GeneratorState state, int?depth)
        {
            MutableString result;

            if (state == null)
            {
                result = MutableString.CreateMutable(2 + Math.Max(self.Count * 4, 0), RubyEncoding.UTF8);
                result.Append('[');
                context.TaintObjectBy <Object>(result, self);
                if (self.Count > 0)
                {
                    for (int i = 0; i < self.Count; i++)
                    {
                        Object element = self[i];
                        result.Append(Generator.ToJson(context, element, null, 0));
                        context.TaintObjectBy <Object>(result, element);
                        if (i < self.Count - 1)
                        {
                            result.Append(',');
                        }
                    }
                }
                result.Append(']');
            }
            else
            {
                result = Transform(context, self, state, depth.HasValue ? depth.Value : 0);
            }

            return(context.TaintObjectBy <MutableString>(result, self));
        }
 public static GeneratorState Reinitialize(RubyContext context, GeneratorState self, Hash configuration)
 {
     if (configuration != null)
     {
         GeneratorState.Configure(context, self, configuration);
     }
     return(self);
 }
Exemplo n.º 4
0
 public static GeneratorState CreateGeneratorState(RubyClass/*!*/ self, [Optional]Hash configuration)
 {
     GeneratorState state = new GeneratorState();
     if (configuration != null) {
         Reinitialize(self.Context, state, configuration);
     }
     return state;
 }
Exemplo n.º 5
0
        public static MutableString ToJson(ConversionStorage <MutableString> toS, IDictionary self, GeneratorState state, int?depth)
        {
            MutableString result;
            RubyContext   context = toS.Context;

            if (state == null)
            {
                MutableString json;
                result = MutableString.CreateMutable(2 + Math.Max(self.Count * 12, 0), RubyEncoding.Default);

                result.Append('{');
                if (self.Count > 0)
                {
                    int i = 0;
                    foreach (DictionaryEntry kv in self)
                    {
                        // TODO: added state and depth
                        json = Generator.ToJson(context, Protocols.ConvertToString(toS, kv.Key), null, 0);
                        result.Append(json);
                        context.TaintObjectBy <Object>(result, json);

                        result.Append(':');

                        json = Generator.ToJson(context, kv.Value, null, 0);
                        result.Append(json);
                        context.TaintObjectBy <Object>(result, json);

                        if (++i < self.Count)
                        {
                            result.Append(',');
                        }
                    }
                }
                result.Append('}');
            }
            else
            {
                GeneratorState.Ensure(state);
                if (state.CheckCircular)
                {
                    if (state.Seen(context, self))
                    {
                        Helpers.ThrowCircularDataStructureException("circular data structures not supported!");
                    }
                    state.Remember(context, self);
                    result = Transform(toS, self, state, depth.HasValue ? depth.Value : 0);
                    state.Forget(context, self);
                }
                else
                {
                    result = Transform(toS, self, state, depth.HasValue ? depth.Value : 0);
                }
            }

            return(result);
        }
        public static GeneratorState /*!*/ CreateGeneratorState(RubyClass /*!*/ self, [Optional] Hash configuration)
        {
            GeneratorState state = new GeneratorState();

            if (configuration != null)
            {
                Reinitialize(self.Context, state, configuration);
            }
            return(state);
        }
Exemplo n.º 7
0
        private static MutableString Transform(ConversionStorage<MutableString> toS, IDictionary self, GeneratorState state, int depth)
        {
            byte[] objectNl = state.ObjectNl.ToByteArray();
            byte[] indent = Helpers.Repeat(state.Indent.ToByteArray(), depth + 1);
            byte[] spaceBefore = state.SpaceBefore.ToByteArray();
            byte[] space = state.Space.ToByteArray();
            int subDepth = depth + 1;

            MutableString result = MutableString.CreateBinary(2 + self.Count * (12 + indent.Length + spaceBefore.Length + space.Length));
            RubyContext context = toS.Context;

            result.Append((byte)'{');
            result.Append(objectNl);
            if (self.Count > 0) {
                MutableString json;
                int i = 0;
                foreach (DictionaryEntry kv in self) {
                    if (i > 0) {
                        result.Append(objectNl);
                    }
                    if (objectNl.Length != 0) {
                        result.Append(indent);
                    }

                    json = Generator.ToJson(context, Protocols.ConvertToString(toS, kv.Key), state, subDepth);
                    result.Append(json);
                    context.TaintObjectBy<Object>(result, json);

                    result.Append(spaceBefore);
                    result.Append((byte)':');
                    result.Append(space);

                    json = Generator.ToJson(context, kv.Value, state, subDepth);
                    result.Append(json);
                    context.TaintObjectBy<Object>(result, json);

                    if (++i < self.Count) {
                        result.Append(',');
                    }
                }

                if (objectNl.Length != 0) {
                    result.Append(objectNl);
                    if (indent.Length != 0) {
                        for (int n = 0; n < depth; n++) {
                            result.Append(indent);
                        }
                    }
                }
            }
            result.Append((byte)'}');
            return result;
        }
Exemplo n.º 8
0
 public static MutableString ToJson(Double self, GeneratorState state)
 {
     if (Double.IsInfinity(self) || Double.IsNaN(self)) {
         if (state != null && state.AllowNaN == false) {
             Helpers.ThrowGenerateException(String.Format("{0} not allowed in JSON", self));
         }
         return MutableString.CreateAscii(self.ToString(NumberFormatInfo.InvariantInfo));
     }
     else {
         return MutableString.CreateAscii(self.ToString(NumberFormatInfo.InvariantInfo));
     }
 }
        public static Hash ToHash(RubyContext /*!*/ context, GeneratorState /*!*/ self)
        {
            // TODO: vOpts.respondsTo("to_hash")
            Hash configurationHash = new Hash(context);

            configurationHash.Add(Helpers.GetGeneratorStateKey(context, "indent"), self.Indent);
            configurationHash.Add(Helpers.GetGeneratorStateKey(context, "space"), self.Space);
            configurationHash.Add(Helpers.GetGeneratorStateKey(context, "space_before"), self.SpaceBefore);
            configurationHash.Add(Helpers.GetGeneratorStateKey(context, "object_nl"), self.ObjectNl);
            configurationHash.Add(Helpers.GetGeneratorStateKey(context, "array_nl"), self.ArrayNl);
            configurationHash.Add(Helpers.GetGeneratorStateKey(context, "check_circular"), self.CheckCircular);
            configurationHash.Add(Helpers.GetGeneratorStateKey(context, "allow_nan"), self.AllowNaN);
            configurationHash.Add(Helpers.GetGeneratorStateKey(context, "max_nesting"), self.MaxNesting);
            return(configurationHash);
        }
Exemplo n.º 10
0
 public static MutableString ToJson(Double self, GeneratorState state)
 {
     if (Double.IsInfinity(self) || Double.IsNaN(self))
     {
         if (state != null && state.AllowNaN == false)
         {
             Helpers.ThrowGenerateException(String.Format("{0} not allowed in JSON", self));
         }
         return(MutableString.CreateAscii(self.ToString(NumberFormatInfo.InvariantInfo)));
     }
     else
     {
         return(MutableString.CreateAscii(self.ToString(NumberFormatInfo.InvariantInfo)));
     }
 }
Exemplo n.º 11
0
        public static MutableString ToJson(ConversionStorage<MutableString> toS, IDictionary self, GeneratorState state, int? depth)
        {
            MutableString result;
            RubyContext context = toS.Context;

            if (state == null) {
                MutableString json;
                result = MutableString.CreateMutable(2 + Math.Max(self.Count * 12, 0), RubyEncoding.Default);

                result.Append('{');
                if (self.Count > 0) {
                    int i = 0;
                    foreach (DictionaryEntry kv in self) {
                        // TODO: added state and depth
                        json = Generator.ToJson(context, Protocols.ConvertToString(toS, kv.Key), null, 0);
                        result.Append(json);
                        context.TaintObjectBy<Object>(result, json);

                        result.Append(':');

                        json = Generator.ToJson(context, kv.Value, null, 0);
                        result.Append(json);
                        context.TaintObjectBy<Object>(result, json);

                        if (++i < self.Count) {
                            result.Append(',');
                        }
                    }
                }
                result.Append('}');
            }
            else {
                GeneratorState.Ensure(state);
                if (state.CheckCircular) {
                    if (state.Seen(context, self)) {
                        Helpers.ThrowCircularDataStructureException("circular data structures not supported!");
                    }
                    state.Remember(context, self);
                    result = Transform(toS, self, state, depth.HasValue ? depth.Value : 0);
                    state.Forget(context, self);
                }
                else {
                    result = Transform(toS, self, state, depth.HasValue ? depth.Value : 0);
                }
            }

            return result;
        }
Exemplo n.º 12
0
 public static void Configure(RubyContext /*!*/ context, GeneratorState /*!*/ self, Hash /*!*/ configuration)
 {
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "indent")))
     {
         self.Indent = configuration[Helpers.GetGeneratorStateKey(context, "indent")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "space")))
     {
         self.Space = configuration[Helpers.GetGeneratorStateKey(context, "space")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "space_before")))
     {
         self.SpaceBefore = configuration[Helpers.GetGeneratorStateKey(context, "space_before")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "array_nl")))
     {
         self.ArrayNl = configuration[Helpers.GetGeneratorStateKey(context, "array_nl")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "object_nl")))
     {
         self.ObjectNl = configuration[Helpers.GetGeneratorStateKey(context, "object_nl")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "check_circular")))
     {
         Object cc = configuration[Helpers.GetGeneratorStateKey(context, "check_circular")];
         self.CheckCircular = cc is bool?(bool)cc : false;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "max_nesting")))
     {
         Object mn = configuration[Helpers.GetGeneratorStateKey(context, "max_nesting")];
         self.MaxNesting = (mn is int) ? (int)mn : 0;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "allow_nan")))
     {
         Object an = configuration[Helpers.GetGeneratorStateKey(context, "allow_nan")];
         self.AllowNaN = an is bool?(bool)an : false;
     }
 }
Exemplo n.º 13
0
 public static Int32 GetMaxNesting(GeneratorState self)
 {
     return self.MaxNesting;
 }
Exemplo n.º 14
0
 public static Boolean GetCheckCircular(GeneratorState self)
 {
     return self.CheckCircular;
 }
Exemplo n.º 15
0
 public static Object ASeen(RubyContext context, GeneratorState self, Object obj)
 {
     return self.Seen(context, obj) ? true : null as Object;
 }
Exemplo n.º 16
0
 public static Hash ToHash(RubyContext/*!*/ context, GeneratorState/*!*/ self)
 {
     // TODO: vOpts.respondsTo("to_hash")
     Hash configurationHash = new Hash(context);
     configurationHash.Add(Helpers.GetGeneratorStateKey(context, "indent"), self.Indent);
     configurationHash.Add(Helpers.GetGeneratorStateKey(context, "space"), self.Space);
     configurationHash.Add(Helpers.GetGeneratorStateKey(context, "space_before"), self.SpaceBefore);
     configurationHash.Add(Helpers.GetGeneratorStateKey(context, "object_nl"), self.ObjectNl);
     configurationHash.Add(Helpers.GetGeneratorStateKey(context, "array_nl"), self.ArrayNl);
     configurationHash.Add(Helpers.GetGeneratorStateKey(context, "check_circular"), self.CheckCircular);
     configurationHash.Add(Helpers.GetGeneratorStateKey(context, "allow_nan"), self.AllowNaN);
     configurationHash.Add(Helpers.GetGeneratorStateKey(context, "max_nesting"), self.MaxNesting);
     return configurationHash;
 }
Exemplo n.º 17
0
 public static void SetObjectNl(GeneratorState self, MutableString value)
 {
     self.ObjectNl = value;
 }
Exemplo n.º 18
0
 public static void SetIndent(GeneratorState self, MutableString value)
 {
     self.Indent = value;
 }
Exemplo n.º 19
0
        private static MutableString Transform(RubyContext context, IList self, GeneratorState state, int depth)
        {
            MutableString result = MutableString.CreateMutable(2 + Math.Max(self.Count * 4, 0), RubyEncoding.UTF8);

            byte[] indentUnit = state.Indent.ToByteArray();
            byte[] shift      = Helpers.Repeat(indentUnit, depth + 1);
            byte[] arrayNl    = state.ArrayNl.ToByteArray();
            byte[] delim      = new byte[1 + arrayNl.Length];
            delim[0] = (byte)',';
            Array.Copy(arrayNl, 0, delim, 1, arrayNl.Length);

            state.CheckMaxNesting(depth + 1);
            context.TaintObjectBy <Object>(result, self);

            if (state.CheckCircular)
            {
                state.Remember(context, self);
                result.Append('[');
                result.Append(arrayNl);
                if (self.Count > 0)
                {
                    for (int i = 0; i < self.Count; i++)
                    {
                        Object element = self[i];
                        if (state.Seen(context, element))
                        {
                            Helpers.ThrowCircularDataStructureException("circular data structures not supported!");
                        }
                        context.TaintObjectBy <Object>(result, element);
                        if (i > 0)
                        {
                            result.Append(delim);
                        }
                        result.Append(shift);
                        result.Append(Generator.ToJson(context, element, state, depth + 1));
                    }

                    // TODO: this might be needed outside of the count check for compat
                    if (arrayNl.Length != 0)
                    {
                        result.Append(arrayNl);
                        result.Append(shift, 0, depth * indentUnit.Length);
                    }
                }
                result.Append(']');
                state.Forget(context, self);
            }
            else
            {
                result.Append('[');
                result.Append(arrayNl);
                if (self.Count > 0)
                {
                    for (int i = 0; i < self.Count; i++)
                    {
                        Object element = self[i];
                        context.TaintObjectBy <Object>(result, element);
                        if (i > 0)
                        {
                            result.Append(delim);
                        }
                        result.Append(shift);
                        result.Append(Generator.ToJson(context, element, state, depth + 1));
                    }

                    // TODO: this might be needed outside of the count check for compatibility
                    if (arrayNl.Length != 0)
                    {
                        result.Append(arrayNl);
                        result.Append(shift, 0, depth * indentUnit.Length);
                    }
                }
                result.Append(']');
            }

            return(result);
        }
Exemplo n.º 20
0
 public static void SetMaxNesting(GeneratorState self, Int32 value)
 {
     self.MaxNesting = value;
 }
Exemplo n.º 21
0
 public static Int32 GetMaxNesting(GeneratorState self)
 {
     return(self.MaxNesting);
 }
Exemplo n.º 22
0
 public static void SetIndent(GeneratorState self, MutableString value)
 {
     self.Indent = value;
 }
Exemplo n.º 23
0
 public static Boolean GetCheckCircular(GeneratorState self)
 {
     return(self.CheckCircular);
 }
Exemplo n.º 24
0
 public static void SetArrayNl(GeneratorState self, MutableString value)
 {
     self.ArrayNl = value;
 }
Exemplo n.º 25
0
 public static MutableString GetArrayNl(GeneratorState self)
 {
     return(self.ObjectNl);
 }
Exemplo n.º 26
0
 public static void SetObjectNl(GeneratorState self, MutableString value)
 {
     self.ObjectNl = value;
 }
Exemplo n.º 27
0
 public static MutableString GetSpace(GeneratorState self)
 {
     return self.Space;
 }
Exemplo n.º 28
0
        private static MutableString Transform(RubyContext context, IList self, GeneratorState state, int depth)
        {
            MutableString result = MutableString.CreateMutable(2 + Math.Max(self.Count * 4, 0), RubyEncoding.UTF8);

            byte[] indentUnit = state.Indent.ToByteArray();
            byte[] shift = Helpers.Repeat(indentUnit, depth + 1);
            byte[] arrayNl = state.ArrayNl.ToByteArray();
            byte[] delim = new byte[1 + arrayNl.Length];
            delim[0] = (byte)',';
            Array.Copy(arrayNl, 0, delim, 1, arrayNl.Length);

            state.CheckMaxNesting(depth + 1);
            context.TaintObjectBy<Object>(result, self);

            if (state.CheckCircular) {
                state.Remember(context, self);
                result.Append('[');
                result.Append(arrayNl);
                if (self.Count > 0) {
                    for (int i = 0; i < self.Count; i++) {
                        Object element = self[i];
                        if (state.Seen(context, element)) {
                            Helpers.ThrowCircularDataStructureException("circular data structures not supported!");
                        }
                        context.TaintObjectBy<Object>(result, element);
                        if (i > 0) {
                            result.Append(delim);
                        }
                        result.Append(shift);
                        result.Append(Generator.ToJson(context, element, state, depth + 1));
                    }

                    // TODO: this might be needed outside of the count check for compat
                    if (arrayNl.Length != 0) {
                        result.Append(arrayNl);
                        result.Append(shift, 0, depth * indentUnit.Length);
                    }
                }
                result.Append(']');
                state.Forget(context, self);
            }
            else {
                result.Append('[');
                result.Append(arrayNl);
                if (self.Count > 0) {
                    for (int i = 0; i < self.Count; i++) {
                        Object element = self[i];
                        context.TaintObjectBy<Object>(result, element);
                        if (i > 0) {
                            result.Append(delim);
                        }
                        result.Append(shift);
                        result.Append(Generator.ToJson(context, element, state, depth + 1));
                    }

                    // TODO: this might be needed outside of the count check for compatibility
                    if (arrayNl.Length != 0) {
                        result.Append(arrayNl);
                        result.Append(shift, 0, depth * indentUnit.Length);
                    }
                }
                result.Append(']');
            }

            return result;
        }
Exemplo n.º 29
0
 public static MutableString ToJson(ConversionStorage <MutableString> /*!*/ toS,
                                    Object /*!*/ self, [Optional] GeneratorState state, [Optional] Int32 depth)
 {
     return(Generator.ToJson(Protocols.ConvertToString(toS, self)));
 }
Exemplo n.º 30
0
 public static void SetSpaceBefore(GeneratorState self, MutableString value)
 {
     self.SpaceBefore = value;
 }
Exemplo n.º 31
0
 public static GeneratorState Reconfigure(RubyContext context, GeneratorState /*!*/ self, Hash /*!*/ configuration)
 {
     GeneratorState.Configure(context, self, configuration);
     return(self);
 }
Exemplo n.º 32
0
 public static void SetMaxNesting(GeneratorState self, Int32 value)
 {
     self.MaxNesting = value;
 }
Exemplo n.º 33
0
        private static MutableString Transform(ConversionStorage <MutableString> toS, IDictionary self, GeneratorState state, int depth)
        {
            byte[] objectNl    = state.ObjectNl.ToByteArray();
            byte[] indent      = Helpers.Repeat(state.Indent.ToByteArray(), depth + 1);
            byte[] spaceBefore = state.SpaceBefore.ToByteArray();
            byte[] space       = state.Space.ToByteArray();
            int    subDepth    = depth + 1;

            MutableString result  = MutableString.CreateBinary(2 + self.Count * (12 + indent.Length + spaceBefore.Length + space.Length));
            RubyContext   context = toS.Context;

            result.Append((byte)'{');
            result.Append(objectNl);
            if (self.Count > 0)
            {
                MutableString json;
                int           i = 0;
                foreach (DictionaryEntry kv in self)
                {
                    if (i > 0)
                    {
                        result.Append(objectNl);
                    }
                    if (objectNl.Length != 0)
                    {
                        result.Append(indent);
                    }

                    json = Generator.ToJson(context, Protocols.ConvertToString(toS, kv.Key), state, subDepth);
                    result.Append(json);
                    context.TaintObjectBy <Object>(result, json);

                    result.Append(spaceBefore);
                    result.Append((byte)':');
                    result.Append(space);

                    json = Generator.ToJson(context, kv.Value, state, subDepth);
                    result.Append(json);
                    context.TaintObjectBy <Object>(result, json);

                    if (++i < self.Count)
                    {
                        result.Append(',');
                    }
                }

                if (objectNl.Length != 0)
                {
                    result.Append(objectNl);
                    if (indent.Length != 0)
                    {
                        for (int n = 0; n < depth; n++)
                        {
                            result.Append(indent);
                        }
                    }
                }
            }
            result.Append((byte)'}');
            return(result);
        }
Exemplo n.º 34
0
 public static void SetSpaceBefore(GeneratorState self, MutableString value)
 {
     self.SpaceBefore = value;
 }
Exemplo n.º 35
0
 public static bool ARemember(RubyContext context, GeneratorState self, Object obj)
 {
     self.Remember(context, obj);
     return(true);
 }
Exemplo n.º 36
0
 public static bool ARemember(RubyContext context, GeneratorState self, Object obj)
 {
     self.Remember(context, obj);
     return true;
 }
Exemplo n.º 37
0
 public static MutableString ToJson(ConversionStorage <MutableString> toS, Hash self,
                                    [Optional] GeneratorState state, [Optional] Int32 depth)
 {
     return(Generator.ToJson(toS, self, state, depth));
 }
Exemplo n.º 38
0
 public static void Configure(RubyContext/*!*/ context, GeneratorState/*!*/ self, Hash/*!*/ configuration)
 {
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "indent"))) {
         self.Indent = configuration[Helpers.GetGeneratorStateKey(context, "indent")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "space"))) {
         self.Space = configuration[Helpers.GetGeneratorStateKey(context, "space")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "space_before"))) {
         self.SpaceBefore = configuration[Helpers.GetGeneratorStateKey(context, "space_before")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "array_nl"))) {
         self.ArrayNl = configuration[Helpers.GetGeneratorStateKey(context, "array_nl")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "object_nl"))) {
         self.ObjectNl = configuration[Helpers.GetGeneratorStateKey(context, "object_nl")] as MutableString;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "check_circular"))) {
         Object cc = configuration[Helpers.GetGeneratorStateKey(context, "check_circular")];
         self.CheckCircular = cc is bool ? (bool)cc : false;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "max_nesting"))) {
         Object mn = configuration[Helpers.GetGeneratorStateKey(context, "max_nesting")];
         self.MaxNesting = (mn is int) ? (int)mn : 0;
     }
     if (configuration.ContainsKey(Helpers.GetGeneratorStateKey(context, "allow_nan"))) {
         Object an = configuration[Helpers.GetGeneratorStateKey(context, "allow_nan")];
         self.AllowNaN = an is bool ? (bool)an : false;
     }
 }
Exemplo n.º 39
0
 public static MutableString GetIndent(GeneratorState self)
 {
     return(self.Indent);
 }
Exemplo n.º 40
0
 public static MutableString GetIndent(GeneratorState self)
 {
     return self.Indent;
 }
Exemplo n.º 41
0
 public static MutableString ToJson(String self, [Optional] GeneratorState state, [Optional] Int32 depth)
 {
     return(Generator.ToJson(MutableString.Create(self, RubyEncoding.Binary)));
 }
Exemplo n.º 42
0
 public static MutableString GetObjectNl(GeneratorState self)
 {
     return self.ObjectNl;
 }
Exemplo n.º 43
0
 public static MutableString ToJson(Boolean self, [Optional] GeneratorState state, [Optional] Int32 depth)
 {
     return(Generator.ToJson(self));
 }
Exemplo n.º 44
0
 public static GeneratorState Reconfigure(RubyContext context, GeneratorState/*!*/ self, Hash/*!*/ configuration)
 {
     GeneratorState.Configure(context, self, configuration);
     return self;
 }
Exemplo n.º 45
0
 public static GeneratorState Reinitialize(RubyContext context, GeneratorState self, Hash configuration)
 {
     if (configuration != null) {
         GeneratorState.Configure(context, self, configuration);
     }
     return self;
 }
Exemplo n.º 46
0
 public static MutableString ToJson(RubyContext /*!*/ context, RubyArray self,
                                    [Optional] GeneratorState state, [Optional] Int32 depth)
 {
     return(Generator.ToJson(context, self, state, depth));
 }
Exemplo n.º 47
0
 public static void SetArrayNl(GeneratorState self, MutableString value)
 {
     self.ArrayNl = value;
 }
Exemplo n.º 48
0
 public static Object ASeen(RubyContext context, GeneratorState self, Object obj)
 {
     return(self.Seen(context, obj) ? true : null as Object);
 }
Exemplo n.º 49
0
 public static MutableString GetSpaceBefore(GeneratorState self)
 {
     return(self.SpaceBefore);
 }