Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CUintArray Class Reference

#include <stringar.h>

List of all members.

Public Member Functions

 CUintArray ()
 ~CUintArray ()
unsigned Count () const
void Add (unsigned u)
unsigned operator[] (unsigned u) const
void Remove (unsigned u)
void Empty ()

Private Member Functions

const unsigned ChunkSize () const
unsigned Borrow ()

Private Attributes

unsigned m_aStore [20]
CUintArraym_pcuaNext
unsigned m_ucUsed


Constructor & Destructor Documentation

CUintArray::CUintArray  ) 
 

Definition at line 403 of file stringar.cpp.

References m_pcuaNext, m_ucUsed, and NULL.

00403 { 00404 m_ucUsed = 0; 00405 m_pcuaNext = NULL; 00406 }

CUintArray::~CUintArray  ) 
 

Definition at line 408 of file stringar.cpp.

References Empty().

00408 { 00409 Empty(); 00410 }


Member Function Documentation

void CUintArray::Add unsigned  u  ) 
 

Definition at line 424 of file stringar.cpp.

References Add(), ChunkSize(), m_aStore, m_pcuaNext, and m_ucUsed.

Referenced by Add(), CProfilePropertySheet::Associate(), CProfileAssociationPage::Associate(), CProfile::AssociationCheck(), CProfilePropertySheet::ConstructAssociations(), CProfileAssociationPage::ConstructAssociations(), CProfilePropertySheet::Dissociate(), CProfileAssociationPage::Dissociate(), and CDeviceProfileManagement::OnCommand().

00424 { 00425 00426 if (m_ucUsed < ChunkSize()) { 00427 m_aStore[m_ucUsed++] = uNew; 00428 return; 00429 } 00430 00431 // Not enough space! Add another record, if there isn't one 00432 00433 if (!m_pcuaNext) 00434 m_pcuaNext = new CUintArray; 00435 00436 // Add the item to the next array (recursive call!) 00437 00438 if (m_pcuaNext) { 00439 m_pcuaNext -> Add(uNew); 00440 m_ucUsed++; 00441 } 00442 }

unsigned CUintArray::Borrow  )  [private]
 

Definition at line 381 of file stringar.cpp.

References ChunkSize(), m_aStore, m_pcuaNext, m_ucUsed, and NULL.

Referenced by Remove().

00381 { 00382 00383 unsigned uReturn = m_aStore[0]; 00384 00385 memcpy((LPSTR) m_aStore, (LPSTR) (m_aStore + 1), 00386 (ChunkSize() - 1) * sizeof m_aStore[0]); 00387 00388 if (m_ucUsed > ChunkSize()) 00389 m_aStore[ChunkSize() - 1] = m_pcuaNext -> Borrow(); 00390 else 00391 m_aStore[ChunkSize() - 1] = 0; 00392 00393 m_ucUsed--; 00394 00395 if (m_ucUsed <= ChunkSize() && m_pcuaNext) { 00396 delete m_pcuaNext; 00397 m_pcuaNext = NULL; 00398 } 00399 00400 return uReturn; 00401 }

const unsigned CUintArray::ChunkSize  )  const [inline, private]
 

Definition at line 123 of file stringar.h.

Referenced by Add(), Borrow(), operator[](), and Remove().

00123 { 00124 return sizeof m_aStore / sizeof m_aStore[0]; 00125 }

unsigned CUintArray::Count  )  const [inline]
 

Definition at line 134 of file stringar.h.

Referenced by CProfilePropertySheet::Associate(), CProfileAssociationPage::Associate(), CProfilePropertySheet::AssociationCount(), CProfile::AssociationCount(), CProfileAssociationPage::AssociationCount(), CProfilePropertySheet::ConstructAssociations(), CProfileAssociationPage::ConstructAssociations(), CProfilePropertySheet::Dissociate(), CProfileAssociationPage::Dissociate(), CMonitorProfileManagement::FillList(), CPrinterProfileManagement::FillList(), CDeviceProfileManagement::FillList(), CProfilePropertySheet::OnCommand(), CDeviceProfileManagement::OnCommand(), CProfileAssociationPage::OnNotify(), CMonitorProfileManagement::OnNotify(), CPrinterProfileManagement::OnNotify(), and CDeviceProfileManagement::OnNotify().

00134 { return m_ucUsed; }

void CUintArray::Empty  ) 
 

Definition at line 412 of file stringar.cpp.

References m_pcuaNext, m_ucUsed, and NULL.

Referenced by CProfilePropertySheet::ConstructAssociations(), CProfileAssociationPage::ConstructAssociations(), CDeviceProfileManagement::InitList(), CProfileAssociationPage::OnInit(), and ~CUintArray().

00412 { 00413 00414 if (!m_ucUsed) return; 00415 00416 if (m_pcuaNext) { 00417 delete m_pcuaNext; 00418 m_pcuaNext = NULL; 00419 } 00420 m_ucUsed = 0; 00421 }

unsigned CUintArray::operator[] unsigned  u  )  const
 

Definition at line 444 of file stringar.cpp.

References ChunkSize(), m_aStore, m_pcuaNext, m_ucUsed, and operator[]().

Referenced by operator[]().

00444 { 00445 return u < m_ucUsed ? u < ChunkSize() ? 00446 m_aStore[u] : m_pcuaNext -> operator[](u - ChunkSize()) : 0; 00447 }

void CUintArray::Remove unsigned  u  ) 
 

Definition at line 449 of file stringar.cpp.

References Borrow(), ChunkSize(), m_aStore, m_pcuaNext, m_ucUsed, NULL, and Remove().

Referenced by CProfilePropertySheet::OnCommand(), CDeviceProfileManagement::OnCommand(), CProfileAssociationPage::OnNotify(), Remove(), and CProfile::Uninstall().

00449 { 00450 00451 if (u > m_ucUsed) 00452 return; 00453 00454 if (u >= ChunkSize()) { 00455 m_pcuaNext -> Remove(u - ChunkSize()); 00456 return; 00457 } 00458 00459 memmove((LPSTR) (m_aStore + u), (LPSTR) (m_aStore + u + 1), 00460 (ChunkSize() - (u + 1)) * sizeof m_aStore[0]); 00461 00462 if (m_ucUsed > ChunkSize()) 00463 m_aStore[ChunkSize() - 1] = m_pcuaNext -> Borrow(); 00464 else 00465 m_aStore[ChunkSize() - 1] = 0; 00466 00467 m_ucUsed--; 00468 00469 if (m_ucUsed <= ChunkSize() && m_pcuaNext) { 00470 delete m_pcuaNext; 00471 m_pcuaNext = NULL; 00472 } 00473 }


Member Data Documentation

unsigned CUintArray::m_aStore[20] [private]
 

Definition at line 119 of file stringar.h.

Referenced by Add(), Borrow(), operator[](), and Remove().

CUintArray* CUintArray::m_pcuaNext [private]
 

Definition at line 120 of file stringar.h.

Referenced by Add(), Borrow(), CUintArray(), Empty(), operator[](), and Remove().

unsigned CUintArray::m_ucUsed [private]
 

Definition at line 121 of file stringar.h.

Referenced by Add(), Borrow(), CUintArray(), Empty(), operator[](), and Remove().


The documentation for this class was generated from the following files:
Generated on Sat May 15 19:46:28 2004 for test by doxygen 1.3.7