Logo Search packages:      
Sourcecode: yate version File versions  Download package

String & String::operator+= ( const char *  value  ) 

Appending operator for strings.

See also:
TelEngine::strcat

Definition at line 413 of file String.cpp.

References changed(), TelEngine::Debug(), length(), TelEngine::strcat(), and TelEngine::strcpy().

Referenced by operator+=(), and operator<<().

{
    if (value && !*value)
      value = 0;
    if (value) {
      if (m_string) {
          int len = ::strlen(value)+length();
          char *tmp1 = m_string;
          char *tmp2 = (char *) ::malloc(len+1);
          if (tmp2) {
		::strcpy(tmp2,m_string);
		::strcat(tmp2,value);
            m_string = tmp2;
            ::free(tmp1);
          }
          else
            Debug("String",DebugFail,"malloc(%d) returned NULL!",len+1);
      }
      else {
          m_string = ::strdup(value);
          if (!m_string)
            Debug("String",DebugFail,"strdup() returned NULL!");
      }
      changed();
    }
    return *this;
}


Generated by  Doxygen 1.6.0   Back to index