Changeset 1019


Ignore:
Timestamp:
Jul 17, 2003, 10:08:22 AM (17 years ago)
Author:
luba
Message:
  • String::fill(String&, size_t, size_t, wchar_t) method is corrected
Location:
to-imperative/trunk/runtime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/runtime/rf_string.cc

    r1010 r1019  
    88using namespace rfrt ;
    99
    10 Expr String::create_expr(String*  _string) {
    11   Expr e = Expr(dynamic_cast<Object*>(_string));
    12   WString str = WString(e);
    13   size_t i = str.get_length();
    14   printf("i = %u\n", i);
    15   for (size_t i = 0; i < str.get_length(); i++) {
    16     printf ("str[i] = %c\n", str[i]);
    17     printf("create_expr\n");
    18   }
    19   return e;
    20 }
    21 
    2210Expr String::fill(String& _str, size_t _pos, size_t _len, wchar_t const _fill)
    2311 {
     
    2513    _str[i] = _fill;
    2614  }
    27   return String::create_expr(&_str);
     15  return Expr(new rftype::String(_str));
    2816}
    2917
  • to-imperative/trunk/runtime/rf_string.hh

    r887 r1019  
    2525
    2626  inline String (size_t len);
     27
     28  inline String (WString const& _s);
     29
     30  inline String& operator = (String const& _s) ;
    2731 
    28   static Expr create_expr(String*  _string) ;
    2932
    3033  static Expr fill(String& _str, size_t _pos,
     
    3942
    4043  inline uint32_t hash () const ;
     44
     45
    4146};
    4247 
  • to-imperative/trunk/runtime/rf_string.ih

    r887 r1019  
    1414  WString(_len)
    1515{}
     16
     17inline String::String (WString const& _s):
     18  Object(),
     19  WString(_s)
     20{}
     21
     22inline String& String::operator = (String const& _s) {
     23  if (this != &_s) {
     24    this->~String();
     25    new(this) String(_s);
     26  }
     27  return self;
     28}
     29
     30
    1631
    1732inline unsigned String::get_type () const
     
    3853
    3954
     55
    4056}
    4157
Note: See TracChangeset for help on using the changeset viewer.