reformat file in Include

This commit is contained in:
Dennis Luxen 2014-05-07 15:37:39 +02:00
parent 5d8b4cb261
commit abd20776a2
4 changed files with 35 additions and 31 deletions

View File

@ -53,7 +53,8 @@ struct FixedPointCoordinate
static double ApproximateEuclideanDistance(const FixedPointCoordinate &c1, static double ApproximateEuclideanDistance(const FixedPointCoordinate &c1,
const FixedPointCoordinate &c2); const FixedPointCoordinate &c2);
static double ApproximateEuclideanDistance(const int lat1, const int lon1, const int lat2, const int lon2); static double
ApproximateEuclideanDistance(const int lat1, const int lon1, const int lat2, const int lon2);
static void convertInternalLatLonToString(const int value, std::string &output); static void convertInternalLatLonToString(const int value, std::string &output);

View File

@ -30,16 +30,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string> #include <string>
namespace http { namespace http
{
struct Header { struct Header
std::string name; {
std::string value; std::string name;
void Clear() { std::string value;
name.clear(); void Clear()
value.clear(); {
} name.clear();
}; value.clear();
}
};
} }
#endif //HTTP_HEADER_H #endif // HTTP_HEADER_H

View File

@ -34,25 +34,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
namespace http { namespace http
{
const char okHTML[] = ""; const char okHTML[] = "";
const char badRequestHTML[] = "{\"status\": 400,\"status_message\":\"Bad Request\"}"; const char badRequestHTML[] = "{\"status\": 400,\"status_message\":\"Bad Request\"}";
const char internalServerErrorHTML[] = "{\"status\": 500,\"status_message\":\"Internal Server Error\"}"; const char internalServerErrorHTML[] =
const char seperators[] = { ':', ' ' }; "{\"status\": 500,\"status_message\":\"Internal Server Error\"}";
const char crlf[] = { '\r', '\n' }; const char seperators[] = {':', ' '};
const char crlf[] = {'\r', '\n'};
const std::string okString = "HTTP/1.0 200 OK\r\n"; const std::string okString = "HTTP/1.0 200 OK\r\n";
const std::string badRequestString = "HTTP/1.0 400 Bad Request\r\n"; const std::string badRequestString = "HTTP/1.0 400 Bad Request\r\n";
const std::string internalServerErrorString = "HTTP/1.0 500 Internal Server Error\r\n"; const std::string internalServerErrorString = "HTTP/1.0 500 Internal Server Error\r\n";
class Reply { class Reply
public: {
enum status_type { public:
ok = 200, enum status_type
badRequest = 400, { ok = 200,
internalServerError = 500 badRequest = 400,
} status; internalServerError = 500 } status;
std::vector<Header> headers; std::vector<Header> headers;
std::vector<boost::asio::const_buffer> toBuffers(); std::vector<boost::asio::const_buffer> toBuffers();
@ -63,11 +64,11 @@ public:
void SetUncompressedSize(); void SetUncompressedSize();
Reply(); Reply();
private:
private:
std::string ToString(Reply::status_type status); std::string ToString(Reply::status_type status);
boost::asio::const_buffer ToBuffer(Reply::status_type status); boost::asio::const_buffer ToBuffer(Reply::status_type status);
}; };
} }
#endif //REPLY_H #endif // REPLY_H

View File

@ -28,11 +28,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef SERVER_PATH_H #ifndef SERVER_PATH_H
#define SERVER_PATH_H #define SERVER_PATH_H
#include <boost/unordered_map.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/unordered_map.hpp>
#include <string> #include <string>
typedef boost::unordered_map<const std::string, boost::filesystem::path> ServerPaths; typedef boost::unordered_map<const std::string, boost::filesystem::path> ServerPaths;
#endif //SERVER_PATH_H #endif // SERVER_PATH_H