Annotation of mstools/samples/sdktools/capview/array_x.h, revision 1.1.1.1

1.1       root        1: typedef struct {
                      2:     int         left;
                      3:     int         y;
                      4:     int         width;
                      5: } AAA;
                      6: 
                      7: ////////////////////////////////////////////////////////////////////////////
                      8: 
                      9: 
                     10: class CAaaArray : public CObject
                     11: {
                     12: 
                     13:        DECLARE_DYNAMIC(CAaaArray)
                     14: public:
                     15: 
                     16: // Construction
                     17:        CAaaArray();
                     18: 
                     19: // Attributes
                     20:        int     GetSize() const
                     21:                                { return m_nSize; }
                     22:        int     GetUpperBound() const
                     23:                                { return m_nSize-1; }
                     24:        void    SetSize(int nNewSize, int nGrowBy = -1);
                     25: 
                     26: // Operations
                     27:        // Clean up
                     28:        void    FreeExtra();
                     29:        void    RemoveAll()
                     30:                                { SetSize(0); }
                     31: 
                     32:        // Accessing elements
                     33:        AAA    GetAt(int nIndex) const
                     34:                                { ASSERT(nIndex >= 0 && nIndex < m_nSize);
                     35:                                        return m_pData[nIndex]; }
                     36:        void    SetAt(int nIndex, AAA newElement)
                     37:                                { ASSERT(nIndex >= 0 && nIndex < m_nSize);
                     38:                                        m_pData[nIndex] = newElement; }
                     39:        AAA&   ElementAt(int nIndex)
                     40:                                { ASSERT(nIndex >= 0 && nIndex < m_nSize);
                     41:                                        return m_pData[nIndex]; }
                     42: 
                     43:        // Potentially growing the array
                     44:        void    SetAtGrow(int nIndex, AAA newElement);
                     45:        int     Add(AAA newElement)
                     46:                                { int nIndex = m_nSize;
                     47:                                        SetAtGrow(nIndex, newElement);
                     48:                                        return nIndex; }
                     49: 
                     50:        // overloaded operator helpers
                     51:        AAA    operator[](int nIndex) const
                     52:                                { return GetAt(nIndex); }
                     53:        AAA&   operator[](int nIndex)
                     54:                                { return ElementAt(nIndex); }
                     55: 
                     56:        // Operations that move elements around
                     57:        void    InsertAt(int nIndex, AAA newElement, int nCount = 1);
                     58:        void    RemoveAt(int nIndex, int nCount = 1);
                     59:        void    InsertAt(int nStartIndex, CAaaArray* pNewArray);
                     60: 
                     61: // Implementation
                     62: protected:
                     63:        AAA*   m_pData;        // the actual array of data
                     64:        int     m_nSize;        // # of elements (upperBound - 1)
                     65:        int     m_nMaxSize;     // max allocated
                     66:        int     m_nGrowBy;      // grow amount
                     67: 
                     68: public:
                     69:        ~CAaaArray();
                     70: #if 0
                     71: #ifdef _DEBUG
                     72:        void    Dump(CDumpContext&) const;
                     73:        void    AssertValid() const;
                     74: #endif
                     75: #endif // 0
                     76: };
                     77: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.