@@ -137,13 +137,21 @@ int fossil_io_validate_is_length(const char *input, size_t max_length);
137137int fossil_io_validate_sanitize_string (const char *input, char *output, size_t output_size);
138138
139139/* *
140- * @brief Reads a secure line of input into the provided buffer .
140+ * Displays a menu of choices and returns the selected choice .
141141 *
142- * @param buffer The buffer where the input will be stored.
143- * @param buffer_size The size of the buffer.
144- * @return A fossil_io_validate_error_t indicating the result of the input reading process.
142+ * @param prompt The prompt message before displaying the menu.
143+ * @param choices Array of strings representing the choices.
144+ * @param num_choices The number of choices.
145+ * @return The index of the selected choice.
145146 */
146- int fossil_io_validate_read_secure_line (char *buffer, size_t buffer_size);
147+ int fossil_io_display_menu (const char *prompt, const char *choices[], int num_choices);
148+
149+ /* *
150+ * Displays a simple progress bar.
151+ *
152+ * @param progress The current progress (0-100).
153+ */
154+ void fossil_io_show_progress (int progress);
147155
148156#ifdef __cplusplus
149157}
@@ -310,16 +318,46 @@ namespace fossil {
310318 }
311319
312320 /* *
313- * @brief Reads a secure line of input into the provided buffer.
321+ * @brief Displays a menu of choices and returns the selected choice.
322+ *
323+ * @param prompt The prompt message before displaying the menu.
324+ * @param choices Array of strings representing the choices.
325+ * @param num_choices The number of choices.
326+ * @return The index of the selected choice.
327+ */
328+ static int display_menu (const char *prompt, const char *choices[], int num_choices) {
329+ return fossil_io_display_menu (prompt, choices, num_choices);
330+ }
331+
332+ /* *
333+ * @brief Displays a simple progress bar.
334+ *
335+ * @param progress The current progress (0-100).
336+ */
337+ static void show_progress (int progress) {
338+ fossil_io_show_progress (progress);
339+ }
340+
341+ /* *
342+ * @brief Override the output stream operator to display Input object details.
314343 *
315- * @param buffer The buffer where the input will be stored .
316- * @param buffer_size The size of the buffer .
317- * @return A fossil_io_validate_error_t indicating the result of the input reading process .
344+ * @param os The output stream where data will be printed .
345+ * @param input The Input object to display .
346+ * @return The modified output stream .
318347 */
319- static int validate_read_secure_line (char *buffer, size_t buffer_size) {
320- return fossil_io_validate_read_secure_line (buffer, buffer_size);
348+ friend std::ostream& operator <<(std::ostream& os, const Input& input) {
349+ // Example of what to output: printing the state or some meaningful data
350+ os << " Input Stream Details:\n " ;
351+ os << " - Max Buffer Size: " << input.max_buffer_size << " \n " ;
352+ os << " - Input Stream: " << (input.stream ? " Valid Stream" : " Invalid Stream" ) << " \n " ;
353+
354+ // Return the output stream
355+ return os;
321356 }
322357
358+ private:
359+ size_t max_buffer_size; // Example private member
360+ FILE* stream; // Example stream (pointer to the input stream, like stdin)
323361 };
324362
325363 }
0 commit comments