Add PSR-4 class loader. (tests needed)

This PR changes the class loader to support PSR-4 alongside PSR-0, as discussed in
https://github.com/composer/composer/issues/1884

It does not introduce any tests. (in fact I did not find any tests for PSR-0 either)
It does not introduce any mechanics to actually activate PSR-4 via composer.json.

It also introduces a few other changes, see inline comments.