diff options
author | Andrew Meadows <leviathan@lindenlab.com> | 2024-10-04 11:07:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-04 11:07:47 -0700 |
commit | f89abf259dddfe9086de9d96e0b6d65a427f2971 (patch) | |
tree | d90b74f4ec320a3bc53a889eb5ba41d18b00ab52 /indra/llcommon/llsd.cpp | |
parent | 4339ad9a528c82946ce40ec2bd240b41d104f338 (diff) | |
parent | 2f07279ccaf5aecc45ed9a78d337e73ab58d89a7 (diff) |
Merge pull request #1934 from secondlife/leviathan/game-control
Add GameControl behind feature-flag
Diffstat (limited to 'indra/llcommon/llsd.cpp')
-rw-r--r-- | indra/llcommon/llsd.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 77fe545c3f..1058ab385b 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -974,6 +974,31 @@ void LLSD::clear() { Impl::assignUndefined(impl); } LLSD::Type LLSD::type() const { return safe(impl).type(); } +bool LLSD::isEmpty() const +{ + switch (type()) + { + case TypeUndefined: + return true; // Always empty + case TypeBinary: + return !asBoolean(); // Empty when default + case TypeInteger: + return !asInteger(); // Empty when default + case TypeReal: + return !asReal(); // Empty when default + case TypeString: + case TypeURI: + return asString().empty(); // Empty natively + case TypeArray: + case TypeMap: + return !size(); // Empty natively + default:; + } + // All other value types (TypeDate) don't have default values so can't be empty + return false; +} + + // Scalar Constructors LLSD::LLSD(Boolean v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } LLSD::LLSD(Integer v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } |