string_rep Class Reference

#include <string.hpp>

Inheritance diagram for string_rep:
rep_struct

List of all members.

Public Member Functions

Public Attributes

Friends


Detailed Description

Definition at line 25 of file string.hpp.


Constructor & Destructor Documentation

string_rep ( nat  n2  )  [inline]

Definition at line 32 of file string.hpp.

00032 : a ((char*) mmx_malloc (n2)), n(n2), l(n2) {}

~string_rep (  )  [inline]

Definition at line 33 of file string.hpp.

References mmx::mmx_free().

00033 { mmx_free ((void*) a, l); }


Member Function Documentation

void extend ( nat  n  ) 

Definition at line 370 of file string.cpp.

References mmx::max(), mmx::mmx_free(), and mmx::mmx_malloc().

Referenced by string::operator<<().

00370                          {
00371   if (n+d > l) {
00372     register nat old_l= l;
00373     l= max (l << 1, n+d);
00374     char* b= (char*) mmx_malloc (l);
00375     for (nat i=0; i<n; i++)
00376       b[i]= a[i];
00377     mmx_free ((void*) a, old_l);
00378     a= b;
00379   }
00380   n += d;
00381 }

void resize ( nat  n  ) 

Definition at line 42 of file string.cpp.

References mmx::max(), mmx::min(), mmx::mmx_free(), and mmx::mmx_malloc().

Referenced by string::operator>>(), and mmx::unescape().

00042                           {
00043   nat l2;
00044   if (n2 > l) l2= max (n2, l << 1);
00045   else if (n2 < (l >> 1)) l2= n2;
00046   else { n= n2; return; }
00047   nat m= min (n, n2);
00048   char* b= (char*) mmx_malloc (l2);
00049   for (nat i=0; i<m; i++) b[i]= a[i];
00050   mmx_free ((void*) a, l);
00051   a= b;
00052   n= n2;
00053   l= l2;
00054 }


Friends And Related Function Documentation

double as_double ( const string s  )  [friend]
int as_int ( const string s  )  [friend]
bool busy ( const string s  )  [friend]
string copy ( const string s  )  [friend]
char* inside ( const string s,
nat  pos 
) [friend]

Definition at line 110 of file string.hpp.

00110                                                {
00111   return s.rep->a + pos; }

nat N ( const string s  )  [friend]
string operator* ( const string s,
const string t 
) [friend]

Definition at line 411 of file string.cpp.

00411                                                 {
00412   register nat i, n1=N(s1), n2=N(s2);
00413   string r (n1 + n2);
00414   for (i=0; i<n1; i++) r.rep->a[i   ]= s1.rep->a[i];
00415   for (i=0; i<n2; i++) r.rep->a[i+n1]= s2.rep->a[i];
00416   return r;
00417 }

char read ( const string s,
nat  i 
) [friend]
const char* S ( const string s  )  [friend]
char* S ( string s  )  [friend]
friend class string [friend]

Definition at line 37 of file string.hpp.


Member Data Documentation

MMX_ALLOCATORS int ref_count [inherited]

Definition at line 164 of file basix.hpp.


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

Generated on 6 Dec 2012 for basix by  doxygen 1.6.1