#include "StdAfx.h" #include "T2Archive.h" #include "T2MovieParamArray.h" // unknown name struct MovieParam { DWORD code; int value; }; T2MovieParamArray::T2MovieParamArray() : LArray(sizeof(MovieParam)) { } /*virtual*/ T2MovieParamArray::~T2MovieParamArray() { } BOOL T2MovieParamArray::Regist(DWORD inCode, int inValue) { LArrayIterator iterator(*this); MovieParam entry; while (iterator.Next(&entry)) { if (entry.code == inCode) return false; } entry.code = inCode; entry.value = inValue; InsertItemsAt(1, mItemCount + 1, &entry); return true; } int T2MovieParamArray::GetParam(DWORD inCode) { LArrayIterator iterator(*this); MovieParam entry; while (iterator.Next(&entry)) { if (entry.code == inCode) return entry.value; } return 0; } /*static*/ T2MovieParamArray* T2MovieParamArray::ReadMovieParamArray(T2Archive& inArchive) { T2MovieParamArray *theArray = NULL; DWORD code; inArchive >> code; if (code == 'mvPA') theArray = new T2MovieParamArray; if (theArray) theArray->Read(inArchive); return theArray; } /*static*/ void T2MovieParamArray::WriteMovieParamArray(T2MovieParamArray* inArray, T2Archive& inArchive) { DWORD code; if (!inArray) { code = 'xmPA'; inArchive << code; } else { code = 'mvPA'; inArchive << code; inArray->Write(inArchive); } } /*virtual*/ void T2MovieParamArray::Read(T2Archive& inArchive) { inArchive >> mItemSize; inArchive >> mItemCount; inArchive.Read(mBuffer, mItemSize * mItemCount); } /*virtual*/ void T2MovieParamArray::Write(T2Archive& inArchive) { inArchive << mItemSize; inArchive << mItemCount; inArchive.Write(mBuffer, mItemSize * mItemCount); }