Changeset 887
- Timestamp:
- Jun 29, 2003, 8:49:44 PM (18 years ago)
- Location:
- to-imperative/trunk/runtime
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
to-imperative/trunk/runtime/rf_string.hh
r358 r887 12 12 { 13 13 14 template <typename type_t> 14 using namespace rfrt; 15 15 16 class String : 16 public Object 17 public Object, public pxx::WString 17 18 { 19 20 private: 21 22 static ObjectRegister reg ; 18 23 19 24 public: 20 25 21 // 22 // Construct Object from _t and then downcast it to String. _t really should 23 // be a symbol--reference to string. 24 inline String (const Term& _t) ; 26 inline String (size_t len); 27 28 static Expr create_expr(String* _string) ; 25 29 26 // 27 // Create a string of length _len. Don't initialize its contents. 28 inline String (size_t _len) ; 29 30 // 31 // Copy constructor. Create reference, don't copy string contents. 32 inline String (const String& _str) ; 33 34 // 35 // Destructor. 36 inline ~String () ; 37 38 // 39 // Make us to be a reference to _str. 40 inline const String& operator= (const String& _str) ; 41 42 // 43 // Create a string (not reference) equal to substring of _str starting from 44 // position _pos and of length _len. 45 inline 46 String substring (const String& _str, uintptr_t _pos, size_t _len) const ; 47 48 // 49 // Return string length. 50 inline size_t get_len () const ; 51 52 // 53 // Return reference to the symbol in position _pos. Position should be 54 // valid. 55 inline type_t& operator[] (uintptr_t _pos) const ; 56 57 // 58 // Fill the part of the string starting from _pos of length _len with symbol 59 // _sym. All positions should be valid. 60 inline void fill (uintptr_t _pos, size_t _len, type_t _sym) ; 61 62 // 63 // Fill the part of the string starting from _pos with symbols from string 64 // _str. All positions to be filled should be valid. 65 inline void fill_with_string (uintptr_t _pos, const String& _str) ; 66 67 30 static Expr fill(String& _str, size_t _pos, 31 size_t _len, wchar_t const _fill); 68 32 69 33 // 70 34 // Virtual functions from Object. 71 35 // 72 inline bool operator == (const Object& _obj) const ;36 inline bool operator == (Object const& _obj) const ; 73 37 74 inline bool operator!= (const Object& _obj) const ;38 inline unsigned get_type () const ; 75 39 76 inline bool operator>= (const Object& _obj) const ; 77 78 inline bool operator<= (const Object& _obj) const ; 79 80 inline bool operator> (const Object& _obj) const ; 81 82 inline bool operator< (const Object& _obj) const ; 83 84 inline int compare (const Object& _obj) const ; 85 86 inline void write (FILE* _fp) const ; 87 88 // 89 // Return number of characters in print representation 90 inline size_t get_char_len () const ; 91 92 // 93 // Write print representation (Terms of type symbol-character) to *_p. 94 // Return pointer beyond the last written term. 95 inline Term* to_chars (Term* _p) const ; 96 97 98 99 class Iterator 100 { 101 String& str ; 102 type_t* ptr ; 103 104 // 105 // Private constructor for use in operators + and -. 106 inline Iterator (String& _str, type_t* _ptr) ; 40 inline uint32_t hash () const ; 41 }; 107 42 108 public:109 110 inline Iterator (String& _str) ;111 112 inline ~Iterator () ;113 114 inline const Iterator& operator= (const Iterator& _i) ;115 116 inline bool in_bounds () const ;117 118 inline String* operator-> () const ;119 120 inline type_t& operator* () const ;121 122 inline void fill (size_t _len, type_t _sym) const ;123 124 inline void fill_with_string (const String& _str) const ;125 126 inline Iterator& operator++ () ;127 128 inline Iterator& operator++ (int) ;129 130 inline Iterator& operator-- () ;131 132 inline Iterator& operator-- (int) ;133 134 inline Iterator& operator+= (intptr_t _offset) ;135 136 inline Iterator& operator-= (intptr_t _offset) ;137 138 inline Iterator operator+ (intptr_t _offset) const ;139 140 inline Iterator operator- (intptr_t _offset) const ;141 142 };143 144 145 146 //147 // Functions for use from Term.148 //149 static bool eq (uintptr_t _ptr1, uintptr_t _ptr2) ;150 151 static bool neq (uintptr_t _ptr1, uintptr_t _ptr2) ;152 153 static bool gte (uintptr_t _ptr1, uintptr_t _ptr2) ;154 155 static bool lte (uintptr_t _ptr1, uintptr_t _ptr2) ;156 157 static bool gt (uintptr_t _ptr1, uintptr_t _ptr2) ;158 159 static bool lt (uintptr_t _ptr1, uintptr_t _ptr2) ;160 161 static int compare (uintptr_t _ptr1, uintptr_t _ptr2) ;162 163 static void write (uintptr_t _ptr, FILE* _fp) ;164 165 static size_t get_char_len (uintptr_t _ptr) ;166 167 static Term* to_chars (uintptr_t, Term* _p) ;168 169 43 }; 170 44 171 }172 173 45 #endif // __rf_string_hh__
Note: See TracChangeset
for help on using the changeset viewer.