Improve documentation.

This commit is contained in:
levlam 2020-11-15 17:38:10 +03:00
parent 5eea5b7501
commit f693874c50
3 changed files with 16 additions and 7 deletions

View File

@ -8,10 +8,9 @@
///\file ///\file
#include "td/telegram/TdCallback.h"
#include "td/telegram/td_api.h" #include "td/telegram/td_api.h"
#include "td/telegram/td_api.hpp" #include "td/telegram/td_api.hpp"
#include "td/telegram/TdCallback.h"
#include "td/actor/actor.h" #include "td/actor/actor.h"
@ -30,9 +29,12 @@ class Td;
*/ */
class ClientActor : public Actor { class ClientActor : public Actor {
public: public:
/// Options for ClientActor creation.
struct Options { struct Options {
/// NetQueryStats object for this client.
std::shared_ptr<NetQueryStats> net_query_stats; std::shared_ptr<NetQueryStats> net_query_stats;
/// Default constructor.
Options() { Options() {
} }
}; };
@ -40,6 +42,7 @@ class ClientActor : public Actor {
/** /**
* Creates a ClientActor using the specified callback. * Creates a ClientActor using the specified callback.
* \param[in] callback Callback for outgoing notifications from TDLib. * \param[in] callback Callback for outgoing notifications from TDLib.
* \param[in] options Options to create the TDLib.
*/ */
explicit ClientActor(unique_ptr<TdCallback> callback, Options options = {}); explicit ClientActor(unique_ptr<TdCallback> callback, Options options = {});
@ -53,7 +56,7 @@ class ClientActor : public Actor {
/** /**
* Synchronously executes a TDLib request. Only a few requests can be executed synchronously. * Synchronously executes a TDLib request. Only a few requests can be executed synchronously.
* May be called from any thread. * May be called from any thread.
* \param[in] request Request to the TDLib. * \param[in] request Request to the TDLib instance.
* \return The request response. * \return The request response.
*/ */
static td_api::object_ptr<td_api::Object> execute(td_api::object_ptr<td_api::Function> request); static td_api::object_ptr<td_api::Object> execute(td_api::object_ptr<td_api::Function> request);
@ -80,6 +83,9 @@ class ClientActor : public Actor {
ActorOwn<Td> td_; ActorOwn<Td> td_;
}; };
/**
* Creates NetQueryStats object, which can be shared between different clients.
*/
std::shared_ptr<NetQueryStats> create_net_query_stats(); std::shared_ptr<NetQueryStats> create_net_query_stats();
/** /**

View File

@ -13,7 +13,7 @@
* and is able to work with JSON. * and is able to work with JSON.
* *
* The JSON serialization of TDLib API objects is straightforward: all API objects are represented as JSON objects with * The JSON serialization of TDLib API objects is straightforward: all API objects are represented as JSON objects with
* the same keys as the API object field names. The object type name is stored in the special field '@type' which is * the same keys as the API object field names. The object type name is stored in the special field "@type" which is
* optional in places where type is uniquely determined by the context. * optional in places where type is uniquely determined by the context.
* Fields of Bool type are stored as Boolean, fields of int32, int53, and double types are stored as Number, fields of * Fields of Bool type are stored as Boolean, fields of int32, int53, and double types are stored as Number, fields of
* int64 and string types are stored as String, fields of bytes type are base64 encoded and then stored as String, * int64 and string types are stored as String, fields of bytes type are base64 encoded and then stored as String,

View File

@ -87,9 +87,7 @@ class TlObject {
virtual ~TlObject() = default; virtual ~TlObject() = default;
}; };
/** /// @cond UNDOCUMENTED
* A smart wrapper to store a pointer to a TL-object.
*/
namespace tl { namespace tl {
template <class T> template <class T>
@ -177,6 +175,11 @@ bool operator!=(const unique_ptr<T> &p, std::nullptr_t) {
} }
} // namespace tl } // namespace tl
/// @endcond
/**
* A smart wrapper to store a pointer to a TL-object.
*/
template <class Type> template <class Type>
using tl_object_ptr = tl::unique_ptr<Type>; using tl_object_ptr = tl::unique_ptr<Type>;