added DataField::getCount(), exclude name wrap when fieldIndex is used in SingleDataField::read(), corrected json indent
This commit is contained in:
@@ -249,6 +249,12 @@ class DataField : public AttributedItem {
|
||||
const map<unsigned int, string>& values, map<string, string>* attributes,
|
||||
vector<const SingleDataField*>* fields) const = 0;
|
||||
|
||||
/**
|
||||
* Get the field count (excluding ignored fields).
|
||||
* @return the field count (excluding ignored fields).
|
||||
*/
|
||||
virtual size_t getCount() const = 0;
|
||||
|
||||
/**
|
||||
* Get the specified field name.
|
||||
* @param fieldIndex the index of the field (excluding ignored fields), or -1 for this.
|
||||
@@ -392,6 +398,9 @@ class SingleDataField : public DataField {
|
||||
*/
|
||||
bool hasFullByteOffset(bool after) const;
|
||||
|
||||
// @copydoc
|
||||
size_t getCount() const override { return isIgnored() ? 0 : 1; }
|
||||
|
||||
// @copydoc
|
||||
virtual string getName(ssize_t fieldIndex) const {
|
||||
return isIgnored() || fieldIndex > 0 ? "" : m_name;
|
||||
@@ -628,6 +637,9 @@ class DataFieldSet : public DataField {
|
||||
// @copydoc
|
||||
size_t getLength(PartType partType, size_t maxLength) const override;
|
||||
|
||||
// @copydoc
|
||||
size_t getCount() const override { return m_fields.size() - m_ignoredCount; }
|
||||
|
||||
// @copydoc
|
||||
string getName(ssize_t fieldIndex) const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user