OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_JSON.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23 namespace juce
24{
25
26//==============================================================================
38 class JUCE_API JSON
39{
40 public:
41 //==============================================================================
56 static Result parse (const String& text, var& parsedResult);
57
67 static var parse (const String& text);
68
78 static var parse (const File& file);
79
89 static var parse (InputStream& input);
90
91 enum class Spacing
92 {
93 none,
94 singleLine,
95 multiLine,
96 };
97
101 class [[nodiscard]] FormatOptions
102 {
103 public:
105 FormatOptions withSpacing (Spacing x) const { return withMember (*this, &FormatOptions::spacing, x); }
106
110 FormatOptions withMaxDecimalPlaces (int x) const { return withMember (*this, &FormatOptions::maxDecimalPlaces, x); }
111
115 FormatOptions withIndentLevel (int x) const { return withMember (*this, &FormatOptions::indent, x); }
116
118 Spacing getSpacing() const { return spacing; }
119
121 int getMaxDecimalPlaces() const { return maxDecimalPlaces; }
122
124 int getIndentLevel() const { return indent; }
125
126 private:
127 Spacing spacing = Spacing::multiLine;
128 int maxDecimalPlaces = 15;
129 int indent = 0;
130 };
131
132 //==============================================================================
140 static String toString (const var& objectToFormat,
141 bool allOnOneLine = false,
142 int maximumDecimalPlaces = 15);
143
148 static String toString (const var& objectToFormat,
149 const FormatOptions& formatOptions);
150
156 static var fromString (StringRef);
157
165 static void writeToStream (OutputStream& output,
166 const var& objectToFormat,
167 bool allOnOneLine = false,
168 int maximumDecimalPlaces = 15);
169
174 static void writeToStream (OutputStream& output,
175 const var& objectToFormat,
176 const FormatOptions& formatOptions);
177
179 static String escapeString (StringRef);
180
185 static Result parseQuotedString (String::CharPointerType& text, var& result);
186
187 private:
188 //==============================================================================
189 JSON() = delete; // This class can't be instantiated - just use its static methods.
190};
191
192} // namespace juce
juce::File
Definition juce_File.h:45
juce::InputStream
Definition juce_InputStream.h:37
juce::JSON::FormatOptions
Definition juce_JSON.h:102
juce::JSON::FormatOptions::getIndentLevel
int getIndentLevel() const
Definition juce_JSON.h:124
juce::JSON::FormatOptions::getSpacing
Spacing getSpacing() const
Definition juce_JSON.h:118
juce::JSON::FormatOptions::getMaxDecimalPlaces
int getMaxDecimalPlaces() const
Definition juce_JSON.h:121
juce::JSON::FormatOptions::withSpacing
FormatOptions withSpacing(Spacing x) const
Definition juce_JSON.h:105
juce::JSON::FormatOptions::withIndentLevel
FormatOptions withIndentLevel(int x) const
Definition juce_JSON.h:115
juce::JSON::FormatOptions::withMaxDecimalPlaces
FormatOptions withMaxDecimalPlaces(int x) const
Definition juce_JSON.h:110
juce::JSON
Definition juce_JSON.h:39
juce::JSON::Spacing
Spacing
Definition juce_JSON.h:92
juce::OutputStream
Definition juce_OutputStream.h:38
juce::Result
Definition juce_Result.h:57
juce::StringRef
Definition juce_StringRef.h:62
juce::String
Definition juce_String.h:53
juce::var
Definition juce_Variant.h:42