cleaned up libdb

Removed now obsolete files from the db directory. What's left are the new classes in db/files.
added db-hash-object and db-cat-object tools

The db-hash-object.cpp tool allows for an object to be hashed and written to the database. The db-cat-object.cpp tool allows for an object to be retrieved from the database by hash. The objects are prefixed with a header describing its type.

These two functions read/write objects in a objects/<hash:0:2>/<hash:2> structure. This is identical to git. In general, the above tools correspond vaguely to git hash-object and git cat-file, respectively.
added db/file/Object class

This class extracts the reading and writing of object preambles from the db-has-object and db-cat-object tools. The tools now use this class instead of hardcoding their own implementation.
removed preamble handling from db/file/*

The handling of object preambles is being moved to db/file/Object, which makes the code for this obsolete in the other files.
added db/Structure class

This class encapsulates structural information about a database. It takes the
repository's path in its constructor and allows for easy access to objects and refs,
testing for their existence and priming (i.e. creating parent directories) before
writing.

The class also contains a structural name resolver, which, given an abbreviated
object name, will try to lookup the object's full name purely based on the database
structure. Higher level classes shall call this function as a last resort if the
higher level name (e.g. track id) cannot be resolved.
db-cat-object and db-hash-object now use db/Structure

Minor code simplifications in db-cat-object.cpp and db-hash-object.cpp due to the
use of the db/Structure class, offering convenience path priming.
generic tool maintains db/Structure instance

Moved the maintenance of a db/Structure object into the generic tool class in
tool/Generic.hpp. All subclasses now automatically have access to the database's
structural information through the 'dbs' member.
db/file/{Index,Track} check sanity of input stream

When a db/file/Index or db/file/Track is asked to read from an invalid stream (good() == false), the result is an empty Index or Track object, i.e. all members cleared. This is clearly an error condition and is now being reported through and exception.
db/file/Object throws if no type set

The db/file/Object class now properly throws an exception if an attempt is made at writing an object's preamble without a type set.
db tools write object preambles and use db struct

The database tools db-add, db-list and db-meta now use the db/file/Object class to
read and write the preamble to their objects, i.e. the header that specifies the
object's type.

Said tools now also use the db/Structure object that provides access to the database
structure. This streamlines the name resolution process and makes the code more
readable and easier to maintain.
db/file classes read/write preamble themselves

The classes db/file/Index and db/file/Track now read and write the object preamble
inside their read() and write() functions. This makes using the classes easier,
since the caller does not have to account for the preamble. An additional benefit is
the proper stream checking when reading and writing db/file classes: The
read_preamble() and write_preamble() function act as a stream sanity check and throw
exceptions if something smells fishy.
move helper functions out of db/file/Generic

The various write_stream(), write_value(), read_stream(), read_value(),
write_preamble(), and read_preamble() functions that used to be embedded in the
db/file/Generic class are now located in their own header file
db/file/readwrite.hpp. This allows for db/file/Object to inherit from Generic again
(dependency on Object is gone) and makes the Generic interface rather slim and
straightforward.
added db/Object.hpp containing read/write tools

Added the db/Object.hpp file which contains the ObjectWriter class. The class
generalizes writing db/file/Generic objects into a buffer, calculating the hash from
the buffer's contents, and eventually writing the buffer to disk.

Multiple convenience overloads of write() are provided that allow the object to be
written to a regular path (char*), a Boost filesystem path (fs::path) or a location
in the database given by either a Structure::Object (if the hash is already known)
or a Structure (if the hash is to be used as object name). Especially the last
option is convenient, as it saves you from a lot of boilerplate code.
added ObjectReader to db/Object.hpp

Added the ObjectReader class to db/Object.hpp. Its purpose is to read an object from
a file on disk, capturing the object's hash (simply for reference) and providing an
interface that allows the caller to read() with exceptions, or maybe_read() with a
graceful `false` return value. This class, like ObjectWriter, makes the code of
other parts of the system shorter and more readable.
db-meta uses ObjectReader/ObjectWriter

Replaced the reading and writing code in db-meta.cpp with ObjectReader and
ObjectWriter calls. Code is a bit shorter and its readability is improved.
added db/ObjectBuffer that reads/writes objects

The ObjectBuffer class is a template that inherits from one of the db/file/* classes
and exposes the same interface. In addition, it encapsulates a ObjectReader and
ObjectWriter object and provides additional functions that streamline the process of
reading an object and writing the modified version back to disk.

To the user of the class it resembles the original db/file/* class, but in addition
keeps track of its hash when read (hash_in) and its hash when written (hash_out).
This allows an object to be read, modified and written back to disk, with the
programmer ending up with an object that captures both the hash before and after the
change.
db-meta: migrated to ObjectBuffer

The db-meta.cpp file now uses the db/ObjectBuffer class to read, modify and write
objects in the database. This cleaned up the code a fair amount and makes things
much more readable.