Cutelyst 0.6.0 is released

Cutelyst, the Qt/C++ web framework just got another step into API stabilization.

Since 0.3.0 I’ve been trying to take the most request per second out of it, and because of that I decided to replace most QStrings with QByteArrays, the allocation call is indeed simpler in QByteArray but since most of Qt use QString for strings it started to create a problem rather than solving one. Grantlee didn’t play nice with QByteArray breaking ifequal and in the end some implicit conversions from UTF-8 were triggered.

So on 0.6.0 I’ve replaced all QByteArray usage in favor of QString, and from the benchmarks of hello world the difference is really negligible.

Another big change I actually took today was to change the Headers class that is used on Request and Response, the keys stored there were always in camel-case style and split by dashes, and if you want to get say the User-Agent in a Grantlee template it won’t work as dashes will break the variable name, so now all keys are lower casa and words are separated by underscores. Allowing for {{ ctx.request.headers.user_agent }} in Grantlee templates.

Some changes were also made to make it behave more close to what Catalyst does, and fixed a bunch of bugs from last release.

On my TODO list still need to:
Write a chained dispatcher to allow a more flexible way of dispatching.
Write tutorials, yeah this is boring…
Write QML integration to allow for writing the application logic in QML too!

This last one would allow for something like this:

Application {
    Controller {
        Action {
            attributes: ":Path(hello)"
            onRequest: {
                ctx.response.body = "Hello World!"

Download here

Have fun!

Cutelyst 0.6.0 is released

5 thoughts on “Cutelyst 0.6.0 is released

  1. Well. QML web-servers. Now that would be very interesting.
    After that, all we need would be for qmlweb to be a bit more polished and we’d be able to write complete web application using only QML and Javascript. Oh, and look at that: qmlweb *is* moving forward (github Plaristote/qmlweb) !

    1. dantti says:

      Yes, that is indeed something quite interesting, there could be a Cutelyst::View subclass which has the logic to render the needed HTML for qmlweb to use 🙂

  2. Hi Dantti, CuteLyst is quite interesting. I have one question though, this is relatively a new framework, but why didn’t you go with Modern C++ approach. I see, raw pointers in your tutorial which could be avoided.
    As every C++ expert out there advises on using Smart Pointers and with the new C++11/14 standard language features, is it not good to start using them as early as possible!!

    Nevertheless, this is a nice project. And I have been looking into C++ Crow as well. You can have a look at it here

    1. dantti says:

      Smart pointers aren´t a modern C++ approach, their are only part of a recent C++11 standard, Qt has had smart pointers for some time already and thus even Qt doesn´t use them everywhere.
      Cutelyst API isn´t written in stone yet so if you have a suggestion from where do you think it makes sense you can convince me otherwise, at the moment I prefer simplicity over a sense of safeness, if the library user deletes a Context pointer it´s their app which will crash, I for instance use some C++11 features like variables initialization, lambdas and the new Qt connect way which requires C++11.
      I just took a look at the crow, it seems interesting but I like Qt core stuff over std.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s