better constant name

This commit is contained in:
john30
2020-01-11 12:41:21 +01:00
parent 3b569a01e1
commit f92a047c09
4 changed files with 16 additions and 16 deletions
+2 -2
View File
@@ -66,7 +66,7 @@ result_t TemParamDataType::readSymbols(size_t offset, size_t length, const Symbo
if (outputFormat & OF_JSON) { if (outputFormat & OF_JSON) {
*output << "null"; *output << "null";
} else { } else {
*output << nullptr_VALUE; *output << NULL_VALUE;
} }
return RESULT_OK; return RESULT_OK;
} }
@@ -94,7 +94,7 @@ result_t TemParamDataType::writeSymbols(const size_t offset, const size_t length
unsigned int value; unsigned int value;
unsigned int grp, num; unsigned int grp, num;
if (input->str() == nullptr_VALUE) { if (input->str() == NULL_VALUE) {
value = m_replacement; // replacement value value = m_replacement; // replacement value
} else { } else {
string token; string token;
+2 -2
View File
@@ -752,7 +752,7 @@ result_t ValueListDataField::readSymbols(const SymbolString& input, size_t offse
if (outputFormat & OF_JSON) { if (outputFormat & OF_JSON) {
*output << "null"; *output << "null";
} else if (value == m_dataType->getReplacement()) { } else if (value == m_dataType->getReplacement()) {
*output << nullptr_VALUE; *output << NULL_VALUE;
} }
} else if (outputFormat & OF_NUMERIC) { } else if (outputFormat & OF_NUMERIC) {
*output << setw(0) << dec << value; *output << setw(0) << dec << value;
@@ -776,7 +776,7 @@ result_t ValueListDataField::writeSymbols(size_t offset, istringstream* input,
SymbolString* output, size_t* usedLength) const { SymbolString* output, size_t* usedLength) const {
const NumberDataType* numType = reinterpret_cast<const NumberDataType*>(m_dataType); const NumberDataType* numType = reinterpret_cast<const NumberDataType*>(m_dataType);
const string inputStr = input->str(); const string inputStr = input->str();
if (isIgnored() || inputStr == nullptr_VALUE) { if (isIgnored() || inputStr == NULL_VALUE) {
// replacement value // replacement value
return numType->writeRawValue(numType->getReplacement(), offset, m_length, output, usedLength); return numType->writeRawValue(numType->getReplacement(), offset, m_length, output, usedLength);
} }
+10 -10
View File
@@ -243,13 +243,13 @@ result_t DateTimeDataType::readSymbols(size_t offset, size_t length, const Symbo
case 2: // date only case 2: // date only
if (!hasFlag(REQ) && symbol == m_replacement) { if (!hasFlag(REQ) && symbol == m_replacement) {
if (i + 1 != length) { if (i + 1 != length) {
*output << nullptr_VALUE << "."; *output << NULL_VALUE << ".";
break; break;
} else if (last == m_replacement) { } else if (last == m_replacement) {
if (length == 2) { // number of days since 01.01.1900 if (length == 2) { // number of days since 01.01.1900
*output << nullptr_VALUE << "."; *output << NULL_VALUE << ".";
} }
*output << nullptr_VALUE; *output << NULL_VALUE;
break; break;
} }
} }
@@ -282,13 +282,13 @@ result_t DateTimeDataType::readSymbols(size_t offset, size_t length, const Symbo
case 1: // time only case 1: // time only
if (!hasFlag(REQ) && symbol == m_replacement) { if (!hasFlag(REQ) && symbol == m_replacement) {
if (length == 1) { // truncated time if (length == 1) { // truncated time
*output << nullptr_VALUE << ":" << nullptr_VALUE; *output << NULL_VALUE << ":" << NULL_VALUE;
break; break;
} }
if (i > 0) { if (i > 0) {
*output << ":"; *output << ":";
} }
*output << nullptr_VALUE; *output << NULL_VALUE;
break; break;
} }
if (hasFlag(SPE)) { // minutes since midnight if (hasFlag(SPE)) { // minutes since midnight
@@ -378,7 +378,7 @@ result_t DateTimeDataType::writeSymbols(size_t offset, size_t length, istringstr
if (input->eof() || !getline(*input, token, '.')) { if (input->eof() || !getline(*input, token, '.')) {
return RESULT_ERR_EOF; // incomplete return RESULT_ERR_EOF; // incomplete
} }
if (!hasFlag(REQ) && token == nullptr_VALUE) { if (!hasFlag(REQ) && token == NULL_VALUE) {
value = m_replacement; value = m_replacement;
break; break;
} }
@@ -431,7 +431,7 @@ result_t DateTimeDataType::writeSymbols(size_t offset, size_t length, istringstr
if (input->eof() || !getline(*input, token, LENGTH_SEPARATOR)) { if (input->eof() || !getline(*input, token, LENGTH_SEPARATOR)) {
return RESULT_ERR_EOF; // incomplete return RESULT_ERR_EOF; // incomplete
} }
if (!hasFlag(REQ) && token == nullptr_VALUE) { if (!hasFlag(REQ) && token == NULL_VALUE) {
value = m_replacement; value = m_replacement;
if (length == 1) { // truncated time if (length == 1) { // truncated time
if (i == 0) { if (i == 0) {
@@ -654,7 +654,7 @@ result_t NumberDataType::readSymbols(size_t offset, size_t length, const SymbolS
if (outputFormat & OF_JSON) { if (outputFormat & OF_JSON) {
*output << "null"; *output << "null";
} else { } else {
*output << nullptr_VALUE; *output << NULL_VALUE;
} }
return RESULT_OK; return RESULT_OK;
} }
@@ -700,7 +700,7 @@ result_t NumberDataType::readSymbols(size_t offset, size_t length, const SymbolS
if (outputFormat & OF_JSON) { if (outputFormat & OF_JSON) {
*output << "null"; *output << "null";
} else { } else {
*output << nullptr_VALUE; *output << NULL_VALUE;
} }
return RESULT_OK; return RESULT_OK;
} }
@@ -806,7 +806,7 @@ result_t NumberDataType::writeSymbols(size_t offset, size_t length, istringstrea
unsigned int value; unsigned int value;
const string inputStr = input->str(); const string inputStr = input->str();
if (!hasFlag(REQ) && (isIgnored() || inputStr == nullptr_VALUE)) { if (!hasFlag(REQ) && (isIgnored() || inputStr == NULL_VALUE)) {
value = m_replacement; // replacement value value = m_replacement; // replacement value
} else if (inputStr.empty()) { } else if (inputStr.empty()) {
return RESULT_ERR_EOF; // input too short return RESULT_ERR_EOF; // input too short
+2 -2
View File
@@ -58,7 +58,7 @@ using std::ostringstream;
#define LENGTH_SEPARATOR ':' #define LENGTH_SEPARATOR ':'
/** the replacement string for undefined values (in UI and CSV). */ /** the replacement string for undefined values (in UI and CSV). */
#define nullptr_VALUE "-" #define NULL_VALUE "-"
/** the separator character used between fields (in UI only). */ /** the separator character used between fields (in UI only). */
#define UI_FIELD_SEPARATOR ';' #define UI_FIELD_SEPARATOR ';'
@@ -134,7 +134,7 @@ enum PartType {
/** bit flag for @a DataType: fixed width formatting. */ /** bit flag for @a DataType: fixed width formatting. */
#define FIX 0x20 #define FIX 0x20
/** bit flag for @a DataType: value may not be nullptr. */ /** bit flag for @a DataType: value may not be NULL. */
#define REQ 0x40 #define REQ 0x40
/** bit flag for @a DataType: binary representation is hex converted to decimal and interpreted as 2 digits /** bit flag for @a DataType: binary representation is hex converted to decimal and interpreted as 2 digits