Move couchstore to C++

Change-Id: Ic6936bfdcb28de634bd008ea5d3a71dfb42015f8
Reviewed-on: http://review.couchbase.org/27205
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Use _tempnam

Change-Id: I8a74e841e548bedd0afcfcf38fc9f6d18236a19d