diff options
author | madmaxoft <github@xoft.cz> | 2014-04-01 16:36:00 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-04-01 16:36:00 +0200 |
commit | 1795cca5522476006d33d0c276e27a50659c867a (patch) | |
tree | c4abcc1ac701bbaf092a729a093058601aae1e79 /src/HTTPServer/EnvelopeParser.h | |
parent | Removed the exit-time-destructors flag from clang. (diff) | |
download | cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.gz cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.bz2 cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.lz cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.xz cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.zst cuberite-1795cca5522476006d33d0c276e27a50659c867a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/HTTPServer/EnvelopeParser.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/HTTPServer/EnvelopeParser.h b/src/HTTPServer/EnvelopeParser.h index 6430fbebf..9b6c7f369 100644 --- a/src/HTTPServer/EnvelopeParser.h +++ b/src/HTTPServer/EnvelopeParser.h @@ -19,7 +19,9 @@ public: class cCallbacks { public: - /// Called when a full header line is parsed + virtual ~cCallbacks() {} + + /** Called when a full header line is parsed */ virtual void OnHeaderLine(const AString & a_Key, const AString & a_Value) = 0; } ; @@ -27,40 +29,41 @@ public: cEnvelopeParser(cCallbacks & a_Callbacks); /** Parses the incoming data. - Returns the number of bytes consumed from the input. The bytes not consumed are not part of the envelope header + Returns the number of bytes consumed from the input. The bytes not consumed are not part of the envelope header. + Returns AString::npos on error */ - int Parse(const char * a_Data, int a_Size); + size_t Parse(const char * a_Data, size_t a_Size); - /// Makes the parser forget everything parsed so far, so that it can be reused for parsing another datastream + /** Makes the parser forget everything parsed so far, so that it can be reused for parsing another datastream */ void Reset(void); - /// Returns true if more input is expected for the envelope header + /** Returns true if more input is expected for the envelope header */ bool IsInHeaders(void) const { return m_IsInHeaders; } - /// Sets the IsInHeaders flag; used by cMultipartParser to simplify the parser initial conditions + /** Sets the IsInHeaders flag; used by cMultipartParser to simplify the parser initial conditions */ void SetIsInHeaders(bool a_IsInHeaders) { m_IsInHeaders = a_IsInHeaders; } public: - /// Callbacks to call for the various events + /** Callbacks to call for the various events */ cCallbacks & m_Callbacks; - /// Set to true while the parser is still parsing the envelope headers. Once set to true, the parser will not consume any more data. + /** Set to true while the parser is still parsing the envelope headers. Once set to true, the parser will not consume any more data. */ bool m_IsInHeaders; - /// Buffer for the incoming data until it is parsed + /** Buffer for the incoming data until it is parsed */ AString m_IncomingData; - /// Holds the last parsed key; used for line-wrapped values + /** Holds the last parsed key; used for line-wrapped values */ AString m_LastKey; - /// Holds the last parsed value; used for line-wrapped values + /** Holds the last parsed value; used for line-wrapped values */ AString m_LastValue; - /// Notifies the callback of the key/value stored in m_LastKey/m_LastValue, then erases them + /** Notifies the callback of the key/value stored in m_LastKey/m_LastValue, then erases them */ void NotifyLast(void); - /// Parses one line of header data. Returns true if successful + /** Parses one line of header data. Returns true if successful */ bool ParseLine(const char * a_Data, size_t a_Size); } ; |