Пример #1
0
ID3_FrameImpl &
ID3_FrameImpl::operator=( const ID3_Frame &rFrame )
{
  ID3_FrameID eID = rFrame.GetID();
  this->SetID(eID);
  ID3_Frame::ConstIterator* ri = rFrame.CreateIterator();
  iterator li = this->begin();
  while (li != this->end())
  {
    ID3_Field* thisFld = *li++;
    const ID3_Field* thatFld = ri->GetNext();
    if (thisFld != NULL && thatFld != NULL)
    {
      *thisFld = *thatFld;
    }
  }
  delete ri;
  this->SetEncryptionID(rFrame.GetEncryptionID());
  this->SetGroupingID(rFrame.GetGroupingID());
  this->SetCompression(rFrame.GetCompression());
  this->SetSpec(rFrame.GetSpec());
  _changed = false;
  
  return *this;
}
CString id3_GetStringUFID(const ID3_Frame *frame, ID3_FieldID fldName)
{
  const char *text1 = NULL;
  const uchar *text2 = NULL;
  char * text = NULL;
  size_t bsize = 0;
  CString Text;
  if (NULL != frame)
  {

   ID3_Frame::ConstIterator* iter = frame->CreateIterator();
   const ID3_Field* myField = NULL;
   while (NULL != (myField = iter->GetNext()))
   {
        ID3_FieldID field_id = myField->GetID ();
        if (field_id == ID3FN_OWNER) {
            text1 = myField->GetRawText();
        } else if (field_id == ID3FN_DATA) {
            bsize = myField->BinSize();
            text2 = myField->GetRawBinary();
        }

   }
   delete iter;
   if (text1 && text2) {
       int len1 = strlen(text1);
       int lent = len1 + bsize + 2;
       text = new char[lent];
       memset(text,0, lent);
       strcpy(text, text1);
       text[len1] = ' ';
       memcpy(text + len1 + 1, text2, bsize);
       Text = text;
       ID3_FreeString(text);

   }

  }
  return Text;
}