Ignore:
Timestamp:
Jan 18, 2024, 10:17:21 PM (8 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
f988834
Parents:
906d8fa
Message:

Modify substring interface from start-end to start-len, and add a missing test.

File:
1 edited

Legend:

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

    r906d8fa re8b3717  
    346346}
    347347
     348
    348349// General copy constructor
    349 void ?{}(string_res & s, const string_res & s2, StrResInitMode mode, size_t start, size_t end ) {
    350 
     350void ?{}(string_res & s, const string_res & s2, StrResInitMode mode, size_t start, size_t len ) {
     351
     352    size_t end = start + len;
    351353    verify( start <= end && end <= s2.Handle.lnth );
    352354
     
    611613
    612614void assignAt(const string_res & s, size_t index, char val) {
    613     string_res editZone = { s, SHARE_EDITS, index, index+1 };
     615    // caution: not tested (not reachable by string-api-coverage interface)
     616    // equivalent form at string level is `s[index] = val`,
     617    // which uses the overload that returns a length-1 string
     618    string_res editZone = { s, SHARE_EDITS, index, 1 };
    614619    assign(editZone, &val, 1);
    615620}
     
    656661
    657662void ?*=?(string_res & s, size_t factor) {
    658     string_res s2 = { s, COPY_VALUE, 0, size(s) };
     663    string_res s2 = { s, COPY_VALUE };
    659664    s = "";
    660665    for (factor) s += s2;
Note: See TracChangeset for help on using the changeset viewer.