Ignore:
Timestamp:
May 4, 2026, 7:26:38 AM (10 days ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
244335b
Parents:
8403b32
Message:

harmonize output quote manipulator with input quote manipulator, adding left/right quote parameters

Location:
libcfa/src/collections
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/collections/string.cfa

    r8403b32 rbb1eabc  
    1010// Created On       : Fri Sep 03 11:00:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 15 10:26:35 2025
    13 // Update Count     : 394
     12// Last Modified On : Sun May  3 23:21:25 2026
     13// Update Count     : 395
    1414//
    1515
     
    214214                for ( i; l ) cstr[i] = f.val[i];                                        // copy string
    215215                cstr[l] = '\0';                                                                         // terminate
    216                 _Ostream_Manip(const char *) cf @= { cstr, f.wd, f.pc, f.base, {f.all} };
     216                _Ostream_Manip(const char *) cf @= { cstr, f.wd, f.pc, f.base, {f.all}, f.qleft, f.qright };
    217217                return os | cf | nonl;
    218218        } // ?|?
  • libcfa/src/collections/string.hfa

    r8403b32 rbb1eabc  
    1010// Created On       : Fri Sep 03 11:00:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May  2 19:09:55 2026
    13 // Update Count     : 322
     12// Last Modified On : Sun May  3 23:24:08 2026
     13// Update Count     : 324
    1414//
    1515
     
    9090        _Ostream_Manip(string) oct( string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = 1, .pc = 0, .base = 'o', { .all = 0 } }; }
    9191        _Ostream_Manip(string) hex( string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = 1, .pc = 0, .base = 'x', { .all = 0 } }; }
    92         _Ostream_Manip(string) quote( string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = 1, .pc = 0, .base = 's', { .flags.quote = true } }; }
     92        _Ostream_Manip(string) quote( string s, const char qleft = '"', const char qright = '\0' ) {
     93                return (_Ostream_Manip(string))@{ .val = s, .wd = 1, .pc = 0, .base = 's', { .flags.quote = true }, .qleft = qleft, .qright = qright }; }
    9394        _Ostream_Manip(string) wd( unsigned int wd, string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = wd, .pc = 0, .base = 's', { .all = 0 } }; }
    9495        _Ostream_Manip(string) wd( unsigned int wd, unsigned int pc, string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = wd, .pc = pc, .base = 's', { .flags.pc = true } }; }
     
    9899        _Ostream_Manip(string) & nobase( _Ostream_Manip(string) & fmt ) { fmt.flags.nobsdp = true; return fmt; }
    99100        _Ostream_Manip(string) & upcase( _Ostream_Manip(string) & fmt ) { if ( fmt.base == 'x' || fmt.base == 'b' ) fmt.base -= 32; /* upper case */ return fmt; }
    100         _Ostream_Manip(string) & quote( _Ostream_Manip(string) & fmt ) { fmt.flags.quote = true; return fmt; } \
     101        _Ostream_Manip(string) & quote( _Ostream_Manip(string) & fmt, const char qleft = '"', const char qright = '\0' ) {
     102                fmt.flags.quote = true; fmt.qleft = qleft, fmt.qright = qright; return fmt; }
    101103} // distribution
    102104
Note: See TracChangeset for help on using the changeset viewer.