libzypp 17.37.17
JsonNull.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#ifndef ZYPP_CORE_PARSER_JSON_JSON_NULL_DEFINED
10#define ZYPP_CORE_PARSER_JSON_JSON_NULL_DEFINED
11
12#include <string_view>
13#include <string>
14
15namespace zypp::json {
16
17 static constexpr std::string_view nullJSON ("null");
18
19 class Null {
20
21 public:
22 Null() = default;
23 Null(std::nullptr_t){}
24
25 ~Null() = default;
26
27 Null( const Null & ) = default;
28 Null( Null && ) = default;
29 Null &operator=(const Null &) = default;
30 Null &operator=(Null &&) = default;
31
33 std::string asJSON() const
34 { return std::string(nullJSON); }
35
37 std::ostream & dumpOn( std::ostream & str ) const
38 { return str << nullJSON; }
39
40 // comparison
41 bool operator==( const Null & ) const { return true; }
42
43 };
44
46 inline std::ostream & operator<<( std::ostream & str, const Null & obj )
47 {
48 return obj.dumpOn( str );
49 }
50}
51
52#endif
Null(std::nullptr_t)
Definition JsonNull.h:23
Null & operator=(const Null &)=default
Null(Null &&)=default
Null(const Null &)=default
Null & operator=(Null &&)=default
std::ostream & dumpOn(std::ostream &str) const
Stream output.
Definition JsonNull.h:37
std::string asJSON() const
JSON representation.
Definition JsonNull.h:33
bool operator==(const Null &) const
Definition JsonNull.h:41
std::ostream & operator<<(std::ostream &str, const Null &obj)
Stream output.
Definition JsonNull.h:46
String related utilities and Regular expression matching.
static constexpr std::string_view nullJSON("null")