From e8fd27fb0c94de97167eb102b7dc8e7434890521 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 15 May 2020 08:50:27 -0700 Subject: [PATCH] Added IsEmpty property --- BeefLibs/Beefy2D/src/utils/StructuredData.bf | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/BeefLibs/Beefy2D/src/utils/StructuredData.bf b/BeefLibs/Beefy2D/src/utils/StructuredData.bf index 86346a4f..08dfd840 100644 --- a/BeefLibs/Beefy2D/src/utils/StructuredData.bf +++ b/BeefLibs/Beefy2D/src/utils/StructuredData.bf @@ -266,6 +266,32 @@ namespace Beefy.utils get { return GetCurrent().GetType() == typeof(NamedValues); } } + public bool IsEmpty + { + get + { + if (mCurrent.mLastValue != -1) + { + if (mValues[mCurrent.mLastValue] != sEmptySentinel) + return false; + else + { + // We need a (potentially) full value pass if we have sEmptySentinel + int checkValue = mCurrent.mValues.mValueIdx; + while (checkValue != -1) + { + if (mValues[checkValue] != sEmptySentinel) + { + return false; + } + checkValue = mNextValues[checkValue]; + } + } + } + return true; + } + } + public int GetValueCount() { int count = 0;