3333namespace olp {
3434namespace context {
3535/* *
36- * @brief The Context class represents the application context
36+ * @brief Represents the application context.
3737 *
38- * Client application must initialize its Context before using any other
39- * functionality of the library .
38+ * Before your application uses any other functionality of the library,
39+ * initialize the `Context` class .
4040 */
41-
4241struct ContextData ;
4342
43+ /* *
44+ * @brief Used only for the Android environment to correctly initialize
45+ * the `NetworkAndroid` class.
46+ *
47+ * Initialize the `Context` class before you send network requests in
48+ * the Android environment.
49+ * To use the `Context` class, cerate the `Scope` object first.
50+ */
4451class CORE_API Context {
4552 public:
53+ /* *
54+ * @brief Called when the `Context` object is initialized.
55+ *
56+ * Controlled by the `Scope` class.
57+ *
58+ * @see `Scope` for more information.
59+ */
4660 using InitializedCallback = std::function<void ()>;
61+
62+ /* *
63+ * @brief Called when the `Context` object is deinitialized.
64+ *
65+ * Controlled by the `Scope` class.
66+ *
67+ * @see `Scope` for more information.
68+ */
4769 using DeinitializedCallback = std::function<void ()>;
4870
4971 /* *
50- * @brief addInitializeCallbacks Register functions to be called after the
51- * context is initialized and destroyed.
52- * @param initCallback
53- * @param deinitCalback
72+ * @brief Registers functions that are called when the context is initialized
73+ * and destroyed.
74+ *
75+ * @param initCallback The `InitializedCallback` instance.
76+ * @param deinitCalback The `DeinitializedCallback` instance.
5477 */
5578 static void addInitializeCallbacks (InitializedCallback initCallback,
5679 DeinitializedCallback deinitCalback);
5780
5881 /* *
59- * @brief The Scope class initializes the context in its constructor (if not
60- * already initialized) and deinitializes in the destructor (when no other
61- * Scope instances exist). Instead of calling Context::init() and
62- * Context::deinit() manually, simply instantiate a Context::Scope() object.
82+ * @brief Initializes the `Context` class in its constructor (if it is not
83+ * already initialized) and deinitializes in its destructor (if there are
84+ * no other `Scope` instances).
85+ *
86+ * Instead of calling `Context::init()` and `Context::deinit()` manually,
87+ * instantiate the `Context::Scope()` object.
6388 */
6489 class CORE_API Scope {
6590 public:
66- // / see Context::init()
91+ /* *
92+ * @brief Creates the `Scope` instance.
93+ *
94+ * The `Scope` instance is used to initialize the `Context` class.
95+ * It also automatically initializes the `Context` callbacks.
96+ *
97+ * @see `InitializedCallback` for more information.
98+ */
6799 Scope ();
68100
69101#ifdef ANDROID
70- // / see Context::init()
102+ /* *
103+ * @brief Creates the `Scope` instance.
104+ *
105+ * The `Scope` instance is used to initialize the `Context` class.
106+ * It also automatically initializes the `Context` callbacks.
107+ *
108+ * @see `InitializedCallback` for more information.
109+ *
110+ * @param vm The `JavaVM` instance.
111+ * @param context The `android.content.Context` instance.
112+ */
71113 Scope (JavaVM* vm, jobject context);
72114#endif
73115
74- // / deleted copy constructor
116+ /* *
117+ * @brief The deleted copy constructor.
118+ */
75119 Scope (const Scope&) = delete ;
76- // / deleted assignment operator
120+ /* *
121+ * @brief The deleted assignment operator.
122+ */
77123 Scope& operator =(const Scope&) = delete ;
78124
79- // / see Context::deinit()
125+ /* *
126+ * @brief Invokes deinitialized callbacks of the `Context` class.
127+ *
128+ * @see `DeinitializedCallback` for more information.
129+ */
80130 ~Scope ();
81131
82132 private:
83133 std::shared_ptr<ContextData> m_cd;
84134 };
85135
86- // / deleted default constructor
136+ /* *
137+ * @brief The deleted default constructor.
138+ */
87139 Context () = delete ;
88140
89141 friend class Context ::Scope;
@@ -102,8 +154,21 @@ class CORE_API Context {
102154
103155 public:
104156#ifdef ANDROID
105- // / returns a Java VM object
157+ /* *
158+ * @brief Gets the `JavaVM` object.
159+ *
160+ * @note Use it only after you initialize the `Context` class.
161+ *
162+ * @return The `JavaVM` object.
163+ */
106164 static JavaVM* getJavaVM ();
165+ /* *
166+ * @brief Get the `android.content.Context` instance.
167+ *
168+ * @note Use it only after you initialize the `Context` class.
169+ *
170+ * @return The `android.content.Context` instance.
171+ */
107172 static jobject getAndroidContext ();
108173#endif
109174};
0 commit comments