Repository navigation
Expand file tree
/
Copy pathJsonPrettify.h
More file actions
55 lines (46 loc) · 2.01 KB
/
Copy pathJsonPrettify.h
File metadata and controls
55 lines (46 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// Copyright (c) Autodesk, Inc. All rights reserved
//
// C++ glTF FBX importer/exporter plug-in
// by Cyrille Fauvel - Autodesk Developer Network (ADN)
// January 2015
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
#pragma once
namespace _IOglTF_NS_ {
class JsonPrettify {
static web::json::value sNull ;
web::json::value &_json ;
int _level ;
protected:
JsonPrettify () : _json (JsonPrettify::sNull) {}
void serialize (web::json::value &val, utility::ostream_t &stream) ;
void indent (utility::ostream_t &stream) ;
void format_string (const utility::string_t &st, utility::ostream_t &stream) ;
void format_boolean (const bool val, utility::ostream_t &stream) ;
void format_integer (const int val, utility::ostream_t &stream) ;
void format_double (const double val, utility::ostream_t &stream) ;
void format_null (utility::ostream_t &stream) ;
void formatValue (web::json::value &val, utility::ostream_t &stream) ;
void formatPair (utility::string_t &key, web::json::value &val, utility::ostream_t &stream) ;
void formatArray (web::json::array &arr, utility::ostream_t &stream) ;
void formatObject (web::json::object &obj, utility::ostream_t &stream) ;
template<typename CharType>
static void append_escape_string (std::basic_string<CharType> &str, const std::basic_string<CharType> &escaped) ;
public:
JsonPrettify (web::json::value &json) : _json (json), _level (0) {}
void serialize (utility::ostream_t &stream) ;
} ;
}