Lolly 1.4.28
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
_ts_string Struct Reference
Collaboration diagram for _ts_string:
Collaboration graph
[legend]

Public Member Functions

 _ts_string ()
 
 ~_ts_string ()
 
void resize (int m)
 
void append (char *b, int m)
 
void copy (char *b, int m)
 

Public Attributes

int n
 
int l
 
chara
 

Detailed Description

Definition at line 63 of file unix_sys_utils.cpp.

Constructor & Destructor Documentation

◆ _ts_string()

_ts_string::_ts_string ( )
inline

Definition at line 67 of file unix_sys_utils.cpp.

67: n (0), l (0), a (NULL) {}
The list class represents a linked list.
Definition list.hpp:48

◆ ~_ts_string()

_ts_string::~_ts_string ( )
inline

Definition at line 68 of file unix_sys_utils.cpp.

68 {
69 if (l != 0) _ts_free ((void*) a);
70 }
void _ts_free(void *a)

Member Function Documentation

◆ resize()

void _ts_string::resize ( int m)
inline

Definition at line 72 of file unix_sys_utils.cpp.

72 {
73 if (m <= n) return;
74 int new_l= max (2 * n, m);
75 char* new_a= (char*) _ts_malloc (new_l * sizeof (char));
76 memcpy (new_a, a, n);
77 _ts_free ((void*) a);
78 a= new_a;
79 l= new_l;
80 }
SI max(SI i, SI j)
Returns the maximum of two signed integers.
Definition minmax.hpp:40
void * _ts_malloc(int n)

◆ append()

void _ts_string::append ( char * b,
int m )
inline

Definition at line 82 of file unix_sys_utils.cpp.

82 {
83 resize (m + n);
84 memcpy (a + n, b, m);
85 n+= m;
86 }
blackbox b[13]
void resize(int m)

◆ copy()

void _ts_string::copy ( char * b,
int m )
inline

Definition at line 88 of file unix_sys_utils.cpp.

88 {
89 resize (m);
90 memcpy (a, b, m);
91 n= m;
92 }

Member Data Documentation

◆ n

int _ts_string::n

Definition at line 64 of file unix_sys_utils.cpp.

◆ l

int _ts_string::l

Definition at line 64 of file unix_sys_utils.cpp.

◆ a

char* _ts_string::a

Definition at line 65 of file unix_sys_utils.cpp.


The documentation for this struct was generated from the following file: