diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2024-10-08 17:06:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-08 17:06:20 +0300 |
commit | 6ccae2d0ae977965202ecb45de77e46f8d0312b3 (patch) | |
tree | 0819595c2a50aa7066b0c75b49d3b6c31f5636b9 /indra/llcommon/llsd.cpp | |
parent | ccc7fffb22b347149bf807b9d92677e5616c5017 (diff) | |
parent | 3dca9fc377e855b74a78a5c30464b468dcc82644 (diff) |
Merge branch 'develop' into maxim/lua-nearby-avatars
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); } |