From f02eee616a041a5034bdace1c7258248bf8eeb15 Mon Sep 17 00:00:00 2001 From: john30 Date: Sun, 18 Oct 2015 12:08:28 +0200 Subject: [PATCH] allow querying for first field in hasField() --- src/lib/ebus/data.cpp | 4 ++-- src/lib/ebus/data.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/ebus/data.cpp b/src/lib/ebus/data.cpp index 7f51947b..76c2828e 100644 --- a/src/lib/ebus/data.cpp +++ b/src/lib/ebus/data.cpp @@ -571,7 +571,7 @@ result_t StringDataField::derive(string name, string comment, bool StringDataField::hasField(const char* fieldName, bool numeric) { - return !numeric && fieldName==m_name; + return !numeric && (fieldName==NULL || fieldName==m_name); } void StringDataField::dump(ostream& output) @@ -841,7 +841,7 @@ bool NumericDataField::hasFullByteOffset(bool after) bool NumericDataField::hasField(const char* fieldName, bool numeric) { - return numeric && fieldName==m_name; + return numeric && (fieldName==NULL || fieldName==m_name); } void NumericDataField::dump(ostream& output) diff --git a/src/lib/ebus/data.h b/src/lib/ebus/data.h index 238fd532..859e726b 100644 --- a/src/lib/ebus/data.h +++ b/src/lib/ebus/data.h @@ -225,7 +225,7 @@ public: /** * Return whether the field is available. - * @param fieldName the name of the field to find. + * @param fieldName the name of the field to find, or NULL for any. * @param numeric true for a numeric field, false for a string field. * @return true if the field is available. */