Module: check_mk
Branch: master
Commit: 5c14e320e4cc0c56887496c47be82d8a50b39c37
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5c14e320e4cc0c…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Jan 14 11:29:16 2016 +0100
Removed Column::setExtraOffset, it was just a lazy way to extend the constructor.
---
livestatus/src/AttributelistColumn.h | 21 +++++++++++++--------
livestatus/src/Column.cc | 11 ++++++-----
livestatus/src/Column.h | 8 +++++---
livestatus/src/IntColumn.h | 12 +++++++-----
4 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/livestatus/src/AttributelistColumn.h b/livestatus/src/AttributelistColumn.h
index 72340ac..bb0be54 100644
--- a/livestatus/src/AttributelistColumn.h
+++ b/livestatus/src/AttributelistColumn.h
@@ -25,7 +25,7 @@
#ifndef AttributelistColumn_h
#define AttributelistColumn_h
-#include "config.h" // IWYU pragma: keep
+#include "config.h" // IWYU pragma: keep
#include <stdint.h>
#include <string>
#include "Column.h"
@@ -39,23 +39,28 @@ class Query;
Columns of the type COLTYPE_INT to be of that type.
*/
-class AttributelistColumn : public IntColumn
-{
+class AttributelistColumn : public IntColumn {
int _offset;
bool _show_list;
+
public:
- AttributelistColumn(std::string name, std::string description, int offset, int
indirect_offset, bool show_list)
- : IntColumn(name, description, indirect_offset), _offset(offset),
_show_list(show_list) {}
+ AttributelistColumn(std::string name, std::string description, int offset,
+ int indirect_offset, bool show_list,
+ int extra_offset = -1)
+ : IntColumn(name, description, indirect_offset, extra_offset)
+ , _offset(offset)
+ , _show_list(show_list)
+ {
+ }
- /* API of Column */
+ // API of Column
int type() override { return _show_list ? COLTYPE_LIST : COLTYPE_INT; }
std::string valueAsString(void *data, Query *) override;
void output(void *, Query *) override;
Filter *createFilter(int opid, char *value) override;
- /* API of IntColumn */
+ // API of IntColumn
int32_t getValue(void *data, Query *) override { return getValue(data); }
-
unsigned long getValue(void *data);
};
diff --git a/livestatus/src/Column.cc b/livestatus/src/Column.cc
index 5e570a4..354b784 100644
--- a/livestatus/src/Column.cc
+++ b/livestatus/src/Column.cc
@@ -27,11 +27,12 @@
using std::string;
-Column::Column(string name, string description, int indirect_offset)
- : _name(name)
- , _description(description)
- , _indirect_offset(indirect_offset)
- , _extra_offset(-1)
+Column::Column(string name, string description, int indirect_offset,
+ int extra_offset)
+ : _name(name)
+ , _description(description)
+ , _indirect_offset(indirect_offset)
+ , _extra_offset(extra_offset)
{
}
diff --git a/livestatus/src/Column.h b/livestatus/src/Column.h
index 9c4a56b..92b0ca1 100644
--- a/livestatus/src/Column.h
+++ b/livestatus/src/Column.h
@@ -49,17 +49,19 @@ class Column
int _extra_offset;
public:
- Column(std::string name, std::string description, int indirect_offset);
+ Column(std::string name, std::string description, int indirect_offset,
+ int extra_offset = -1);
virtual ~Column() {}
+
const char *name() const { return _name.c_str(); }
const char *description() const { return _description.c_str(); }
+ void *shiftPointer(void *data);
+
virtual std::string valueAsString(void *, Query *) { return "invalid"; }
virtual int type() = 0;
virtual void output(void *data, Query *) = 0;
virtual bool mustDelete() { return false; } // true for dynamic Columns to be deleted
after Query
virtual Filter *createFilter(int, char *) { return 0; }
- void *shiftPointer(void *data);
- void setExtraOffset(int o) { _extra_offset = o; }
};
#endif // Column_h
diff --git a/livestatus/src/IntColumn.h b/livestatus/src/IntColumn.h
index 0d9ff8f..e47ff79 100644
--- a/livestatus/src/IntColumn.h
+++ b/livestatus/src/IntColumn.h
@@ -25,7 +25,7 @@
#ifndef IntColumn_h
#define IntColumn_h
-#include "config.h" // IWYU pragma: keep
+#include "config.h" // IWYU pragma: keep
#include <stdint.h>
#include <string>
#include "Column.h"
@@ -33,11 +33,13 @@ class Filter;
class Query;
-class IntColumn : public Column
-{
+class IntColumn : public Column {
public:
- IntColumn(std::string name, std::string description, int indirect_offset)
- : Column(name, description, indirect_offset) {}
+ IntColumn(std::string name, std::string description, int indirect_offset,
+ int extra_offset = -1)
+ : Column(name, description, indirect_offset, extra_offset)
+ {
+ }
virtual int32_t getValue(void *data, Query *) = 0;
void output(void *, Query *) override;
int type() override { return COLTYPE_INT; }