コード例 #1
0
        private void WriteMappingKey(
            EvaluationContext context,
            StringBuilder writer,
            MemoryCounter memory,
            EvaluationResult key,
            Stack <ICollectionEnumerator> ancestors)
        {
            var str = PrefixValue(JsonUtility.ToString(key.ConvertToString()), ancestors, isMappingKey: true);

            memory.Add(str);
            writer.Append(str);
        }
コード例 #2
0
        private void WriteValue(
            EvaluationContext context,
            StringBuilder writer,
            MemoryCounter memory,
            EvaluationResult value,
            Stack <ICollectionEnumerator> ancestors)
        {
            String str;

            switch (value.Kind)
            {
            case ValueKind.Null:
                str = "null";
                break;

            case ValueKind.Boolean:
                str = (Boolean)value.Value ? "true" : "false";
                break;

            case ValueKind.Number:
                str = value.ConvertToString();
                break;

            case ValueKind.String:
                str = JsonUtility.ToString(value.Value);
                break;

            default:
                str = "{}";     // The value is an object we don't know how to traverse
                break;
            }

            str = PrefixValue(str, ancestors);
            memory.Add(str);
            writer.Append(str);
        }