本文整理汇总了C++中CAtlArray::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlArray::GetData方法的具体用法?C++ CAtlArray::GetData怎么用?C++ CAtlArray::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlArray
的用法示例。
在下文中一共展示了CAtlArray::GetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetShuffle
// Calling this function with bEnable equals to true when
// shuffle is already enabled will re-shuffle the tracks.
void CPlaylist::SetShuffle(bool bEnable)
{
m_bShuffle = bEnable;
if (bEnable && !IsEmpty()) {
m_nShuffledListSize = GetCount();
CAtlArray<plsort_t> positions;
positions.SetCount(m_nShuffledListSize + 1);
srand((unsigned int)time(nullptr));
POSITION pos = GetHeadPosition();
for (size_t i = 0; pos; i++, GetNext(pos)) {
positions[i].n = rand();
positions[i].pos = pos;
}
qsort(positions.GetData(), m_nShuffledListSize, sizeof(plsort_t), compare);
positions[m_nShuffledListSize].pos = nullptr; // Termination
m_posHeadShuffle = positions[0].pos;
m_posTailShuffle = nullptr;
for (size_t i = 0; i < m_nShuffledListSize; i++) {
pos = positions[i].pos;
CPlaylistItem& pli = GetAt(pos);
pli.m_posPrevShuffle = m_posTailShuffle;
pli.m_posNextShuffle = positions[i + 1].pos;
m_posTailShuffle = pos;
}
} else {
m_posHeadShuffle = m_posTailShuffle = nullptr;
m_nShuffledListSize = 0;
}
}
示例2: Expand
bool TrackEntry::Expand(CBinary& data, UINT64 Scope)
{
if (ces.ce.IsEmpty()) {
return true;
}
CAtlArray<ContentEncoding*> cearray;
POSITION pos = ces.ce.GetHeadPosition();
while (pos) {
cearray.Add(ces.ce.GetNext(pos));
}
qsort(cearray.GetData(), cearray.GetCount(), sizeof(ContentEncoding*), cesort);
for (int i = (int)cearray.GetCount() - 1; i >= 0; i--) {
ContentEncoding* ce = cearray[i];
if (!(ce->ContentEncodingScope & Scope)) {
continue;
}
if (ce->ContentEncodingType == ContentEncoding::Compression) {
if (!data.Decompress(ce->cc)) {
return false;
}
} else if (ce->ContentEncodingType == ContentEncoding::Encryption) {
// TODO
return false;
}
}
return true;
}
示例3: PutBytes
bool CJpegEncoderMem::PutBytes(const void* pData, int len)
{
CAtlArray<BYTE> moredata;
moredata.SetCount(len);
memcpy(moredata.GetData(), pData, len);
m_pdata->Append(moredata);
return true;
}
示例4: sizeof
HRESULT CAC3Encoder::Encode(CAtlArray<float>& BuffIn, CAtlArray<BYTE>& BuffOut)
{
int buffsamples = BuffIn.GetCount() / m_pAVCtx->channels;
if (buffsamples < m_pAVCtx->frame_size) {
return E_ABORT;
}
float* pEnc = m_pSamples;
float* pIn = BuffIn.GetData();
int channels = m_pAVCtx->channels;
int samples = m_pAVCtx->frame_size;
for (int ch = 0; ch < channels; ++ch) {
for (int i = 0; i < samples; ++i) {
*pEnc++ = pIn[channels * i + ch];
}
}
int ret;
AVPacket avpkt;
int got_packet;
av_init_packet(&avpkt);
avpkt.data = NULL; // packet data will be allocated by the encoder
avpkt.size = 0;
ret = avcodec_encode_audio2(m_pAVCtx, &avpkt, m_pFrame, &got_packet);
if (ret < 0) {
av_free_packet(&avpkt);
return E_FAIL;
}
if (got_packet) {
BuffOut.SetCount(avpkt.size);
memcpy(BuffOut.GetData(), avpkt.data, avpkt.size);
}
av_free_packet(&avpkt);
size_t old_size = BuffIn.GetCount() * sizeof(float);
size_t new_size = BuffIn.GetCount() * sizeof(float) - m_framesize;
size_t new_count = new_size / sizeof(float);
memmove(pIn, (BYTE*)pIn + m_framesize, new_size);
BuffIn.SetCount(new_count);
return S_OK;
}
示例5: SortByPath
void CPlaylist::SortByPath()
{
CAtlArray<plsort2_t> a;
a.SetCount(GetCount());
POSITION pos = GetHeadPosition();
for (int i = 0; pos; i++, GetNext(pos)) {
a[i].str = GetAt(pos).m_fns.GetHead(), a[i].pos = pos;
}
qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2);
for (size_t i = 0; i < a.GetCount(); i++) {
MoveToTail(a[i].pos);
}
}
示例6:
// 指定したcodepageのテキストとしてファイルを読み込みます
CString Util::File::ReadAllText(const CString& path, const UINT codePage)
{
CString rc;
CAtlFile file;
if(file.Create(path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING) != S_OK){
rc.Format(_T("ERROR: File Not Found[path=%s]\n"), (LPCTSTR)path);
return rc;
}
ULONGLONG size;
if(file.GetSize(size) != S_OK){
rc.Format(_T("ERROR: File GetSize[%s]\n"), (LPCTSTR)path);
return rc;
}
CAtlArray<char> buf;
buf.SetCount((size_t)size+1);
if(file.Read(buf.GetData(), (DWORD)size) != S_OK){
rc.Format(_T("ERROR: File Read[%s]\n"), (LPCTSTR)path);
return rc;
}
buf[(size_t)size] = 0;
rc = CA2CT(buf.GetData(), codePage);
return rc;
}
示例7: Randomize
void CPlaylist::Randomize()
{
CAtlArray<plsort_t> a;
a.SetCount(GetCount());
srand((unsigned int)time(nullptr));
POSITION pos = GetHeadPosition();
for (int i = 0; pos; i++, GetNext(pos)) {
a[i].n = rand(), a[i].pos = pos;
}
qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare);
for (size_t i = 0; i < a.GetCount(); i++) {
MoveToTail(a[i].pos);
}
}
示例8: OnApply
BOOL CPPageAccelTbl::OnApply()
{
AfxGetMyApp()->UnregisterHotkeys();
UpdateData();
AppSettings& s = AfxGetAppSettings();
s.wmcmds.RemoveAll();
s.wmcmds.AddTail(&m_wmcmds);
CAtlArray<ACCEL> pAccel;
pAccel.SetCount(m_wmcmds.GetCount());
POSITION pos = m_wmcmds.GetHeadPosition();
for (int i = 0; pos; i++) {
pAccel[i] = m_wmcmds.GetNext(pos);
}
if (s.hAccel) {
DestroyAcceleratorTable(s.hAccel);
}
s.hAccel = CreateAcceleratorTable(pAccel.GetData(), pAccel.GetCount());
GetParentFrame()->m_hAccelTable = s.hAccel;
s.fWinLirc = !!m_fWinLirc;
s.strWinLircAddr = m_WinLircAddr;
if (s.fWinLirc) {
s.WinLircClient.Connect(m_WinLircAddr);
}
s.fUIce = !!m_fUIce;
s.strUIceAddr = m_UIceAddr;
if (s.fUIce) {
s.UIceClient.Connect(m_UIceAddr);
}
s.fGlobalMedia = !!m_fGlobalMedia;
AfxGetMyApp()->RegisterHotkeys();
s.AccelTblColWidth.bEnable = true;
s.AccelTblColWidth.cmd = m_list.GetColumnWidth(COL_CMD);
s.AccelTblColWidth.key = m_list.GetColumnWidth(COL_KEY);
s.AccelTblColWidth.id = m_list.GetColumnWidth(COL_ID);
s.AccelTblColWidth.mwnd = m_list.GetColumnWidth(COL_MOUSE);
s.AccelTblColWidth.mfs = m_list.GetColumnWidth(COL_MOUSE_FS);
s.AccelTblColWidth.appcmd = m_list.GetColumnWidth(COL_APPCMD);
s.AccelTblColWidth.remcmd = m_list.GetColumnWidth(COL_RMCMD);
s.AccelTblColWidth.repcnt = m_list.GetColumnWidth(COL_RMREPCNT);
return __super::OnApply();
}
示例9: SortByPath
void CPlaylist::SortByPath()
{
CAtlArray<plsort2_t> a;
a.SetCount(GetCount());
POSITION pos = GetHeadPosition();
for(int i = 0; pos; i++, GetNext(pos))
a[i].str = GetAt(pos).m_fns.GetHead(), a[i].pos = pos;
qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2);
for(int i = 0; i < a.GetCount(); i++)
{
AddTail(GetAt(a[i].pos));
__super::RemoveAt(a[i].pos);
if(m_pos == a[i].pos) m_pos = GetTailPosition();
}
}
示例10: GetPropertyStore
STDMETHODIMP CDriveItemPropertyStoreFactory::GetPropertyStore(GETPROPERTYSTOREFLAGS flags, __in_opt IUnknown * /*punkFactory*/, REFIID riid, __deref_out void **ppv)
{
Log::WriteOutput(LogType::Debug, L"CDriveItemPropertyStoreFactory::GetPropertyStore()");
CAtlArray<PROPERTYKEY> rgKeys;
HRESULT hr = _CreatePropertyKeyArray(flags, rgKeys);
if (SUCCEEDED(hr))
{
hr = GetPropertyStoreForKeys(rgKeys.GetData(), (UINT)rgKeys.GetCount(), flags, riid, ppv);
}
return hr;
}
示例11: SortByName
void CPlaylist::SortByName()
{
CAtlArray<plsort2_t> a;
a.SetCount(GetCount());
POSITION pos = GetHeadPosition();
for (int i = 0; pos; i++, GetNext(pos)) {
CString& fn = GetAt(pos).m_fns.GetHead();
a[i].str = (LPCTSTR)fn + std::max(fn.ReverseFind('/'), fn.ReverseFind('\\')) + 1;
a[i].pos = pos;
}
qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2);
for (size_t i = 0; i < a.GetCount(); i++) {
MoveToTail(a[i].pos);
}
}
示例12: SortById
void CPlaylist::SortById()
{
CAtlArray<plsort_t> a;
a.SetCount(GetCount());
POSITION pos = GetHeadPosition();
for (int i = 0; pos; i++, GetNext(pos)) {
a[i].n = GetAt(pos).m_id, a[i].pos = pos;
}
qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare);
for (size_t i = 0; i < a.GetCount(); i++) {
AddTail(GetAt(a[i].pos));
__super::RemoveAt(a[i].pos);
if (m_pos == a[i].pos) {
m_pos = GetTailPosition();
}
}
}
示例13: Randomize
void CPlaylist::Randomize()
{
CAtlArray<plsort_t> a;
a.SetCount(GetCount());
srand((unsigned int)time(NULL));
POSITION pos = GetHeadPosition();
for(int i = 0; pos; i++, GetNext(pos))
a[i].n = rand(), a[i].pos = pos;
qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare);
CList<CPlaylistItem> pl;
for(int i = 0; i < a.GetCount(); i++)
{
AddTail(GetAt(a[i].pos));
__super::RemoveAt(a[i].pos);
if(m_pos == a[i].pos)
m_pos = GetTailPosition();
}
}
示例14: sizeof
HRESULT CDll_RS232::ReadBuffer( CAtlArray<BYTE> &buffer )
{
HRESULT hr = S_OK ;
if ( !m_bIsConnection ) return E_FAIL ;
OVERLAPPED ov ;
memset( &ov , 0 , sizeof( ov ) ) ;
ov.hEvent = CreateEvent( NULL , TRUE , NULL , NULL ) ;
DWORD dwRead , dwError ;
COMSTAT cs ;
memset( &cs , 0 , sizeof( cs ) ) ;
if ( !ClearCommError( m_hCommPort , &dwError , &cs ) ){
ATLASSERT( 0 ) ;
ATLTRACE( "Get count available bytes failed\r\n" ) ;
return E_FAIL ;
}
if ( cs.cbInQue == 0 ) {
CloseHandle( ov.hEvent ) ;
return S_OK ;
}
bool ok = buffer.SetCount( cs.cbInQue ) ;
ATLASSERT ( ok ) ;
BOOL bRet = ReadFile( m_hCommPort , buffer.GetData() , ( DWORD )buffer.GetCount() , &dwRead , &ov ) ;
if ( !bRet ){
if ( GetLastError() == ERROR_IO_PENDING ){
DWORD dwWait = WaitForSingleObject( ov.hEvent , INFINITE ) ;
ATLASSERT( dwWait == WAIT_OBJECT_0 ) ;
}else{
ATLASSERT( 0 ) ;
hr = E_FAIL ;
}
}
CloseHandle( ov.hEvent ) ;
return hr ;
}
示例15: ParseMPCPlayList
bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn)
{
CString str;
CAtlMap<int, CPlaylistItem> pli;
CAtlArray<int> idx;
CWebTextFile f;
if (!f.Open(fn) || !f.ReadString(str) || str != _T("MPCPLAYLIST")) {
return false;
}
if (f.GetEncoding() == CTextFile::ASCII) {
f.SetEncoding(CTextFile::ANSI);
}
CPath base(fn);
base.RemoveFileSpec();
while (f.ReadString(str)) {
CAtlList<CString> sl;
Explode(str, sl, ',', 3);
if (sl.GetCount() != 3) {
continue;
}
if (int i = _ttoi(sl.RemoveHead())) {
CString key = sl.RemoveHead();
CString value = sl.RemoveHead();
if (key == _T("type")) {
pli[i].m_type = (CPlaylistItem::type_t)_ttol(value);
idx.Add(i);
} else if (key == _T("label")) {
pli[i].m_label = value;
} else if (key == _T("filename")) {
value = CombinePath(base, value);
pli[i].m_fns.AddTail(value);
} else if (key == _T("subtitle")) {
value = CombinePath(base, value);
pli[i].m_subs.AddTail(value);
} else if (key == _T("video")) {
while (pli[i].m_fns.GetCount() < 2) {
pli[i].m_fns.AddTail(_T(""));
}
pli[i].m_fns.GetHead() = value;
} else if (key == _T("audio")) {
while (pli[i].m_fns.GetCount() < 2) {
pli[i].m_fns.AddTail(_T(""));
}
pli[i].m_fns.GetTail() = value;
} else if (key == _T("vinput")) {
pli[i].m_vinput = _ttol(value);
} else if (key == _T("vchannel")) {
pli[i].m_vchannel = _ttol(value);
} else if (key == _T("ainput")) {
pli[i].m_ainput = _ttol(value);
} else if (key == _T("country")) {
pli[i].m_country = _ttol(value);
}
}
}
qsort(idx.GetData(), idx.GetCount(), sizeof(int), s_int_comp);
for (size_t i = 0; i < idx.GetCount(); i++) {
m_pl.AddTail(pli[idx[i]]);
}
return pli.GetCount() > 0;
}