added output of used-defined attributes, use const where appropriate, enhanced http global node, added base class AttributedItem

This commit is contained in:
john30
2017-04-09 16:38:40 +02:00
parent c56b0b518f
commit a19a38266a
20 changed files with 1052 additions and 882 deletions
+4 -4
View File
@@ -39,7 +39,7 @@ void contrib_tem_register() {
DataTypeList::getInstance()->add(new TemParamDataType("TEM_P"));
}
result_t TemParamDataType::derive(int divisor, size_t bitCount, NumberDataType* &derived) {
result_t TemParamDataType::derive(int divisor, size_t bitCount, const NumberDataType* &derived) const {
if (divisor == 0) {
divisor = 1;
}
@@ -53,9 +53,9 @@ result_t TemParamDataType::derive(int divisor, size_t bitCount, NumberDataType*
return RESULT_ERR_INVALID_ARG;
}
result_t TemParamDataType::readSymbols(SymbolString& input,
result_t TemParamDataType::readSymbols(const SymbolString& input,
const size_t offset, const size_t length,
ostringstream& output, OutputFormat outputFormat) {
ostringstream& output, OutputFormat outputFormat) const {
unsigned int value = 0;
result_t result = readRawValue(input, offset, length, value);
@@ -92,7 +92,7 @@ result_t TemParamDataType::readSymbols(SymbolString& input,
result_t TemParamDataType::writeSymbols(istringstream& input,
const size_t offset, const size_t length,
SymbolString& output, size_t* usedLength) {
SymbolString& output, size_t* usedLength) const {
unsigned int value;
int grp, num;
string token;
+5 -5
View File
@@ -47,20 +47,20 @@ class TemParamDataType : public NumberDataType {
* @param id the type identifier.
*/
explicit TemParamDataType(const string id)
: NumberDataType(id, 16, 0, 0xffff, 0, 0xffff, 0) {}
: NumberDataType(id, 16, 0, 0xffff, 0, 0xffff, 0, NULL) {}
// @copydoc
result_t derive(int divisor, size_t bitCount, NumberDataType* &derived) override;
result_t derive(int divisor, size_t bitCount, const NumberDataType* &derived) const override;
// @copydoc
result_t readSymbols(SymbolString& input,
result_t readSymbols(const SymbolString& input,
const size_t offset, const size_t length,
ostringstream& output, OutputFormat outputFormat) override;
ostringstream& output, OutputFormat outputFormat) const override;
// @copydoc
result_t writeSymbols(istringstream& input,
const size_t offset, const size_t length,
SymbolString& output, size_t* usedLength) override;
SymbolString& output, size_t* usedLength) const override;
};
/**
+4 -4
View File
@@ -54,7 +54,7 @@ class TestReader : public MappedFileReader {
TestReader(DataFieldTemplates* templates, bool isSet, bool isMasterDest)
: MappedFileReader::MappedFileReader(true), m_templates(templates), m_isSet(isSet), m_isMasterDest(isMasterDest),
m_fields(NULL) {}
result_t getFieldMap(vector<string>& row, string& errorDescription) override {
result_t getFieldMap(vector<string>& row, string& errorDescription) const override {
if (row.empty()) {
row.push_back("*name");
row.push_back("part");
@@ -85,11 +85,11 @@ class TestReader : public MappedFileReader {
const bool m_isSet;
const bool m_isMasterDest;
public:
DataField* m_fields;
const DataField* m_fields;
};
int main() {
DataType* type = DataTypeList::getInstance()->get("TEM_P");
const DataType* type = DataTypeList::getInstance()->get("TEM_P");
if (type == NULL) {
cout << "datatype not registered" << endl;
return 1;
@@ -119,7 +119,7 @@ int main() {
string errorDescription;
vector<string> row;
templates->readLineFromStream(dummystr, errorDescription, "inline", lineNo, row);
DataField* fields = NULL;
const DataField* fields = NULL;
for (size_t i = 0; i < sizeof(checks) / sizeof(checks[0]); i++) {
string check[5] = checks[i];
istringstream isstr(check[0]);