do not print conditions prefix with "find -f"

This commit is contained in:
john30
2015-12-31 12:11:37 +01:00
parent 1074989fa1
commit af997ea9a2
3 changed files with 17 additions and 14 deletions
+1 -1
View File
@@ -894,7 +894,7 @@ int main(int argc, char* argv[])
} }
if (result == RESULT_OK && opt.checkConfig > 1) { if (result == RESULT_OK && opt.checkConfig > 1) {
logNotice(lf_main, "Configuration dump:"); logNotice(lf_main, "Configuration dump:");
s_messageMap->dump(cout); s_messageMap->dump(cout, true);
} }
delete s_messageMap; delete s_messageMap;
s_messageMap = NULL; s_messageMap = NULL;
+9 -9
View File
@@ -641,7 +641,7 @@ bool Message::isLessPollWeight(const Message* other)
return false; return false;
} }
void Message::dump(ostream& output, vector<size_t>* columns) void Message::dump(ostream& output, vector<size_t>* columns, bool withConditions)
{ {
bool first = true, all = columns==NULL; bool first = true, all = columns==NULL;
size_t end = all ? 9 : columns->size(); size_t end = all ? 9 : columns->size();
@@ -652,15 +652,15 @@ void Message::dump(ostream& output, vector<size_t>* columns)
output << FIELD_SEPARATOR; output << FIELD_SEPARATOR;
} }
size_t column = all ? i : (*columns)[i]; size_t column = all ? i : (*columns)[i];
dumpColumn(output, column); dumpColumn(output, column, withConditions);
} }
} }
void Message::dumpColumn(ostream& output, size_t column) void Message::dumpColumn(ostream& output, size_t column, bool withConditions)
{ {
switch (column) { switch (column) {
case 0: // type case 0: // type
if (m_condition!=NULL) { if (withConditions && m_condition!=NULL) {
m_condition->dump(output); m_condition->dump(output);
} }
if (m_isPassive) { if (m_isPassive) {
@@ -914,10 +914,10 @@ result_t ChainedMessage::storeLastData(const PartType partType, SymbolString& da
return result; return result;
} }
void ChainedMessage::dumpColumn(ostream& output, size_t column) void ChainedMessage::dumpColumn(ostream& output, size_t column, bool withConditions)
{ {
if (column!=7) { if (column!=7) {
Message::dumpColumn(output, column); Message::dumpColumn(output, column, withConditions);
return; return;
} }
bool first = true; bool first = true;
@@ -1614,7 +1614,7 @@ Message* MessageMap::getNextPoll()
return ret; return ret;
} }
void MessageMap::dump(ostream& output) void MessageMap::dump(ostream& output, bool withConditions)
{ {
bool first = true; bool first = true;
for (map<string, vector<Message*> >::iterator it = m_messagesByName.begin(); it != m_messagesByName.end(); it++) { for (map<string, vector<Message*> >::iterator it = m_messagesByName.begin(); it != m_messagesByName.end(); it++) {
@@ -1629,7 +1629,7 @@ void MessageMap::dump(ostream& output)
first = false; first = false;
else else
output << endl; output << endl;
message->dump(output); message->dump(output, NULL, withConditions);
} }
} else { } else {
Message* message = getFirstAvailable(it->second); Message* message = getFirstAvailable(it->second);
@@ -1639,7 +1639,7 @@ void MessageMap::dump(ostream& output)
first = false; first = false;
else else
output << endl; output << endl;
message->dump(output); message->dump(output, NULL, withConditions);
} }
} }
if (!first) if (!first)
+7 -4
View File
@@ -413,8 +413,9 @@ public:
* Write the message definition or parts of it to the @a ostream. * Write the message definition or parts of it to the @a ostream.
* @param output the @a ostream to append the formatted value to. * @param output the @a ostream to append the formatted value to.
* @param columns the list of column indexes to write, or NULL for all. * @param columns the list of column indexes to write, or NULL for all.
* @param withConditions whether to include the optional conditions prefix.
*/ */
void dump(ostream& output, vector<size_t>* columns=NULL); void dump(ostream& output, vector<size_t>* columns=NULL, bool withConditions=false);
protected: protected:
@@ -422,8 +423,9 @@ protected:
* Write the specified column to the @a ostream. * Write the specified column to the @a ostream.
* @param output the @a ostream to append the formatted value to. * @param output the @a ostream to append the formatted value to.
* @param column the column indexes to write. * @param column the column indexes to write.
* @param withConditions whether to include the optional conditions prefix.
*/ */
virtual void dumpColumn(ostream& output, size_t column); virtual void dumpColumn(ostream& output, size_t column, bool withConditions);
/** the optional circuit name. */ /** the optional circuit name. */
const string m_circuit; const string m_circuit;
@@ -571,7 +573,7 @@ public:
protected: protected:
// @copydoc // @copydoc
virtual void dumpColumn(ostream& output, size_t column); virtual void dumpColumn(ostream& output, size_t column, bool withConditions);
private: private:
@@ -984,8 +986,9 @@ public:
/** /**
* Write the message definitions to the @a ostream. * Write the message definitions to the @a ostream.
* @param output the @a ostream to append the formatted messages to. * @param output the @a ostream to append the formatted messages to.
* @param withConditions whether to include the optional conditions prefix.
*/ */
void dump(ostream& output); void dump(ostream& output, bool withConditions=false);
private: private: