3#include <Foundation/Basics.h>
4#include <Foundation/Containers/HybridArray.h>
5#include <Foundation/IO/Stream.h>
6#include <Foundation/Types/Variant.h>
47 void AddVariableInt32(
plStringView sName, plInt32 value);
50 void AddVariableUInt32(
plStringView sName, plUInt32 value);
53 void AddVariableInt64(
plStringView sName, plInt64 value);
56 void AddVariableUInt64(
plStringView sName, plUInt64 value);
62 void AddVariableDouble(
plStringView sName,
double value);
152 virtual void WriteColor(
const plColor& value) = 0;
162 virtual void WriteVec2(
const plVec2& value) = 0;
167 virtual void WriteVec3(
const plVec3& value) = 0;
172 virtual void WriteVec4(
const plVec4& value) = 0;
177 virtual void WriteVec2I32(
const plVec2I32& value) = 0;
182 virtual void WriteVec3I32(
const plVec3I32& value) = 0;
187 virtual void WriteVec4I32(
const plVec4I32& value) = 0;
192 virtual void WriteQuat(
const plQuat& value) = 0;
197 virtual void WriteMat3(
const plMat3& value) = 0;
202 virtual void WriteMat4(
const plMat4& value) = 0;
217 virtual void WriteDataBuffer(
const plDataBuffer& value) = 0;
222 virtual void WriteVariant(
const plVariant& value);
262 bool HadWriteError()
const;
266 ArrayMode m_ArrayMode = ArrayMode::InOneLine;
269 void SetWriteErrorState();
272 bool m_bHadWriteError =
false;
296 virtual void WriteBool(
bool value)
override;
299 virtual void WriteInt32(plInt32 value)
override;
302 virtual void WriteUInt32(plUInt32 value)
override;
305 virtual void WriteInt64(plInt64 value)
override;
308 virtual void WriteUInt64(plUInt64 value)
override;
311 virtual void WriteFloat(
float value)
override;
314 virtual void WriteDouble(
double value)
override;
320 virtual void WriteNULL()
override;
323 virtual void WriteTime(
plTime value)
override;
326 virtual void WriteColor(
const plColor& value)
override;
329 virtual void WriteColorGamma(
const plColorGammaUB& value)
override;
332 virtual void WriteVec2(
const plVec2& value)
override;
335 virtual void WriteVec3(
const plVec3& value)
override;
338 virtual void WriteVec4(
const plVec4& value)
override;
341 virtual void WriteVec2I32(
const plVec2I32& value)
override;
344 virtual void WriteVec3I32(
const plVec3I32& value)
override;
347 virtual void WriteVec4I32(
const plVec4I32& value)
override;
350 virtual void WriteQuat(
const plQuat& value)
override;
353 virtual void WriteMat3(
const plMat3& value)
override;
356 virtual void WriteMat4(
const plMat4& value)
override;
359 virtual void WriteUuid(
const plUuid& value)
override;
362 virtual void WriteAngle(
plAngle value)
override;
365 virtual void WriteDataBuffer(
const plDataBuffer& value)
override;
369 virtual void WriteBinaryData(
plStringView sDataType,
const void* pData, plUInt32 uiBytes,
plStringView sValueString =
nullptr)
override;
372 virtual void BeginVariable(
plStringView sName)
override;
375 virtual void EndVariable()
override;
378 virtual void BeginArray(
plStringView sName = {})
override;
381 virtual void EndArray()
override;
384 virtual void BeginObject(
plStringView sName = {})
override;
387 virtual void EndObject()
override;
408 bool m_bRequireComma;
409 bool m_bValueWasWritten;
422 void OutputIndentation();
424 plInt32 m_iIndentation;
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
A 8bit per channel unsigned normalized (values interpreted as 0-1) color storage format that represen...
Definition Color8UNorm.h:99
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
The base class for JSON writers.
Definition JSONWriter.h:12
virtual void EndObject()=0
Ends outputting an object variable.
virtual void WriteUInt32(plUInt32 value)=0
Writes a uint32 to the JSON file. Can only be called between BeginVariable() / EndVariable() or Begin...
virtual void BeginObject(plStringView sName=nullptr)=0
Begins outputting an object variable.
virtual void WriteBool(bool value)=0
Writes a bool to the JSON file. Can only be called between BeginVariable() / EndVariable() or BeginAr...
virtual void WriteAngle(plAngle value)=0
Writes an plAngle to the JSON file. Can only be called between BeginVariable() / EndVariable() or Beg...
virtual void BeginArray(plStringView sName=nullptr)=0
Begins outputting an array variable.
virtual void WriteTime(plTime value)=0
Writes a time value to the JSON file. Can only be called between BeginVariable() / EndVariable() or B...
void SetWhitespaceMode(WhitespaceMode whitespaceMode)
Configures how much whitespace is output.
Definition JSONWriter.h:38
virtual void WriteDouble(double value)=0
Writes a double to the JSON file. Can only be called between BeginVariable() / EndVariable() or Begin...
virtual void WriteString(plStringView value)=0
Writes a string to the JSON file. Can only be called between BeginVariable() / EndVariable() or Begin...
virtual void BeginVariable(plStringView sName)=0
Begins outputting a variable. szName is the variable name.
virtual ~plJSONWriter()
Destructor.
virtual void WriteUuid(const plUuid &value)=0
Writes an plUuid to the JSON file. Can only be called between BeginVariable() / EndVariable() or Begi...
virtual void WriteBinaryData(plStringView sDataType, const void *pData, plUInt32 uiBytes, plStringView sValueString=nullptr)=0
Outputs a chunk of memory in some JSON form that can be interpreted as binary data when reading it ag...
virtual void WriteInt32(plInt32 value)=0
Writes an int32 to the JSON file. Can only be called between BeginVariable() / EndVariable() or Begin...
void SetArrayMode(ArrayMode arrayMode)
Configures how arrays are written.
Definition JSONWriter.h:41
plJSONWriter()
Constructor.
virtual void WriteUInt64(plUInt64 value)=0
Writes a uint64 to the JSON file. Can only be called between BeginVariable() / EndVariable() or Begin...
virtual void WriteNULL()=0
Writes the value 'null' to the JSON file. Can only be called between BeginVariable() / EndVariable() ...
virtual void EndVariable()=0
Ends outputting a variable.
virtual void WriteInt64(plInt64 value)=0
Writes an int64 to the JSON file. Can only be called between BeginVariable() / EndVariable() or Begin...
virtual void EndArray()=0
Ends outputting an array variable.
ArrayMode
Modes to configure how arrays are written.
Definition JSONWriter.h:26
WhitespaceMode
Modes to configure how much whitespace the JSON writer will output.
Definition JSONWriter.h:16
virtual void WriteFloat(float value)=0
Writes a float to the JSON file. Can only be called between BeginVariable() / EndVariable() or BeginA...
Implements a standard compliant JSON writer, all numbers are output as double values.
Definition JSONWriter.h:284
Interface for binary out (write) streams.
Definition Stream.h:107
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
This data type is the abstraction for 128-bit Uuid (also known as GUID) instances.
Definition Uuid.h:11
plVariant is a class that can store different types of variables, which is useful in situations where...
Definition Variant.h:44
Definition JSONWriter.h:413
Definition JSONWriter.h:404
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12