Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

Commit

Permalink
Provide documentation for the reply class
Browse files Browse the repository at this point in the history
  • Loading branch information
Cylix committed Jul 25, 2016
1 parent 9ea181a commit 8332ea2
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,58 @@ main(void) {
}
```
## Reply
`reply` is the class that wraps redis server replies. That is, `reply` objects are passed as parameters of commands callbacks and contain the server's response.
### Methods
#### bool is_array(void) const
Returns whether the reply is an array or not.
#### bool is_string(void) const
Returns whether the reply is a string (simple string or bulk string) or not.
#### bool is_simple_string(void) const
Returns whether the reply is a simple string or not.
#### bool is_bulk_string(void) const
Returns whether the reply is a bulk string or not.
#### bool is_error(void) const
Returns whether the reply is an error or not.
#### bool is_integer(void) const
Returns whether the reply is an integer or not.
#### bool is_null(void) const
Returns whether the reply is null or not.
#### const std::vector<reply>& as_array(void) const
Returns the reply as an array.
Behavior is undefined if the reply is not an array.
#### const std::string& as_string(void) const
Returns the reply as a string.
Behavior is undefined if the reply is not a string.
#### int as_integer(void) const
Returns the reply as an integer.
Behavior is undefined if the reply is not an integer.
#### type get_type(void) const
Return the type of the reply. The possible values are the following:
```cpp
enum class type {
array,
bulk_string,
error,
integer,
simple_string,
null
};
```

## Examples
Some examples are provided in this repository:
* [redis_client.cpp](examples/redis_client.cpp) shows how to use the redis client class.
Expand Down

0 comments on commit 8332ea2

Please sign in to comment.