/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=8 sts=2 et sw=2 tw=80: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef vm_JSONPrinter_h #define vm_JSONPrinter_h
#include"mozilla/TimeStamp.h"
#include <stdio.h>
#include"js/Printer.h" #include"js/TypeDecls.h"
class JSLinearString;
namespace js {
class JSONPrinter { protected: int indentLevel_ = 0; int inlineLevel_ = 0; bool indent_; bool first_ = true;
GenericPrinter& out_;
void value(constchar* format, ...) MOZ_FORMAT_PRINTF(2, 3); void value(int value);
void boolProperty(constchar* name, bool value);
void property(constchar* name, const JSLinearString* value); void property(constchar* name, constchar* value); void property(constchar* name, int32_t value); void property(constchar* name, uint32_t value); void property(constchar* name, int64_t value); void property(constchar* name, uint64_t value); #ifdefined(XP_DARWIN) || defined(__OpenBSD__) || defined(__wasi__) // On OSX and OpenBSD, size_t is long unsigned, uint32_t is unsigned, and // uint64_t is long long unsigned. Everywhere else, size_t matches either // uint32_t or uint64_t. void property(constchar* name, size_t value); #endif
void formatProperty(constchar* name, constchar* format, ...)
MOZ_FORMAT_PRINTF(3, 4); void formatPropertyVA(constchar* name, constchar* format, va_list ap);
void propertyName(constchar* name);
// JSON requires decimals to be separated by periods, but the LC_NUMERIC // setting may cause printf to use commas in some locales. enum TimePrecision { SECONDS, MILLISECONDS, MICROSECONDS }; void property(constchar* name, const mozilla::TimeDuration& dur,
TimePrecision precision);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.