8#include "Arp/System/Core/PimplPtr.hxx" 
    9#include "Arp/System/Commons/Json/JsonSerializationContext.hpp" 
   10#include "Arp/System/Commons/Exceptions/JsonException.hpp" 
   11#include "Arp/System/Commons/Exceptions/Exceptions.h" 
   12#include "Arp/System/Core/IEnumerator.hxx" 
   14namespace Arp { 
namespace System { 
namespace Commons { 
namespace Json
 
   41    const String& GetDocumentFileName();
 
   43    bool HasRootObject(
void);
 
   44    bool HasRootSimpleArray(
void);
 
   45    bool HasRootComplexArray(
void);
 
   50    void ReadRootObject(
void);
 
   51    bool TryReadRootObject(
void);
 
   52    void ReadStartObject(
const char* objectName);
 
   53    bool TryReadStartObject(
const char* objectName);
 
   54    void ReadEndObject(
void);
 
   55    bool TryReadEndObject(
void);
 
   58    bool TryReadStartAny(
String& name);
 
   59    void ReadEndAny(
void);
 
   60    bool TryReadEndAny(
void);
 
   63    void ReadStartComplexArrayItem(
void);
 
   64    bool TryReadStartComplexArrayItem(
void);
 
   65    void ReadEndComplexArrayItem(
void);
 
   66    bool TryReadEndComplexArrayItem(
void);
 
   68    bool TryReadValue(
const char* valueName, 
bool& result);
 
   69    bool TryReadValue(
const char* valueName, 
String& result);
 
   70    bool TryReadValue(
const char* valueName, 
uint8& result);
 
   71    bool TryReadValue(
const char* valueName, 
int8& result);
 
   72    bool TryReadValue(
const char* valueName, 
uint16& result);
 
   73    bool TryReadValue(
const char* valueName, 
int16& result);
 
   74    bool TryReadValue(
const char* valueName, 
uint32& result);
 
   75    bool TryReadValue(
const char* valueName, 
int32& result);
 
   76    bool TryReadValue(
const char* valueName, 
uint64& result);
 
   77    bool TryReadValue(
const char* valueName, 
int64& result);
 
   78    bool TryReadValue(
const char* valueName, 
float32& result);
 
   79    bool TryReadValue(
const char* valueName, 
float64& result);
 
   81    void ReadValue(
const char* valueName, 
char* pBuffer, 
size_t bufferSize);
 
   82    bool TryReadValue(
const char* valueName, 
char* pBuffer, 
size_t bufferSize);
 
   84    bool TryReadSimpleArray(
const char* arrayName, std::vector<bool>& result);
 
   85    bool TryReadSimpleArray(
const char* arrayName, std::vector<String>& result);
 
   86    bool TryReadSimpleArray(
const char* arrayName, std::vector<uint8>& result);
 
   87    bool TryReadSimpleArray(
const char* arrayName, std::vector<int8>& result);
 
   88    bool TryReadSimpleArray(
const char* arrayName, std::vector<uint16>& result);
 
   89    bool TryReadSimpleArray(
const char* arrayName, std::vector<int16>& result);
 
   90    bool TryReadSimpleArray(
const char* arrayName, std::vector<uint32>& result);
 
   91    bool TryReadSimpleArray(
const char* arrayName, std::vector<int32>& result);
 
   92    bool TryReadSimpleArray(
const char* arrayName, std::vector<uint64>& result);
 
   93    bool TryReadSimpleArray(
const char* arrayName, std::vector<int64>& result);
 
   94    bool TryReadSimpleArray(
const char* arrayName, std::vector<float32>& result);
 
   95    bool TryReadSimpleArray(
const char* arrayName, std::vector<float64>& result);
 
   96    bool TryReadSimpleArray(
const char* arrayName, std::vector<Arp::byte>& result);
 
   98    JsonValue GetRootValue(
void);
 
   99    bool TryGetRootValue(JsonValue& jsonValueResult);
 
  100    JsonValue GetValue(
const char* valueName);
 
  101    bool TryGetValue(
const char* valueName, JsonValue& jsonValueResult);
 
  112    std::vector<T> ReadSimpleArray(
const char* arrayName);
 
  114    template<
typename... Args>
 
  115    JsonException CreateException(
const char* message, 
const Args& ... args) 
const;
 
  120    const Impl& GetImpl(
void)
const;
 
  141        arrayObjectResult.ReadJson(*
this, context);
 
  161        throw JsonException(
"Error reading value, type mismatch, valueName: {0} type: {1}", valueName, 
typeid(T).name());
 
  174    std::vector<T> value;
 
  177        throw JsonException(
"Error reading simple array, type mismatch, arrayName: {0} type: {1}", arrayName, 
typeid(T).name());
 
  183template<
typename... Args>
 
  184inline JsonException JsonReader::CreateException(
const char* message, 
const Args& ... args)
 const 
std::shared_ptr< IEnumerator > Ptr
The smart pointer type of this interface.
Definition: IEnumerator.hxx:52
 
Adapter class to implement PImpl idiom.
Definition: PimplPtr.hxx:15
 
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
 
static String Format(const String &format, const Args &... args)
Formats the format  string using the .NET/Python syntax with the given variadic arguments.
Definition: String.inl:18
 
This exception is used for Json parsing errors.
Definition: JsonException.hpp:15
 
Class to read a json file or stream
Definition: JsonReader.hpp:22
 
JsonReader(void)
Default constructor.
 
bool TryReadValue(const char *valueName, bool &result)
Reads a bool value
Definition: JsonReader.cpp:189
 
bool TryReadSimpleArray(const char *arrayName, std::vector< bool > &result)
Reads a simple array of bool
Definition: JsonReader.cpp:317
 
JsonReader(JsonReader &&arg) noexcept
Default move constructor.
 
bool TryReadEndComplexArrayItem(void)
End of reading a complex array item
Definition: JsonReader.cpp:178
 
bool TryReadStartComplexArrayItem(void)
Reads a complex array item
Definition: JsonReader.cpp:164
 
std::vector< T > ReadSimpleArray(const char *arrayName)
Reads a simple array
Definition: JsonReader.hpp:172
 
JsonReader & operator=(JsonReader &&arg) noexcept
Default move-assignment operator.
 
void ReadValue(const char *valueName, char *pBuffer, size_t bufferSize)
Reads a char* value
Definition: JsonReader.cpp:298
 
~JsonReader(void)
Default destructor.
 
Json context used during Json reading and writing to hold the context information
Definition: JsonSerializationContext.hpp:20
 
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
 
float float32
The Arp floating point numbers type of 4 byte size.
Definition: PrimitiveTypes.hpp:41
 
std::int16_t int16
The Arp integer type of 2 byte size.
Definition: PrimitiveTypes.hpp:31
 
std::uint8_t uint8
The Arp unsigned integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:25
 
std::uint16_t uint16
The Arp unsigned integer type of 2 byte size.
Definition: PrimitiveTypes.hpp:29
 
std::int64_t int64
The Arp integer type of 8 byte size.
Definition: PrimitiveTypes.hpp:39
 
std::int32_t int32
The Arp integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:35
 
std::int8_t int8
The Arp integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:27
 
std::uint64_t uint64
The Arp unsigned integer type of 8 byte size.
Definition: PrimitiveTypes.hpp:37
 
double float64
The Arp floating point numbers type of 8 byte size.
Definition: PrimitiveTypes.hpp:43
 
@ Create
Creates a new file. If the file already exists, it is overwritten.
 
@ ReadValue
Reading values of objects.
 
Root namespace for the PLCnext API