Skip to content
A Simple Firebase client for Qt/C++
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
firebase.pro
firebasedatabase.cpp
firebasedatabase.h
main.cpp

README.md

firebase

A Simple Firebase client for Qt/C++

Supported Features

Firebase Realtime Database

  • Change listening
  • Get, Put, Post, Patch, Delete requests

Based on Firebase Database REST API

Example usage

#include <QCoreApplication>
#include <QDebug>
#include <QJsonDocument>
#include <firebasedatabase.h>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    const QString& path = "/kozmon.json";
    const QString& baseAddress = "https://objectwheel-a6f9c.firebaseio.com";

    FirebaseDatabase firebaseDatabase(baseAddress);
    firebaseDatabase.listen(path);
    firebaseDatabase.put(path, QJsonDocument::fromJson("{\"kalem\":\"pen\"}"));
    firebaseDatabase.patch(path, QJsonDocument::fromJson("{\"kalem\":\"pencil\"}"));
    firebaseDatabase.patch(path, QJsonDocument::fromJson("{\"defter\":\"notebook\"}"));
    firebaseDatabase.patch(path, QJsonDocument::fromJson("{\"bilgisayar\":\"computer\"}"));
    firebaseDatabase.post(path, QJsonDocument::fromJson("{\"fare\":\"mouse\"}"));
    firebaseDatabase.post(path, QJsonDocument::fromJson("{\"fare\":\"joystick\"}"));
    firebaseDatabase.remove("/kozmon/defter.json");
    firebaseDatabase.get(path);

    QObject::connect(&firebaseDatabase, &FirebaseDatabase::eventOccured,
                     [=] (FirebaseDatabase::Event event, const QString& rootPath, const QJsonDocument& response) {
        qDebug() << "Event occured:\t\t" << event << rootPath << response;
    });
    QObject::connect(&firebaseDatabase, &FirebaseDatabase::requestFinished,
                     [=] (const QJsonDocument& response) {
        qDebug() << "Request finished:\t" << response;
    });

    return a.exec();
}
You can’t perform that action at this time.