Ignore:
Timestamp:
Aug 14, 2023, 9:29:40 PM (15 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
329487c
Parents:
b5e725a
Message:

formatting

File:
1 edited

Legend:

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

    rb5e725a r6264087  
    1010// Created On       : Fri Sep 03 11:00:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 12 15:24:18 2023
    13 // Update Count     : 6
     12// Last Modified On : Sun Aug 13 22:50:08 2023
     13// Update Count     : 7
    1414//
    1515
     
    5555}
    5656
    57 void ?{}( string & this, const char* buffer, size_t bsize) {
     57void ?{}( string & this, const char * buffer, size_t bsize) {
    5858    (this.inner) { malloc() };
    5959    ?{}( *this.inner, buffer, bsize );
     
    110110}
    111111
    112 ifstream & ?|?(ifstream &in, string &this) {
     112ifstream & ?|?(ifstream & in, string & this) {
    113113    return in | (*this.inner); // read to internal string_res
    114114}
    115115
     116void ?|?( ifstream & in, string & this ) {
     117    (ifstream &)(in | this); ends( in );
     118}
    116119
    117120////////////////////////////////////////////////////////
     
    131134// Comparison
    132135
    133 bool ?==?(const string &s, const string &other) {
     136bool ?==?(const string & s, const string & other) {
    134137    return *s.inner == *other.inner;
    135138}
    136139
    137 bool ?!=?(const string &s, const string &other) {
     140bool ?!=?(const string & s, const string & other) {
    138141    return *s.inner != *other.inner;
    139142}
    140143
    141 bool ?==?(const string &s, const char* other) {
     144bool ?==?(const string & s, const char * other) {
    142145    return *s.inner == other;
    143146}
    144147
    145 bool ?!=?(const string &s, const char* other) {
     148bool ?!=?(const string & s, const char * other) {
    146149    return *s.inner != other;
    147150}
     
    150153// Getter
    151154
    152 size_t size(const string &s) {
     155size_t size(const string & s) {
    153156    return size( * s.inner );
    154157}
     
    157160// Concatenation
    158161
    159 void ?+=?(string &s, char other) {
     162void ?+=?(string & s, char other) {
    160163    (*s.inner) += other;
    161164}
    162165
    163 void ?+=?(string &s, const string &s2) {
     166void ?+=?(string & s, const string & s2) {
    164167    (*s.inner) += (*s2.inner);
    165168}
    166169
    167 void ?+=?(string &s, const char* other) {
     170void ?+=?(string & s, const char * other) {
    168171    (*s.inner) += other;
    169172}
    170173
    171 string ?+?(const string &s, char other) {
     174string ?+?(const string & s, char other) {
    172175    string ret = s;
    173176    ret += other;
     
    175178}
    176179
    177 string ?+?(const string &s, const string &s2) {
     180string ?+?(const string & s, const string & s2) {
    178181    string ret = s;
    179182    ret += s2;
     
    181184}
    182185
    183 string ?+?(const char* s1, const char* s2) {
     186string ?+?(const char * s1, const char * s2) {
    184187    string ret = s1;
    185188    ret += s2;
     
    187190}
    188191
    189 string ?+?(const string &s, const char* other) {
     192string ?+?(const string & s, const char * other) {
    190193    string ret = s;
    191194    ret += other;
     
    196199// Repetition
    197200
    198 string ?*?(const string &s, size_t factor) {
     201string ?*?(const string & s, size_t factor) {
    199202    string ret = "";
    200203    for (factor) ret += s;
     
    216219// Character access
    217220
    218 char ?[?](const string &s, size_t index) {
     221char ?[?](const string & s, size_t index) {
    219222    return (*s.inner)[index];
    220223}
    221224
    222 string ?[?](string &s, size_t index) {
     225string ?[?](string & s, size_t index) {
    223226    string ret = { *s.inner, index, index + 1 };
    224227    return ret`shareEdits;
     
    228231// Search
    229232
    230 bool contains(const string &s, char ch) {
     233bool contains(const string & s, char ch) {
    231234    return contains( *s.inner, ch );
    232235}
    233236
    234 int find(const string &s, char search) {
     237int find(const string & s, char search) {
    235238    return find( *s.inner, search );
    236239}
    237240
    238 int find(const string &s, const string &search) {
     241int find(const string & s, const string & search) {
    239242    return find( *s.inner, *search.inner );
    240243}
    241244
    242 int find(const string &s, const char* search) {
     245int find(const string & s, const char * search) {
    243246    return find( *s.inner, search);
    244247}
    245248
    246 int find(const string &s, const char* search, size_t searchsize) {
     249int find(const string & s, const char * search, size_t searchsize) {
    247250    return find( *s.inner, search, searchsize);
    248251}
    249252
    250 int findFrom(const string &s, size_t fromPos, char search) {
     253int findFrom(const string & s, size_t fromPos, char search) {
    251254    return findFrom( *s.inner, fromPos, search );
    252255}
    253256
    254 int findFrom(const string &s, size_t fromPos, const string &search) {
     257int findFrom(const string & s, size_t fromPos, const string & search) {
    255258    return findFrom( *s.inner, fromPos, *search.inner );
    256259}
    257260
    258 int findFrom(const string &s, size_t fromPos, const char* search) {
     261int findFrom(const string & s, size_t fromPos, const char * search) {
    259262    return findFrom( *s.inner, fromPos, search );
    260263}
    261264
    262 int findFrom(const string &s, size_t fromPos, const char* search, size_t searchsize) {
     265int findFrom(const string & s, size_t fromPos, const char * search, size_t searchsize) {
    263266    return findFrom( *s.inner, fromPos, search, searchsize );
    264267}
    265268
    266 bool includes(const string &s, const string &search) {
     269bool includes(const string & s, const string & search) {
    267270    return includes( *s.inner, *search.inner );
    268271}
    269272
    270 bool includes(const string &s, const char* search) {
     273bool includes(const string & s, const char * search) {
    271274    return includes( *s.inner, search );
    272275}
    273276
    274 bool includes(const string &s, const char* search, size_t searchsize) {
     277bool includes(const string & s, const char * search, size_t searchsize) {
    275278    return includes( *s.inner, search, searchsize );
    276279}
    277280
    278 bool startsWith(const string &s, const string &prefix) {
     281bool startsWith(const string & s, const string & prefix) {
    279282    return startsWith( *s.inner, *prefix.inner );
    280283}
    281284
    282 bool startsWith(const string &s, const char* prefix) {
     285bool startsWith(const string & s, const char * prefix) {
    283286    return startsWith( *s.inner, prefix );
    284287}
    285288
    286 bool startsWith(const string &s, const char* prefix, size_t prefixsize) {
     289bool startsWith(const string & s, const char * prefix, size_t prefixsize) {
    287290    return startsWith( *s.inner, prefix, prefixsize );
    288291}
    289292
    290 bool endsWith(const string &s, const string &suffix) {
     293bool endsWith(const string & s, const string & suffix) {
    291294    return endsWith( *s.inner, *suffix.inner );
    292295}
    293296
    294 bool endsWith(const string &s, const char* suffix) {
     297bool endsWith(const string & s, const char * suffix) {
    295298    return endsWith( *s.inner, suffix );
    296299}
    297300
    298 bool endsWith(const string &s, const char* suffix, size_t suffixsize) {
     301bool endsWith(const string & s, const char * suffix, size_t suffixsize) {
    299302    return endsWith( *s.inner, suffix, suffixsize );
    300303}
     
    326329
    327330
    328 int exclude(const string &s, const charclass &mask) {
     331int exclude(const string & s, const charclass & mask) {
    329332    return exclude( *s.inner, *mask.inner );
    330333}
    331334/*
    332 StrSlice exclude(string &s, const charclass &mask) {
     335StrSlice exclude(string & s, const charclass & mask) {
    333336}
    334337*/
    335338
    336 int include(const string &s, const charclass &mask) {
     339int include(const string & s, const charclass & mask) {
    337340    return include( *s.inner, *mask.inner );
    338341}
    339342
    340343/*
    341 StrSlice include(string &s, const charclass &mask) {
     344StrSlice include(string & s, const charclass & mask) {
    342345}
    343346*/
Note: See TracChangeset for help on using the changeset viewer.