3 #include <boost/logic/tribool.hpp> 4 #include <boost/tuple/tuple.hpp> 139 template <
typename InputIterator>
141 InputIterator begin, InputIterator end)
143 Consume_Result result = c_res_indeterminate;
144 while (begin != end && (result == c_res_indeterminate))
146 result = consume(req, *begin++);
148 if(begin != end && result == c_res_code_body)
151 int nOldSize = req.
m_code.size();
152 int nByteCount = end-begin;
153 if(req.
m_nLength < (nOldSize+nByteCount))
157 req.
m_code.resize(nOldSize+nByteCount);
158 memcpy(&(req.
m_code[nOldSize]), begin, nByteCount);
159 begin = begin + nByteCount;
165 if(result == c_res_true)
170 boost::tribool result_ =
true;
171 return boost::make_tuple(result_, begin);
173 else if(result == c_res_false)
175 boost::tribool result_ =
false;
176 return boost::make_tuple(result_, begin);
180 boost::tribool result_ = boost::indeterminate;
181 return boost::make_tuple(result_, begin);
187 Consume_Result consume(
NPLMsgIn& req,
char input);
196 static bool is_char(
int c);
199 static bool is_ctl(
int c);
202 static bool is_tspecial(
int c);
205 static bool is_digit(
int c);
std::string m_code
msg body
Definition: NPLMsgIn.h:26
define this to enable debugging of NPL code in visual studio
Definition: INPL.h:9
int m_nLength
number of bytes in m_code
Definition: NPLMsgIn.h:24
Parser for incoming requests.
Definition: NPLMsgIn_parser.h:118
NPLMsgIn_parser()
Construct ready to parse the NPLMsgIn method.
Definition: NPLMsgIn_parser.cpp:17
boost::tuple< boost::tribool, InputIterator > parse(NPLMsgIn &req, InputIterator begin, InputIterator end)
Parse some data.
Definition: NPLMsgIn_parser.h:140
A NPL msg received from a socket.
Definition: NPLMsgIn.h:8
void reset()
Reset to initial parser state.
Definition: NPLMsgIn_parser.cpp:22