aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/compactbinary.h6
-rw-r--r--zencore/include/zencore/compactbinarypackage.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/zencore/include/zencore/compactbinary.h b/zencore/include/zencore/compactbinary.h
index 2dc9c0ce0..839218940 100644
--- a/zencore/include/zencore/compactbinary.h
+++ b/zencore/include/zencore/compactbinary.h
@@ -821,6 +821,9 @@ public:
/** Construct an array from an array field. No type check is performed! */
static inline CbArrayView FromFieldView(const CbFieldView& Field) { return CbArrayView(Field); }
+ /** Whether the array has any fields. */
+ inline explicit operator bool() const { return Num() > 0; }
+
/** Returns the size of the array in bytes if serialized by itself with no name. */
ZENCORE_API uint64_t GetSize() const;
@@ -903,6 +906,9 @@ public:
/** Construct an object from an object field. No type check is performed! */
static inline CbObjectView FromFieldView(const CbFieldView& Field) { return CbObjectView(Field); }
+ /** Whether the object has any fields. */
+ ZENCORE_API explicit operator bool() const;
+
/** Returns the size of the object in bytes if serialized by itself with no name. */
ZENCORE_API uint64_t GetSize() const;
diff --git a/zencore/include/zencore/compactbinarypackage.h b/zencore/include/zencore/compactbinarypackage.h
index d7a8ea7fc..493eb2ba7 100644
--- a/zencore/include/zencore/compactbinarypackage.h
+++ b/zencore/include/zencore/compactbinarypackage.h
@@ -193,7 +193,7 @@ public:
inline explicit operator bool() const { return !IsNull(); }
/** Whether the package has an empty object and no attachments. */
- inline bool IsNull() const { return !Object.CreateIterator() && Attachments.size() == 0; }
+ inline bool IsNull() const { return !Object && Attachments.size() == 0; }
/** Returns the compact binary object for the package. */
inline const CbObject& GetObject() const { return Object; }