Lolly 1.4.27
Loading...
Searching...
No Matches
Private Member Functions | List of all members
string Class Reference

#include <string.hpp>

Private Member Functions

 CONCRETE (string)
 
 string ()
 
 string (int n)
 
 string (char c)
 
 string (char c, int n)
 
 string (const char *s)
 
 string (const char *s, int n)
 
charoperator[] (int i)
 
bool operator== (const char *s)
 
bool operator!= (const char *s)
 
bool operator== (string s)
 
bool operator!= (string s)
 
string operator() (int start, int end)
 
charbegin ()
 
charend ()
 
 operator string_view< char > ()
 

Detailed Description

Definition at line 62 of file string.hpp.

Constructor & Destructor Documentation

◆ string() [1/6]

string::string ( )
inlineprivate

Definition at line 64 of file string.hpp.

64: rep (tm_new<string_rep> ()) {}
The list class represents a linked list.
Definition list.hpp:48
base class of resources
Definition resource.hpp:23

◆ string() [2/6]

string::string ( int n)
inlineprivate

Definition at line 65 of file string.hpp.

65: rep (tm_new<string_rep> (n)) {}

◆ string() [3/6]

string::string ( char c)
private

Definition at line 94 of file string.cpp.

94 {
96 rep->a[0]= c;
97}

◆ string() [4/6]

string::string ( char c,
int n )
private

Definition at line 99 of file string.cpp.

99 {
101 for (int i= 0; i < n; i++)
102 rep->a[i]= c;
103}

◆ string() [5/6]

string::string ( const char * s)
private

Definition at line 105 of file string.cpp.

105 {
106 int i, n= strlen (a);
108 for (i= 0; i < n; i++)
109 rep->a[i]= a[i];
110}

◆ string() [6/6]

string::string ( const char * s,
int n )
private

Definition at line 112 of file string.cpp.

112 {
113 int i;
115 for (i= 0; i < n; i++)
116 rep->a[i]= a[i];
117}

Member Function Documentation

◆ CONCRETE()

string::CONCRETE ( string )
private

◆ operator[]()

char & string::operator[] ( int i)
inlineprivate

Definition at line 70 of file string.hpp.

70{ return rep->a[i]; }

◆ operator==() [1/2]

bool string::operator== ( const char * s)
private

Definition at line 124 of file string.cpp.

124 {
125 int i, n= rep->n;
126 char* S= rep->a;
127 for (i= 0; i < n; i++) {
128 if (s[i] != S[i]) return false;
129 if (s[i] == '\0') return false;
130 }
131 return (s[i] == '\0');
132}

◆ operator!=() [1/2]

bool string::operator!= ( const char * s)
private

Definition at line 135 of file string.cpp.

135 {
136 int i, n= rep->n;
137 char* S= rep->a;
138 for (i= 0; i < n; i++) {
139 if (s[i] != S[i]) return true;
140 if (s[i] == '\0') return true;
141 }
142 return (s[i] != '\0');
143}

◆ operator==() [2/2]

bool string::operator== ( string s)
private

Definition at line 146 of file string.cpp.

146 {
147 return ((string_view<char>) *this) == ((string_view<char>) a);
148}

◆ operator!=() [2/2]

bool string::operator!= ( string s)
private

Definition at line 151 of file string.cpp.

151 {
152 return ((string_view<char>) *this) != ((string_view<char>) a);
153}

◆ operator()()

string string::operator() ( int start,
int end )
private

Definition at line 156 of file string.cpp.

156 {
157 if (end <= begin) return string ();
158
159 int i;
160 begin= max (min (rep->n, begin), 0);
161 end = max (min (rep->n, end), 0);
162 string r (end - begin);
163 for (i= begin; i < end; i++)
164 r[i - begin]= rep->a[i];
165 return r;
166}
string()
Definition string.hpp:64
char * end()
Definition string.hpp:77
char * begin()
Definition string.hpp:76
SI min(SI i, SI j)
Returns the minimum of two signed integers.
Definition minmax.hpp:27
SI max(SI i, SI j)
Returns the maximum of two signed integers.
Definition minmax.hpp:40

◆ begin()

char * string::begin ( )
inlineprivate

Definition at line 76 of file string.hpp.

76{ return rep->a; }

◆ end()

char * string::end ( )
inlineprivate

Definition at line 77 of file string.hpp.

77{ return rep->a + rep->n; }

◆ operator string_view< char >()

string::operator string_view< char > ( )
inlineprivate

Definition at line 79 of file string.hpp.

79 {
80 return string_view<char> (rep->a, rep->n);
81 }

The documentation for this class was generated from the following files: