Changeset b1eefe50


Ignore:
Timestamp:
Jan 19, 2024, 4:36:18 PM (11 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
dd10bf4
Parents:
ac939461
Message:

Adjust string assignment declarations for consistent/standard return type.

Location:
libcfa/src/collections
Files:
2 edited

Legend:

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

    rac939461 rb1eefe50  
    9191// Assignment
    9292
    93 void ?=?( string & s, const char * val ) {
    94     (*s.inner) = val;
    95 }
    96 
    97 // with and without const on "other" argument helps keep prevent autogen ?=? calls
    98 void ?=?(string & s, const string & c) {
     93string & ?=?(string & s, const string & c) {
    9994    (*s.inner) = (*c.inner);
    100 }
     95    return s;
     96}
     97
    10198string & ?=?(string & s, string & c) {
    10299    (*s.inner) = (*c.inner);
     
    104101}
    105102
    106 void ?=?( string & s, char val ) {
     103string & ?=?( string & s, const char * val ) {
    107104    (*s.inner) = val;
    108 }
    109 
    110 void assign(string & s, const string & c, size_t n) {
     105    return s;
     106}
     107
     108string & ?=?( string & s, char val ) {
     109    (*s.inner) = val;
     110    return s;
     111}
     112
     113string & assign(string & s, const string & c, size_t n) {
    111114    assign(*s.inner, *c.inner, n);
    112 }
    113 void assign(string & s, const char * c, size_t n) {
     115    return s;
     116}
     117
     118string & assign(string & s, const char * c, size_t n) {
    114119    assign(*s.inner, c, n);
     120    return s;
    115121}
    116122
  • libcfa/src/collections/string.hfa

    rac939461 rb1eefe50  
    4141void ?{}(string & s, const char * c, size_t size); // copy specific length from buffer
    4242
    43 void ?=?(string & s, const char * c); // copy assignment from literal
    44 void ?=?(string & s, const string & c);
    45 void ?=?(string & s, char c);
    46 string & ?=?(string & s, string & c);  // surprising ret seems to help avoid calls to autogen
    47 void assign(string & s, const string & c, size_t n);
    48 void assign(string & s, const char * c, size_t n);
    49 //string ?=?( string &, string ) = void;
     43string & ?=?(string & s, const string & c);
     44string & ?=?(string & s, string & c);
     45string & ?=?(string & s, const char * c); // copy from "literal"
     46string & ?=?(string & s, char c);  // copy from 'l'
     47string & assign(string & s, const string & c, size_t n);
     48string & assign(string & s, const char * c, size_t n);
    5049
    5150static inline string & strcpy(string & s, const char * c) { s = c; return s; }
Note: See TracChangeset for help on using the changeset viewer.