1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /***************************************************************************
- * Copyright (C) 2009, 2010 by Axel Jaeger <axeljaeger@googlemail.com> *
- * *
- * This file is part of Glowworm. *
- * *
- * Glowworm is free software: you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation, version 3 of the License. *
- * *
- * Glowworm is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with Glowworm. If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
- #ifndef HTTPRESPONSE_H
- #define HTTPRESPONSE_H
- #include <QString>
- class QIODevice;
- class HttpResponse
- {
- public:
- enum HttpStatusCode {
- HttpOK = 200,
- HttpForbidden = 403,
- HttpFileNotFound = 404,
- HttpInternalServerError = 500
- };
- HttpResponse();
- ~HttpResponse();
- QIODevice* outputDevice() const;
- void setOutputDevice(QIODevice* device);
- void setStatusCode(HttpStatusCode sc);
- HttpStatusCode statusCode() const;
- void setMimeType(const QString & mimeType);
- QString mimeType() const;
- int contentLength() const;
- void setContentLength(int nsize);
- void sendHeader();
- bool headerSent() const;
- static QString statusVerbose(HttpStatusCode sc);
- private:
- QIODevice* m_outputDevice;
- HttpStatusCode m_statusCode;
- QString m_mimeType;
- int m_contentLength;
- bool m_headerSent;
- };
- #endif // HTTPRESPONSE_H
|