Table of Contents
In this chapter I shall guide you through the writing of a small but complete
quince application. We'll do it all in one source file. So create gettingstarted.cpp
in your text editor, and let's begin.
#include <stdint.h> #include <iostream> #include <quince/quince.h> #include <quince_postgresql/database.h> // Delete this line if you don't use PostgreSQL #include <quince_sqlite/database.h> // Delete this line if you don't use sqlite using namespace quince; namespace cinemascope {
quince/quince.h
is an umbrella header that collects
all the headers you'll ever need from the quince library.
All the identifiers that quince defines are in namespace quince
[2] , so the using
directive brings them all into scope. I acknowledge that using
directives are dubious style, and
in a real application it's better to have a specific using
declaration for each quince identifier that you use a lot. I'm just keeping
it brief for the tour.
Namespaces for application code (e.g. cinemascope
)
are always in style, but when you use quince they become a necessity. Definitions
of mapped classes (such as we're about to write) do not work unless they
are in some named namespace.
[2] The exceptions to this rule are, quite literally, not worth mentioning. They are identifiers that you never use in your code and I shall not use any of them in this document.