diff options
| author | Andrew Meadows <leviathan@lindenlab.com> | 2026-10-16 19:01:06 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-16 19:01:06 -0700 |
| commit | 923f645a923e7f061f7ff2790d8510aa4b5ced36 (patch) | |
| tree | 0f1b8a6434c6ea5fb2c80b52f4afa695b4383d93 /indra/llcommon/llsd.cpp | |
| parent | 51f2817d3ab3b9454ec2848042420dfcc17d7bb6 (diff) | |
| parent | d4270de9eac1f79f267c2fae75c57c2464dc6bbd (diff) | |
Merge pull request #6202 from secondlife/project/game-control
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 ad2ce231fa..19ed6d9bd8 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -1043,6 +1043,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); } |
