163 lines
4.1 KiB
C++
163 lines
4.1 KiB
C++
// **************************************************************************
|
|
//
|
|
// (C) Copyright 2009 Swiss SIMTEC AG
|
|
//
|
|
// **************************************************************************
|
|
//
|
|
// $HeadURL$
|
|
// $LastChangedBy$
|
|
// $LastChangedDate$
|
|
// $LastChangedRevision$
|
|
//
|
|
// **************************************************************************
|
|
|
|
#pragma once
|
|
|
|
#include <QStringList>
|
|
#include <QVector>
|
|
#include "logger.h"
|
|
|
|
namespace N_LogView
|
|
{
|
|
class LogViewXdrElement;
|
|
class LogViewField
|
|
{
|
|
public:
|
|
enum E_FieldKind
|
|
{
|
|
e_FieldKindBorder,
|
|
e_FieldKindEdit,
|
|
e_FieldKindTab,
|
|
e_FieldKindTabChild,
|
|
e_FieldKindPodArray,
|
|
e_FieldKindPodArrayChild
|
|
};
|
|
|
|
|
|
LogViewField(const QString& a_name, const E_FieldKind a_kind, const LogViewXdrElement* a_xdrElement);
|
|
virtual ~LogViewField();
|
|
|
|
LogViewField *clone(int arrayIdx) const;
|
|
|
|
QString cleanName() const { return makeClean(m_Name); }
|
|
QString name() const { return m_Name; }
|
|
void setName(const QString &newVal) { m_Name = newVal; }
|
|
|
|
|
|
void addChild(LogViewField* a_child);
|
|
void removeLastChild();
|
|
LogViewField *child(int arrayIdx);
|
|
int childCount() const { return m_Child.size(); }
|
|
|
|
QString type() const { return m_type; }
|
|
void setType(const QString &type) { m_type = type; }
|
|
|
|
LogViewField::E_FieldKind kind() const { return m_Kind; }
|
|
|
|
void addValue(const QString &value);
|
|
void addValueBinaryHex(const QString &value);
|
|
|
|
/**
|
|
* Returns the value at position a_index converted to a string. If the field is a
|
|
* date-time-field, the returned value is converted to a string containing date
|
|
* and time, execpt when a_doNotMakeSpecialConversions is set to true, the unix-
|
|
* time will be returned as value.
|
|
*
|
|
* @param a_index
|
|
* @param a_doNotMakeSpecialConversions
|
|
*/
|
|
QString value(int arrayIdx, const bool a_doNotMakeSpecialConversions = false) const;
|
|
int valueListSize() const { return m_ValueList.size(); }
|
|
|
|
|
|
bool isRightAligned() const { return m_IsRightAligned; }
|
|
void setIsRightAligned(bool newVal) { m_IsRightAligned = newVal; }
|
|
|
|
|
|
QString toolTipText() const { return m_ToolTipText; }
|
|
void setToolTipText(const QString &newVal) { m_ToolTipText = newVal; }
|
|
|
|
|
|
int64_t getHighestValue() const;
|
|
int64_t getLowestValue() const;
|
|
|
|
/**
|
|
*
|
|
* @param a_indent
|
|
*/
|
|
void dump(const QString &a_indent = QString()) const;
|
|
|
|
/**
|
|
* Makes the text <a_uncleanText> pretty for human readable. It does following:
|
|
* - generates umlaute (ä, ö, ü)
|
|
* - removes _rt at end
|
|
* - replaces _ with space
|
|
* - uppercase of every word
|
|
*
|
|
* @param a_uncleanText
|
|
*/
|
|
static QString makeClean(const QString &text);
|
|
|
|
|
|
int size() const { return m_Size; }
|
|
void setSize(int newVal) { m_Size = newVal; }
|
|
|
|
|
|
const LogViewXdrElement* xdrElement() const { return m_XdrElement; }
|
|
|
|
/**
|
|
* returns true if the field is a date-time
|
|
*/
|
|
bool isDateTimeField() const;
|
|
bool isMSecsField() const;
|
|
|
|
|
|
uint16_t maxArraySize() const { return m_MaxArraySize; }
|
|
void setMaxArraySize(uint16_t newVal, const bool a_isDynamic);
|
|
|
|
/**
|
|
* True if the array is dynamic.
|
|
*/
|
|
bool isDynamicArray() const { return m_IsDynamicArray; }
|
|
|
|
|
|
bool hasContent() const { return m_HasContent; }
|
|
void setHasContent(bool newVal) { m_HasContent = newVal; }
|
|
|
|
void setDeleteXdr(bool bDelete) { m_bDeleteXdr = bDelete; }
|
|
|
|
void setJsonPath(const QStringList &path) { m_jsonPath = path; }
|
|
QStringList jsonPath() const { return m_jsonPath; }
|
|
|
|
protected:
|
|
|
|
QString m_Name;
|
|
QString m_type;
|
|
QStringList m_ValueList;
|
|
QStringList m_jsonPath;
|
|
bool m_IsRightAligned;
|
|
QString m_ToolTipText;
|
|
uint16_t m_Offset;
|
|
int m_Size;
|
|
uint16_t m_MaxArraySize;
|
|
/**
|
|
* True if the array is dynamic.
|
|
*/
|
|
bool m_IsDynamicArray;
|
|
bool m_HasContent;
|
|
bool m_bDeleteXdr;
|
|
QVector<LogViewField*> m_Child;
|
|
|
|
E_FieldKind m_Kind;
|
|
|
|
const LogViewXdrElement *m_XdrElement;
|
|
|
|
private:
|
|
/**
|
|
* The logger object
|
|
*/
|
|
NGL::INGLLogger &m_logger;
|
|
|
|
};
|
|
}
|