From c520fab5011dfa5bcaf493483f21773215807846 Mon Sep 17 00:00:00 2001 From: Evan Klitzke Date: Wed, 22 Nov 2017 14:07:54 -0800 Subject: [PATCH] syntax highlight the README code examples --- README.md | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 5c93785..4a6b3e8 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ This library, lev, is a very simple API in C++ that encapsulates commonly used f to stay close to the libevent API concepts except when there is confusion. It simplifies life-times of objects. The callback function signatures remain identical--but lev objects can be constructed within the callback functions. -``` - EvHttpRequest evreq(req); +```c++ +EvHttpRequest evreq(req); ``` lev is actually just a couple of header file, lev.h, and levhttp.h (if you need a httpserver). Just include it in your application and start using all the classes--no need to build or install: -``` +```c++ class IpAddr; class EvBaseLoop; class EvEvent; @@ -31,29 +31,29 @@ class EvHttpServer; Code: An HTTP server using lev. Look at the example section for more. -``` - #include "lev.h" - #include "levhttp.h" - using namespace lev; - - static - void onHttpHello(struct evhttp_request* req, void* arg) - { - EvHttpRequest evreq(req); - evreq.output().printf("<..>Hello World!<..>"); - evreq.sendReply(200, "OK"); - } - - int main(int argc, char** argv) - { - EvBaseLoop base; - EvHttpServer http(base); - - http.addRoute("/hello", onHttpHello); - http.bind("127.0.0.1", 8080); - - base.loop(); - - return 0; - } +```c++ +#include "lev.h" +#include "levhttp.h" +using namespace lev; + +static +void onHttpHello(struct evhttp_request* req, void* arg) +{ + EvHttpRequest evreq(req); + evreq.output().printf("<..>Hello World!<..>"); + evreq.sendReply(200, "OK"); +} + +int main(int argc, char** argv) +{ + EvBaseLoop base; + EvHttpServer http(base); + + http.addRoute("/hello", onHttpHello); + http.bind("127.0.0.1", 8080); + + base.loop(); + + return 0; +} ```