Changeset 06280ad for libcfa


Ignore:
Timestamp:
Jan 16, 2024, 10:20:33 PM (4 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
e891349
Parents:
38951c31
Message:

formatting

File:
1 edited

Legend:

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

    r38951c31 r06280ad  
    1010// Created On       : Fri Sep 03 11:00:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jan  2 13:20:27 2024
    13 // Update Count     : 34
     12// Last Modified On : Tue Jan 16 22:19:27 2024
     13// Update Count     : 35
    1414//
    1515
     
    180180
    181181size_t DEBUG_string_bytes_avail_until_gc( VbyteHeap * heap ) {
    182     return ((char*)heap->ExtVbyte) - heap->EndVbyte;
     182    return ((char *)heap->ExtVbyte) - heap->EndVbyte;
    183183}
    184184
     
    229229
    230230        // rest of heap is available to read into
    231         int lenReadable = (char*)temp.Handle.ulink->ExtVbyte - temp.Handle.ulink->EndVbyte;
     231        int lenReadable = (char *)temp.Handle.ulink->ExtVbyte - temp.Handle.ulink->EndVbyte;
    232232        assert (lenReadable >= 2);
    233233
     
    315315}
    316316
    317 static void eagerCopyCtorHelper(string_res & s, const char* rhs, size_t rhslnth) with(s) {
     317static void eagerCopyCtorHelper(string_res & s, const char * rhs, size_t rhslnth) with(s) {
    318318    if( ambient_string_sharectx->activeHeap ) {
    319319        (Handle){ * ambient_string_sharectx->activeHeap };
     
    331331
    332332// Constructor from a raw buffer and size
    333 void ?{}(string_res & s, const char* rhs, size_t rhslnth) with(s) {
     333void ?{}(string_res & s, const char * rhs, size_t rhslnth) with(s) {
    334334    eagerCopyCtorHelper(s, rhs, rhslnth);
    335335}
    336336
    337337// private ctor (not in header): use specified heap (ignore ambient) and copy chars in
    338 void ?{}( string_res & s, VbyteHeap & heap, const char* rhs, size_t rhslnth ) with(s) {
     338void ?{}( string_res & s, VbyteHeap & heap, const char * rhs, size_t rhslnth ) with(s) {
    339339    (Handle){ heap };
    340340    Handle.s = VbyteAlloc(*Handle.ulink, rhslnth);
     
    479479}
    480480
    481 static string_res & assign_(string_res & s, const char* buffer, size_t bsize, const string_res & valSrc) {
     481static string_res & assign_(string_res & s, const char * buffer, size_t bsize, const string_res & valSrc) {
    482482
    483483    string_res * shareEditSetStartPeer;
     
    563563}
    564564
    565 string_res & assign(string_res & s, const char* buffer, size_t bsize) {
     565string_res & assign(string_res & s, const char * buffer, size_t bsize) {
    566566    return assign_(s, buffer, bsize, *0p);
    567567}
     
    668668bool ?<? (const string_res & s1, const string_res & s2) { return strcmp(s1, s2) <  0; }
    669669
    670 int strcmp (const string_res & s1, const char* s2) {
     670int strcmp (const string_res & s1, const char * s2) {
    671671    string_res s2x = s2;
    672672    return strcmp(s1, s2x);
    673673}
    674674
    675 bool ?==?(const string_res & s1, const char* s2) { return strcmp(s1, s2) == 0; }
    676 bool ?!=?(const string_res & s1, const char* s2) { return strcmp(s1, s2) != 0; }
    677 bool ?>? (const string_res & s1, const char* s2) { return strcmp(s1, s2) >  0; }
    678 bool ?>=?(const string_res & s1, const char* s2) { return strcmp(s1, s2) >= 0; }
    679 bool ?<=?(const string_res & s1, const char* s2) { return strcmp(s1, s2) <= 0; }
    680 bool ?<? (const string_res & s1, const char* s2) { return strcmp(s1, s2) <  0; }
    681 
    682 int strcmp (const char* s1, const string_res & s2) {
     675bool ?==?(const string_res & s1, const char * s2) { return strcmp(s1, s2) == 0; }
     676bool ?!=?(const string_res & s1, const char * s2) { return strcmp(s1, s2) != 0; }
     677bool ?>? (const string_res & s1, const char * s2) { return strcmp(s1, s2) >  0; }
     678bool ?>=?(const string_res & s1, const char * s2) { return strcmp(s1, s2) >= 0; }
     679bool ?<=?(const string_res & s1, const char * s2) { return strcmp(s1, s2) <= 0; }
     680bool ?<? (const string_res & s1, const char * s2) { return strcmp(s1, s2) <  0; }
     681
     682int strcmp (const char * s1, const string_res & s2) {
    683683    string_res s1x = s1;
    684684    return strcmp(s1x, s2);
    685685}
    686686
    687 bool ?==?(const char* s1, const string_res & s2) { return strcmp(s1, s2) == 0; }
    688 bool ?!=?(const char* s1, const string_res & s2) { return strcmp(s1, s2) != 0; }
    689 bool ?>? (const char* s1, const string_res & s2) { return strcmp(s1, s2) >  0; }
    690 bool ?>=?(const char* s1, const string_res & s2) { return strcmp(s1, s2) >= 0; }
    691 bool ?<=?(const char* s1, const string_res & s2) { return strcmp(s1, s2) <= 0; }
    692 bool ?<? (const char* s1, const string_res & s2) { return strcmp(s1, s2) <  0; }
     687bool ?==?(const char * s1, const string_res & s2) { return strcmp(s1, s2) == 0; }
     688bool ?!=?(const char * s1, const string_res & s2) { return strcmp(s1, s2) != 0; }
     689bool ?>? (const char * s1, const string_res & s2) { return strcmp(s1, s2) >  0; }
     690bool ?>=?(const char * s1, const string_res & s2) { return strcmp(s1, s2) >= 0; }
     691bool ?<=?(const char * s1, const string_res & s2) { return strcmp(s1, s2) <= 0; }
     692bool ?<? (const char * s1, const string_res & s2) { return strcmp(s1, s2) <  0; }
    693693
    694694
     
    727727}
    728728
    729 int find(const string_res & s, const char* search) {
     729int find(const string_res & s, const char * search) {
    730730    return findFrom(s, 0, search);
    731731}
    732 int findFrom(const string_res & s, size_t fromPos, const char* search) {
     732int findFrom(const string_res & s, size_t fromPos, const char * search) {
    733733    return findFrom(s, fromPos, search, strlen(search));
    734734}
    735735
    736 int find(const string_res & s, const char* search, size_t searchsize) {
     736int find(const string_res & s, const char * search, size_t searchsize) {
    737737    return findFrom(s, 0, search, searchsize);
    738738}
    739739
    740 int findFrom(const string_res & s, size_t fromPos, const char* search, size_t searchsize) {
     740int findFrom(const string_res & s, size_t fromPos, const char * search, size_t searchsize) {
    741741
    742742    /* Remaining implementations essentially ported from Sunjay's work */
     
    779779}
    780780
    781 bool includes(const string_res & s, const char* search) {
     781bool includes(const string_res & s, const char * search) {
    782782    return includes(s, search, strlen(search));
    783783}
    784784
    785 bool includes(const string_res & s, const char* search, size_t searchsize) {
     785bool includes(const string_res & s, const char * search, size_t searchsize) {
    786786    return find(s, search, searchsize) < s.Handle.lnth;
    787787}
     
    791791}
    792792
    793 bool startsWith(const string_res & s, const char* prefix) {
     793bool startsWith(const string_res & s, const char * prefix) {
    794794    return startsWith(s, prefix, strlen(prefix));
    795795}
    796796
    797 bool startsWith(const string_res & s, const char* prefix, size_t prefixsize) {
     797bool startsWith(const string_res & s, const char * prefix, size_t prefixsize) {
    798798    if (s.Handle.lnth < prefixsize) {
    799799        return false;
     
    806806}
    807807
    808 bool endsWith(const string_res & s, const char* suffix) {
     808bool endsWith(const string_res & s, const char * suffix) {
    809809    return endsWith(s, suffix, strlen(suffix));
    810810}
    811811
    812 bool endsWith(const string_res & s, const char* suffix, size_t suffixsize) {
     812bool endsWith(const string_res & s, const char * suffix, size_t suffixsize) {
    813813    if (s.Handle.lnth < suffixsize) {
    814814        return false;
Note: See TracChangeset for help on using the changeset viewer.