From 8ba8268b51081b3b7d34da8fcec14d58b53f6d47 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 13 Jun 2019 12:25:25 -0700 Subject: Added string comparison operator to json. --- src/unstable/json.cpp | 8 ++++++++ src/unstable/json.h | 1 + 2 files changed, 9 insertions(+) (limited to 'src/unstable') diff --git a/src/unstable/json.cpp b/src/unstable/json.cpp index 7e6387b..d3d8535 100644 --- a/src/unstable/json.cpp +++ b/src/unstable/json.cpp @@ -525,6 +525,14 @@ Bu::Json &Bu::Json::operator=( const Bu::Json &rSrc ) return *this; } +bool Bu::Json::operator==( const Bu::String &rRhs ) +{ + if( eType != String ) + return false; + + return (*uDat.pString) == rRhs; +} + void Bu::Json::parseString( Bu::UtfChar &c, Bu::Stream &sInput, Bu::UtfString &sOut ) { diff --git a/src/unstable/json.h b/src/unstable/json.h index 100a3d1..5373bcf 100644 --- a/src/unstable/json.h +++ b/src/unstable/json.h @@ -87,6 +87,7 @@ namespace Bu Bu::String toStringStable() const; Bu::Json &operator=( const Bu::Json &rSrc ); + bool operator==( const Bu::String &rRhs ); private: void parse( Bu::UtfChar &c, Bu::Stream &sInput ); -- cgit v1.2.3