Custom sorting of CBLQueryEnumerators

Added CBLQuery.sortDescriptors,
and -[CBLQueryEnumerator sortUsingDescriptors:].

Conflicts:
	Source/API/CBLQuery.m
Removed implicit key./value. prefix support in query sort descriptors.

Had second thoughts about this; too much "magic" for not enough benefit.
Fixed: Query.inclusiveEnd option was missing from public API

Fixes couchbaselabs/couchbase-lite-api#105
API CHANGE: Added CBLQuery.postFilter

Query results can now be post-processed by an NSPredicate that can
remove any rows its wants to.
Added query-filter support for reduced/grouped and full-text queries.
API CHANGE: Added CBLQuery.inclusiveStart property

Defaults to YES (compatible with existing behavior.)
In the REST API, it's a query param ?inclusive_start.
Checked in current version of CBLQueryPlanner.
Query planner now precomputes startKey and endKey as NSExpressions at init time.

Mostly this improves testability, as unit tests can assert that those expressions are correct.
Query planner now supports case-insensitive string comparison

i.e. the "[c]" modifier on string comparison operators
Query planner handles "IN" expressions; other fixes

* For "expr IN $VALUES", emits expr as key and uses the CBLQuery.keys property with the runtime value of $VALUES.
* Fixed a bug where an expr could appear twice in the key if it were also given as a sort key.
* Made most of the class properties only appear in debug builds, to save code size.
Query planner: Simplify map block by precomputing a single expression for key and for value.
More CBLQueryPlanner improvements

* Added convenience init that takes predicate as an NSString.
* Added -explanation method for troubleshooting & learning.
* Handle _queryKeys expression evaluating to an NSSet or NSDictionary.
Added postFilter support to all-docs queries.
all-docs query optimizations

* Don't look up attachments if rev's no_attachments column is true
* Get document contents if there's a filter, because it's almost certain to look at them.
Fixes #354 Return 404 for unknown resources

* Fixes CBL_Router to return 404 instead of 400 for unknown resourcess.

* Fixes CBLRouter_tests accordingly.
Fixes #163 REST total_rows should return number of rows in the view

* Add total_docs column to views table and set its default value to -1 (means 'unknown' for the old version of the api that do not have this fix)

* Add totalDocs property to CBLView() category. The totalDocs property will first try to get the value from views.total_docs columns and if the value is '-1', it will count the number of docs from the maps table, update the value to views.total_docs and return.

* Update the views.total_rows every time when the view's index is updated.

* Update CBL_Router's handler to return view.totalDocs for the total_rows attribute in query responses.

* Add CBL_View_TotalDocs test case and fix CBL_Router_Views accordingly.
Merge pull request #421 from couchbase/feature/issue_163

Fixes #163 REST total_rows should return number of rows in the view
Merge pull request #420 from couchbase/feature/issue_354

Fixes #354 Return 404 for unknown resources
Fixes #417 Not fetching each individual rev when _all_docs returns an error

* In CBL_Puller's pullBulkWithAllDocs: method, when _all_docs request fails, all the docs are not treated as leftever docs and will not be fetched individually as the retry process will kick in.

* With this fix, the completed change count issue describing in #417 will be resolved as well.
Fixes #414 Add index for getting a doc with doc and rev id

Add an index on revs table for getting a document with doc and revision ID.