22
33namespace nativeapi {
44
5- // AccessibilityManager is a singleton that manages all accessibility on the
6- // system.
5+ /* *
6+ * @class AccessibilityManager
7+ * @brief A singleton class that manages system accessibility features
8+ *
9+ * The AccessibilityManager provides a centralized interface for managing
10+ * accessibility functionality across the system. It follows the singleton
11+ * pattern to ensure only one instance exists throughout the application
12+ * lifecycle, providing consistent state management for accessibility features.
13+ *
14+ * Key responsibilities:
15+ * - Enable/disable system accessibility features
16+ * - Query accessibility state
17+ * - Provide thread-safe access to accessibility functionality
18+ *
19+ * Usage example:
20+ * @code
21+ * AccessibilityManager& manager = AccessibilityManager::GetInstance();
22+ * manager.Enable();
23+ * bool enabled = manager.IsEnabled();
24+ * @endcode
25+ */
726class AccessibilityManager {
827 public:
9- AccessibilityManager ();
28+ /* *
29+ * @brief Gets the singleton instance of AccessibilityManager
30+ * @return Reference to the singleton instance
31+ *
32+ * This method provides thread-safe access to the singleton instance.
33+ * The instance is created on first access and remains alive for the
34+ * duration of the application.
35+ */
36+ static AccessibilityManager& GetInstance ();
37+
38+ /* *
39+ * @brief Virtual destructor
40+ *
41+ * Ensures proper cleanup of resources when the manager is destroyed.
42+ * Note: In singleton pattern, this is typically called only at application
43+ * shutdown.
44+ */
1045 virtual ~AccessibilityManager ();
1146
12- // Enable the accessibility
47+ /* *
48+ * @brief Enables system accessibility features
49+ *
50+ * Activates accessibility functionality across the system. This method
51+ * should be called to make accessibility features available to users.
52+ * The operation is idempotent - calling it multiple times has the same
53+ * effect as calling it once.
54+ *
55+ * @note This operation may require system permissions depending on the
56+ * platform implementation.
57+ */
1358 void Enable ();
1459
15- // Whether the accessibility is enabled
60+ /* *
61+ * @brief Checks if accessibility features are currently enabled
62+ * @return true if accessibility is enabled, false otherwise
63+ *
64+ * This method provides a quick way to query the current state of
65+ * accessibility features without modifying the system state.
66+ */
1667 bool IsEnabled ();
68+
69+ // Delete copy constructor and assignment operator to prevent copies
70+ AccessibilityManager (const AccessibilityManager&) = delete ;
71+ AccessibilityManager& operator =(const AccessibilityManager&) = delete ;
72+
73+ private:
74+ /* *
75+ * @brief Private constructor for singleton pattern
76+ *
77+ * Initializes the AccessibilityManager instance. This constructor is
78+ * private to prevent direct instantiation - use GetInstance() instead.
79+ */
80+ AccessibilityManager ();
81+
82+ /* *
83+ * @brief Internal flag tracking accessibility state
84+ *
85+ * Maintains the current enabled/disabled state of accessibility features.
86+ * This member is used internally by Enable() and IsEnabled() methods.
87+ */
88+ bool enabled_;
1789};
1890
19- } // namespace nativeapi
91+ } // namespace nativeapi
0 commit comments