From 84ab3caa172fc3f4ec7085135964173c8eed5f84 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 12 Apr 2015 17:39:31 +0200 Subject: Introduce HandlerInfo::hadData flag --- src/core/parser/stack/Stack.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/core/parser/stack/Stack.cpp b/src/core/parser/stack/Stack.cpp index c67f43c..ef503f7 100644 --- a/src/core/parser/stack/Stack.cpp +++ b/src/core/parser/stack/Stack.cpp @@ -116,6 +116,11 @@ public: */ bool hadDefaultField : 1; + /** + * Set to true once data was passed to the handler. + */ + bool hadData : 1; + /** * Set to false, if the handler is not greedy (true is the default value). * If false, the handler will only be passed one piece of "data" at most. @@ -194,6 +199,7 @@ HandlerInfo::HandlerInfo(std::shared_ptr handler) inImplicitDefaultField(false), inValidField(false), hadDefaultField(false), + hadData(false), greedy(true) { } @@ -211,6 +217,7 @@ HandlerInfo::HandlerInfo(bool implicit, bool inField, bool inDefaultField, inImplicitDefaultField(inImplicitDefaultField), inValidField(true), hadDefaultField(false), + hadData(false), greedy(true) { } @@ -880,6 +887,9 @@ bool StackImpl::handleData() loggerFork.log(ex); } + // Update the "hadData" flag + info.hadData = info.hadData || valid; + // Reset the logger instance of the handler as soon as possible info.handler->resetLogger(); -- cgit v1.2.3