@@ -344,6 +344,8 @@ namespace fossil {
344344 */
345345 class Stream {
346346 public:
347+ // Existing functions...
348+
347349 /* *
348350 * Reopen a stream with a new file.
349351 *
@@ -359,6 +361,10 @@ namespace fossil {
359361 return fossil_fstream_freopen (stream, filename, mode, file);
360362 }
361363
364+ static int32_t freopen (fossil_fstream_t *stream, const std::string &filename, const std::string &mode, FILE *file) {
365+ return fossil_fstream_freopen (stream, filename.c_str (), mode.c_str (), file);
366+ }
367+
362368 /* *
363369 * Open a stream for file operations.
364370 *
@@ -373,6 +379,10 @@ namespace fossil {
373379 return fossil_fstream_open (stream, filename, mode);
374380 }
375381
382+ static int32_t open (fossil_fstream_t *stream, const std::string &filename, const std::string &mode) {
383+ return fossil_fstream_open (stream, filename.c_str (), mode.c_str ());
384+ }
385+
376386 /* *
377387 * Close an open stream.
378388 *
@@ -480,6 +490,10 @@ namespace fossil {
480490 return fossil_fstream_save (stream, new_filename);
481491 }
482492
493+ static int32_t save (fossil_fstream_t *stream, const std::string &new_filename) {
494+ return fossil_fstream_save (stream, new_filename.c_str ());
495+ }
496+
483497 /* *
484498 * Copy a file from the source to the destination.
485499 *
@@ -493,6 +507,10 @@ namespace fossil {
493507 return fossil_fstream_copy (source_filename, destination_filename);
494508 }
495509
510+ static int32_t copy (const std::string &source_filename, const std::string &destination_filename) {
511+ return fossil_fstream_copy (source_filename.c_str (), destination_filename.c_str ());
512+ }
513+
496514 /* *
497515 * Remove a file stream.
498516 *
@@ -505,6 +523,10 @@ namespace fossil {
505523 return fossil_fstream_remove (filename);
506524 }
507525
526+ static int32_t remove (const std::string &filename) {
527+ return fossil_fstream_remove (filename.c_str ());
528+ }
529+
508530 /* *
509531 * Rename a file or directory.
510532 *
@@ -518,6 +540,10 @@ namespace fossil {
518540 return fossil_fstream_rename (old_filename, new_filename);
519541 }
520542
543+ static int32_t rename (const std::string &old_filename, const std::string &new_filename) {
544+ return fossil_fstream_rename (old_filename.c_str (), new_filename.c_str ());
545+ }
546+
521547 /* *
522548 * Flush the contents of an open stream.
523549 *
@@ -568,6 +594,10 @@ namespace fossil {
568594 return fossil_fstream_rotate (filename, n);
569595 }
570596
597+ static int32_t rotate (const std::string &filename, int32_t n) {
598+ return fossil_fstream_rotate (filename.c_str (), n);
599+ }
600+
571601 /* *
572602 * Create a backup of a file with a specified backup suffix.
573603 *
@@ -581,6 +611,10 @@ namespace fossil {
581611 return fossil_fstream_backup (filename, backup_suffix);
582612 }
583613
614+ static int32_t backup (const std::string &filename, const std::string &backup_suffix) {
615+ return fossil_fstream_backup (filename.c_str (), backup_suffix.c_str ());
616+ }
617+
584618 /* *
585619 * Check if a file exists.
586620 *
@@ -593,6 +627,10 @@ namespace fossil {
593627 return fossil_fstream_file_exists (filename);
594628 }
595629
630+ static int32_t file_exists (const std::string &filename) {
631+ return fossil_fstream_file_exists (filename.c_str ());
632+ }
633+
596634 /* *
597635 * Get the size of an open stream.
598636 *
@@ -617,6 +655,10 @@ namespace fossil {
617655 return fossil_fstream_delete (filename);
618656 }
619657
658+ static int32_t delete_file (const std::string &filename) {
659+ return fossil_fstream_delete (filename.c_str ());
660+ }
661+
620662 /* *
621663 * Get the type of a file stream.
622664 *
@@ -629,6 +671,10 @@ namespace fossil {
629671 return fossil_fstream_get_type (filename);
630672 }
631673
674+ static int get_type (const std::string &filename) {
675+ return fossil_fstream_get_type (filename.c_str ());
676+ }
677+
632678 /* *
633679 * Check if a file is readable.
634680 *
@@ -641,6 +687,10 @@ namespace fossil {
641687 return fossil_fstream_is_readable (filename);
642688 }
643689
690+ static int32_t is_readable (const std::string &filename) {
691+ return fossil_fstream_is_readable (filename.c_str ());
692+ }
693+
644694 /* *
645695 * Check if a file is writable.
646696 *
@@ -653,6 +703,10 @@ namespace fossil {
653703 return fossil_fstream_is_writable (filename);
654704 }
655705
706+ static int32_t is_writable (const std::string &filename) {
707+ return fossil_fstream_is_writable (filename.c_str ());
708+ }
709+
656710 /* *
657711 * Check if a file is executable.
658712 *
@@ -665,6 +719,10 @@ namespace fossil {
665719 return fossil_fstream_is_executable (filename);
666720 }
667721
722+ static int32_t is_executable (const std::string &filename) {
723+ return fossil_fstream_is_executable (filename.c_str ());
724+ }
725+
668726 /* *
669727 * Set file permissions.
670728 *
@@ -678,6 +736,10 @@ namespace fossil {
678736 return fossil_fstream_set_permissions (filename, mode);
679737 }
680738
739+ static int32_t set_permissions (const std::string &filename, int32_t mode) {
740+ return fossil_fstream_set_permissions (filename.c_str (), mode);
741+ }
742+
681743 /* *
682744 * Get file permissions.
683745 *
@@ -691,9 +753,9 @@ namespace fossil {
691753 return fossil_fstream_get_permissions (filename, mode);
692754 }
693755
694- };
695-
696- } // namespace io
756+ static int32_t get_permissions ( const std::string &filename, int32_t *mode) {
757+ return fossil_fstream_get_permissions (filename. c_str (), mode);
758+ }
697759
698760} // namespace fossil
699761
0 commit comments