예제 #1
0
 size_t Set(const TextBuf &other)
 {
     if (other.IsByteStr() ) {
         return SetText(other.GetText(), other.GetLen());
     }
     else {
         return SetStr(other.GetStr());
     }
 }
예제 #2
0
 bool operator == (const TextBuf &other) const
 {
     if (IsNull() || other.IsNull() ) {
         return false;
     }
     if (IsByteStr() || other.IsByteStr()) {
         if (GetLen() != other.GetLen()) {
             return false;
         }
         else if (GetLen() == 0) {
             return true;
         }
         else {
             return (memcmp(GetBuf(), other.GetBuf(), GetLen()) == 0);
         }
     }
     else {
         return (strcmp(GetBuf(), other.GetBuf()) == 0);
     }
 };