クラス sc_dt::sc_string_rep

すべてのメンバ一覧

Private メソッド

 sc_string_rep (int size=16)
 sc_string_rep (const char *s)
 sc_string_rep (const char *s, int n)
 ~sc_string_rep ()
void resize (int new_size)
void set_string (const char *s)

Private 変数

int ref_count
int alloc
char * str

フレンド

class sc_string_old
friend::std::ostream & operator<< (::std::ostream &, const sc_string_old &)
friend::std::istream & operator>> (::std::istream &, sc_string_old &)
sc_string_old operator+ (const char *, const sc_string_old &)


説明

sc_string.cpp109 行で定義されています。


コンストラクタとデストラクタ

sc_dt::sc_string_rep::sc_string_rep ( int  size = 16  )  [inline, private]

sc_string.cpp116 行で定義されています。

00117     {
00118         ref_count = 1;
00119         alloc = sc_roundup( size, 16 );
00120         str = new char[alloc];
00121         *str = '\0';
00122     }

sc_dt::sc_string_rep::sc_string_rep ( const char *  s  )  [inline, private]

sc_string.cpp124 行で定義されています。

00125     {
00126         ref_count = 1;
00127         if (s) {
00128             alloc = 1 + strlen(s);
00129             str = strcpy( new char[alloc], s );
00130         }
00131         else {
00132             alloc = 16;
00133             str = strcpy( new char[alloc], "" );
00134         }
00135     }

sc_dt::sc_string_rep::sc_string_rep ( const char *  s,
int  n 
) [private]

sc_string.cpp156 行で定義されています。

00157 {
00158     ref_count = 1;
00159     if (s && n>0) {
00160         alloc = 1 + n;
00161         str = strncpy( new char[alloc], s,n );
00162         str[n] = 00;
00163     }
00164     else {
00165         alloc = 16;
00166         str = strcpy( new char[alloc], "" );
00167     }
00168 }

sc_dt::sc_string_rep::~sc_string_rep (  )  [inline, private]

sc_string.cpp139 行で定義されています。

00140     {
00141         assert( ref_count == 0 );
00142         delete[] str;
00143     }


関数

void sc_dt::sc_string_rep::resize ( int  new_size  )  [private]

sc_string.cpp171 行で定義されています。

00172 {
00173     if (new_size <= alloc) return;
00174     alloc = sc_roundup( new_size, 16 );
00175     char* new_str = strcpy( new char[alloc], str );
00176     delete[] str;
00177     str = new_str;
00178 }

void sc_dt::sc_string_rep::set_string ( const char *  s  )  [private]

sc_string.cpp181 行で定義されています。

00182 {
00183     int len = strlen(s);
00184     resize( len + 1 );
00185     strcpy( str, s );
00186 }


フレンドと関連する関数

friend class sc_string_old [friend]

sc_string.cpp111 行で定義されています。

::std::ostream& operator<< ( ::std::ostream &  os,
const sc_string_old a 
) [friend]

sc_string.h323 行で定義されています。

00324 {
00325     a.print( os );
00326     return os;
00327 }

::std::istream& operator>> ( ::std::istream &  is,
sc_string_old s 
) [friend]

sc_string.cpp638 行で定義されています。

00639 {
00640     if( s.rep->ref_count > 1 ) {
00641         -- s.rep->ref_count;
00642         s.rep = new sc_string_rep;
00643     }
00644 
00645     int i = 0;
00646     char* p = s.rep->str;
00647     char c;
00648 
00649     // skip white spaces
00650     while( is.get( c ) && isspace( c ) )
00651         ;
00652 
00653     for( ; is.good() && ! isspace( c ); is.get( c ) ) {
00654         if( i > s.rep->alloc - 2 ) {
00655             s.rep->str[i] = '\0';
00656             s.rep->resize( (int) (s.rep->alloc * 1.5) );
00657             p = s.rep->str + i;
00658         }
00659         *p ++ = c;
00660         i ++;
00661     }
00662     *p = '\0';
00663 
00664     return is;
00665 }

sc_string_old operator+ ( const char *  ,
const sc_string_old  
) [friend]

sc_string.cpp261 行で定義されています。

00262 {
00263     int len = strlen(s);
00264     sc_string_rep* r = new sc_string_rep( len + t.length() + 1 );
00265     strcpy( r->str, s );
00266     strcpy( r->str + len, t );
00267     return sc_string_old(r);
00268 }


変数

sc_string.cpp148 行で定義されています。

sc_string.cpp149 行で定義されています。

char* sc_dt::sc_string_rep::str [private]

sc_string.cpp150 行で定義されています。


このクラスの説明は次のファイルから生成されました:

SystemCに対してFri Jun 6 20:13:08 2008に生成されました。  doxygen 1.5.6