本文整理汇总了C++中CAtlArray::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlArray::GetCount方法的具体用法?C++ CAtlArray::GetCount怎么用?C++ CAtlArray::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlArray
的用法示例。
在下文中一共展示了CAtlArray::GetCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: CreateSplineCoeffs
void Glyph::CreateSplineCoeffs(const CRect& spdrc)
{
spline.RemoveAll();
if (style.placement.path.IsEmpty()) {
return;
}
size_t i = 0, j = style.placement.path.GetCount();
CAtlArray<Point> pts;
pts.SetCount(j + 2);
Point p;
while (i < j) {
p.x = style.placement.path[i].x * scale.cx + spdrc.left * 64;
p.y = style.placement.path[i].y * scale.cy + spdrc.top * 64;
pts[++i] = p;
}
if (pts.GetCount() >= 4) {
if (pts[1].x == pts[j].x && pts[1].y == pts[j].y) {
pts.SetAt(0, pts[j - 1]);
pts.SetAt(j + 1, pts[2]);
} else {
p.x = pts[1].x * 2 - pts[2].x;
p.y = pts[1].y * 2 - pts[2].y;
pts.SetAt(0, p);
p.x = pts[j].x * 2 - pts[j - 1].x;
p.y = pts[j].y * 2 - pts[j - 1].y;
pts.SetAt(j + 1, p);
}
spline.SetCount(pts.GetCount() - 3);
for (size_t i = 0, j = pts.GetCount() - 4; i <= j; i++) {
static const float _1div6 = 1.0f / 6;
SplineCoeffs sc;
sc.cx[3] = _1div6 * (- pts[i + 0].x + 3 * pts[i + 1].x - 3 * pts[i + 2].x + pts[i + 3].x);
sc.cx[2] = _1div6 * (3 * pts[i + 0].x - 6 * pts[i + 1].x + 3 * pts[i + 2].x);
sc.cx[1] = _1div6 * (-3 * pts[i + 0].x + 3 * pts[i + 2].x);
sc.cx[0] = _1div6 * (pts[i + 0].x + 4 * pts[i + 1].x + 1 * pts[i + 2].x);
sc.cy[3] = _1div6 * (- pts[i + 0].y + 3 * pts[i + 1].y - 3 * pts[i + 2].y + pts[i + 3].y);
sc.cy[2] = _1div6 * (3 * pts[i + 0].y - 6 * pts[i + 1].y + 3 * pts[i + 2].y);
sc.cy[1] = _1div6 * (-3 * pts[i + 0].y + 3 * pts[i + 2].y);
sc.cy[0] = _1div6 * (pts[i + 0].y + 4 * pts[i + 1].y + 1 * pts[i + 2].y);
spline.SetAt(i, sc);
}
}
}
示例3: EnumWebSitesFromXML
BOOL CIISConfigHelper::EnumWebSitesFromXML(std::vector<IISWebSite>& sites)
{
sites.clear();
// connect to the config file
CComPtr<IXMLDOMDocument> pDOM;
HRESULT hr = CIIS7XMLConfigHelper::GetApplicationHostConfigDocument(&pDOM);
if (hr != S_OK || pDOM == NULL)
return FALSE;
// get the site collection
CComPtr<IXMLDOMNodeList> pSites;
hr = CIIS7XMLConfigHelper::GetSitesCollection(pDOM, &pSites);
if (hr != S_OK)
return FALSE;
long nSites = 0;
pSites->get_length(&nSites);
// loop thru the available sites
for (long i = 0; i < nSites; i++)
{
CComPtr<IXMLDOMNode> pSite;
hr = pSites->get_item(i, &pSite);
if (hr != S_OK || pSite == NULL)
continue;
IISWebSite item;
item.eSource = IISWebSite::XML;
CAtlArray<CAtlString> Ports;
CAtlArray<CAtlString> SecurePorts;
hr = CIIS7XMLConfigHelper::GetSiteInfo(pSite, item.sInstance, item.sDescription, item.sFileSystemPath, Ports, SecurePorts);
if (hr != S_OK)
continue;
const int nPorts = (int) Ports.GetCount();
for (int i = 0; i < nPorts; i++)
{
IISWebSiteBindings binding(Ports[i]);
item.Ports.Add(binding);
}
const int nSecurePorts = (int) SecurePorts.GetCount();
for (int i = 0; i < nSecurePorts; i++)
{
IISWebSiteBindings binding(SecurePorts[i]);
item.Ports.Add(binding);
}
sites.push_back(item);
}
return TRUE;
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: SortStringArray
void SortStringArray(CAtlArray<CString>& Arr, bool bAcsesnding /* = true */)
{
if (Arr.GetCount() > 1)
{
if (bAcsesnding)
{
QSortAcs(Arr, 0, (int)Arr.GetCount() - 1);
}
else
{
QSortDesc(Arr, 0, (int)Arr.GetCount() - 1);
}
}
}
示例7: SortClasses
void SortClasses(CAtlArray<VSClass*>& Arr, bool bAcsesnding /* = true */)
{
if (Arr.GetCount() > 1)
{
if (bAcsesnding)
{
QSortAcs(Arr, 0, (int)Arr.GetCount() - 1);
}
else
{
QSortDesc(Arr, 0, (int)Arr.GetCount() - 1);
}
}
}
示例8: 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);
}
}
示例9: Shuffle
POSITION CPlaylist::Shuffle()
{
CAtlArray<plsort2_t> a;
a.SetCount(GetCount());
srand((unsigned)time(NULL));
POSITION pos = GetHeadPosition();
for(int i = 0; pos; i++, GetNext(pos))
a[i].pos = pos;
pos = GetPos();
int rnd = Rand(0, a.GetCount()-1);
while(pos == a[rnd].pos) rnd = Rand(0, a.GetCount()-1);
return a[rnd].pos;
}
示例10: VerifyFile
int CCommon::VerifyFile(CAtlArray<CString>& arrFile)
{
DWORD dwWinTrust = 0;
size_t nCount = arrFile.GetCount();
CWinTrustVerifier verifier;
verifier.TryLoadDll();
CString strFile;
HRESULT hr = S_OK;
for (size_t i = 0; i < nCount; i++)
{
strFile = arrFile[i];
dwWinTrust = verifier.VerifyFile(strFile, NULL);
if (dwWinTrust <= 0x0000FFFF)
hr = AtlHresultFromWin32(dwWinTrust);
else
hr = dwWinTrust;
if ( FAILED(hr))
{
CKSafeExamLog::GetLogPtr()->WriteLog(L"VerifyFile Failed: File = %s, hr = 0x%x", strFile, hr);
dwWinTrust = -1;
break;
}
strFile.Empty();
}
return dwWinTrust;
}
示例11: GetExceptionInfoByCode
static CExceptionInfo* GetExceptionInfoByCode( DWORD dwExceptionCode )
{
for( size_t i = 0; i < g_aException.GetCount(); ++i )
if( g_aException[i].dwCode == dwExceptionCode )
return &g_aException[i];
return NULL;
}
示例12: ScanPathSync
void SlimItem::ScanPathSync()
{
DWORD dwAttributes;
CAtlArray<CString> itemPaths;
GetPaths(itemPaths);
for (size_t i = 0; i < itemPaths.GetCount(); i++)
{
dwAttributes = ::GetFileAttributes(itemPaths[i]);
if (INVALID_FILE_ATTRIBUTES == dwAttributes)
continue;
if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (!slimhelper::ScanDirectory(itemPaths[i], this))
break;
}
else
{
slimhelper::ScanFile(itemPaths[i], 0, INVALID_FILE_ATTRIBUTES, this);
}
}
CheckEnable();
::PostMessage(m_hNotifyWnd, SLIM_WM_ITEM_SCAN_END, 0, 0);
}
示例13: CompressPaths
BOOL SlimItem::CompressPaths()
{
DWORD dwAttributes;
CAtlArray<CString> itemPaths;
GetPaths(itemPaths);
for (size_t i = 0; i < itemPaths.GetCount(); i++)
{
dwAttributes = ::GetFileAttributes(itemPaths[i]);
if (INVALID_FILE_ATTRIBUTES == dwAttributes)
continue;
if (dwAttributes & FILE_ATTRIBUTE_COMPRESSED
|| dwAttributes & FILE_ATTRIBUTE_SPARSE_FILE)
{
continue;
}
if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
slimhelper::CompressDirectory(itemPaths[i], this);
}
else
{
slimhelper::CompressFile(itemPaths[i], 0, dwAttributes, this);
}
}
return TRUE;
}
示例14: if
/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
int CWsHook::GetAddrInfoW(PCWSTR pNodeName, PCWSTR pServiceName, const ADDRINFOW * pHints, PADDRINFOW * ppResult)
{
int ret = WSAEINVAL;
bool overrideDNS = false;
void * context = NULL;
CString name = CW2T(pNodeName);
CAtlArray<DWORD> addresses;
if( dlg && pNodeName )
overrideDNS = dlg->DnsLookupStart( name, context, addresses );
if( _GetAddrInfoW && !overrideDNS )
ret = _GetAddrInfoW(CT2W((LPCWSTR)name), pServiceName, pHints, ppResult);
else if( overrideDNS ) {
if( addresses.IsEmpty() )
ret = EAI_NONAME;
else {
// build the response structure with the addresses we looked up
ret = 0;
DWORD count = addresses.GetCount();
ADDRINFOW_ADDR * result = (ADDRINFOW_ADDR *)malloc(sizeof(ADDRINFOW_ADDR) * count);
for (DWORD i = 0; i < count; i++) {
memset( &result[i], 0, sizeof(ADDRINFOW_ADDR) );
result->info.ai_family = AF_INET;
result->info.ai_addrlen = sizeof(struct sockaddr_in);
result->info.ai_addr = (struct sockaddr *)&(result->addr);
result->addr.sin_family = AF_INET;
result->addr.sin_addr.S_un.S_addr = addresses[i];
if( i < count - 1 )
result->info.ai_next = (PADDRINFOW)&result[i+1];
}
addrInfo.AddTail(result);
*ppResult = (PADDRINFOW)result;
}
}
if (!ret && dlg) {
PADDRINFOW addr = *ppResult;
while (addr) {
if (addr->ai_canonname)
dlg->DnsLookupAlias(name, addr->ai_canonname);
if (context &&
addr->ai_addrlen >= sizeof(struct sockaddr_in) &&
addr->ai_family == AF_INET ) {
struct sockaddr_in * ipName = (struct sockaddr_in *)addr->ai_addr;
dlg->DnsLookupAddress(context, ipName->sin_addr);
}
addr = addr->ai_next;
}
if (context)
dlg->DnsLookupDone(context);
}
return ret;
}
示例15: getProperties
void COPCItem::getProperties(const CAtlArray<CPropertyDescription> &propsToRead, ATL::CAutoPtrArray<SPropertyValue> &propsRead){
unsigned noProperties = (DWORD)propsToRead.GetCount();
VARIANT *pValues = NULL;
HRESULT *pErrors = NULL;
DWORD *pPropertyIDs = new DWORD[noProperties];
for (unsigned i = 0; i < noProperties; i++){
pPropertyIDs[i] = propsToRead.GetAt(i).id;
}
propsRead.RemoveAll();
propsRead.SetCount(noProperties);
USES_CONVERSION;
HRESULT res = group.getServer().getPropertiesInterface()->GetItemProperties(T2OLE(name), noProperties, pPropertyIDs, &pValues, &pErrors);
delete []pPropertyIDs;
if (FAILED(res)){
throw OPCException("Failed to restrieve property values", res);
}
for (unsigned i = 0; i < noProperties; i++){
CAutoPtr<SPropertyValue> v;
if (!FAILED(pErrors[i])){
v.Attach(new SPropertyValue(propsToRead[i], pValues[i]));
}
propsRead[i]=v;
}
COPCClient::comFree(pErrors);
COPCClient::comFreeVariant(pValues, noProperties);
}