Exemplo n.º 1
0
void TString::IntToStr(int value)
{
  char buf[128];

  sprintf(buf,"%d",value);
  PrepareSpace(strlen(buf)+1);
  strcpy(data,buf);
}
Exemplo n.º 2
0
void TString::DoubleToStr(double value)
{
  char buf[128];

  sprintf(buf,"%*g",5,value);
  PrepareSpace(strlen(buf)+1);
  strcpy(data,buf);
}
Exemplo n.º 3
0
void TString::sprintf(char* format, ...)
{
  va_list args;
  char buf[128];

  va_start(args,format);
  vsprintf(buf,format,args);
  PrepareSpace(strlen(buf)+1);
  strcpy(data,buf);
  va_end(args);
}
Exemplo n.º 4
0
		vint MemoryStream::Write(void* _buffer, vint _size)
		{
			CHECK_ERROR(block!=0, L"MemoryStream::Write(pos_t)#Stream is closed, cannot perform this operation.");
			CHECK_ERROR(_size>=0, L"MemoryStream::Write(void*, vint)#Argument size cannot be negative.");
			PrepareSpace(size+_size);
			memmove(buffer+position, _buffer, _size);
			position+=_size;
			if(size<position)
			{
				size=position;
			}
			return _size;
		}
Exemplo n.º 5
0
void TString::RFrac(int frompos)
{
  char *keep;

  if (frompos>Length()-1)
    return;

  keep = (char *) xmalloc(size);
  strcpy(keep,data);

  PrepareSpace(frompos+1);
  if (frompos>1)
    memcpy(data,keep,frompos);
  data[frompos] = '\0';

  free(keep);
}
Exemplo n.º 6
0
void TString::LFrac(int topos)
{
  int count;
  char *keep;

  if (topos<0)
    return;

  keep = (char *) xmalloc(size);
  strcpy(keep,data);

  count = Length()-topos;
  PrepareSpace(count);
  memcpy(data,&keep[topos+1],count);

  free(keep);
}
Exemplo n.º 7
0
TString &TString::operator=(char *s) 
{ 
  PrepareSpace(strlen(s)+1); 
  strcpy(data,s); 
  return *this; 
} 
Exemplo n.º 8
0
TString &TString::operator+(char *s) 
{ 
  PrepareSpace(Length()+strlen(s)+1); 
  strcat(data,s); 
  return *this; 
} 
Exemplo n.º 9
0
TString &TString::operator+(TString &s) 
{ 
  PrepareSpace(Length()+s.Length()+1); 
  strcat(data,s.data); 
  return *this; 
} 
Exemplo n.º 10
0
void TString::Copy(TString &source, int from, int count)
{
  PrepareSpace(count+1);
  memcpy(data,&source.data[from],count);
  data[count] = '\0';
}
Exemplo n.º 11
0
TString &TString::operator=(TString &s) 
{ 
  PrepareSpace(s.size); 
  strcpy(data,s.data); 
  return *this; 
}