Lolly 1.4.28
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 40 of file string.hpp.

Constructor & Destructor Documentation

◆ string() [1/6]

string::string ( )
inlineprivate

Definition at line 42 of file string.hpp.

42: 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 43 of file string.hpp.

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

◆ string() [3/6]

string::string ( char c)
private

Definition at line 56 of file string.cpp.

56 {
58 rep->a[0]= c;
59}

◆ string() [4/6]

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

Definition at line 61 of file string.cpp.

61 {
63 for (int i= 0; i < n; i++)
64 rep->a[i]= c;
65}

◆ string() [5/6]

string::string ( const char * s)
private

Definition at line 67 of file string.cpp.

67 {
68 int i, n= strlen (a);
70 for (i= 0; i < n; i++)
71 rep->a[i]= a[i];
72}

◆ string() [6/6]

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

Definition at line 74 of file string.cpp.

74 {
75 int i;
77 for (i= 0; i < n; i++)
78 rep->a[i]= a[i];
79}

Member Function Documentation

◆ CONCRETE()

string::CONCRETE ( string )
private

◆ operator[]()

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

Definition at line 48 of file string.hpp.

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

◆ operator==() [1/2]

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

Definition at line 86 of file string.cpp.

86 {
87 int i, n= rep->n;
88 char* S= rep->a;
89 for (i= 0; i < n; i++) {
90 if (s[i] != S[i]) return false;
91 if (s[i] == '\0') return false;
92 }
93 return (s[i] == '\0');
94}

◆ operator!=() [1/2]

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

Definition at line 97 of file string.cpp.

97 {
98 int i, n= rep->n;
99 char* S= rep->a;
100 for (i= 0; i < n; i++) {
101 if (s[i] != S[i]) return true;
102 if (s[i] == '\0') return true;
103 }
104 return (s[i] != '\0');
105}

◆ operator==() [2/2]

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

Definition at line 108 of file string.cpp.

108 {
109 return ((string_view<char>) *this) == ((string_view<char>) a);
110}

◆ operator!=() [2/2]

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

Definition at line 113 of file string.cpp.

113 {
114 return ((string_view<char>) *this) != ((string_view<char>) a);
115}

◆ operator()()

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

Definition at line 118 of file string.cpp.

118 {
119 if (end <= begin) return string ();
120
121 int i;
122 begin= max (min (rep->n, begin), 0);
123 end = max (min (rep->n, end), 0);
124 string r (end - begin);
125 for (i= begin; i < end; i++)
126 r[i - begin]= rep->a[i];
127 return r;
128}
string()
Definition string.hpp:42
char * end()
Definition string.hpp:55
char * begin()
Definition string.hpp:54
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 54 of file string.hpp.

54{ return rep->a; }

◆ end()

char * string::end ( )
inlineprivate

Definition at line 55 of file string.hpp.

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

◆ operator string_view< char >()

string::operator string_view< char > ( )
inlineprivate

Definition at line 57 of file string.hpp.

57 {
58 return string_view<char> (rep->a, rep->n);
59 }

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