Определение CObArray:
Код: Выделить всё
class CObArray : public CObject
{
DECLARE_SERIAL(CObArray)
public:
// Construction
CObArray();
// Attributes
INT_PTR GetSize() const;
INT_PTR GetCount() const;
BOOL IsEmpty() const;
INT_PTR GetUpperBound() const;
void SetSize(INT_PTR nNewSize, INT_PTR nGrowBy = -1);
// Operations
// Clean up
void FreeExtra();
void RemoveAll();
// Accessing elements
CObject* GetAt(INT_PTR nIndex) const;
void SetAt(INT_PTR nIndex, CObject* newElement);
CObject*& ElementAt(INT_PTR nIndex);
// Direct Access to the element data (may return NULL)
const CObject** GetData() const;
CObject** GetData();
// Potentially growing the array
void SetAtGrow(INT_PTR nIndex, CObject* newElement);
INT_PTR Add(CObject* newElement);
INT_PTR Append(const CObArray& src);
void Copy(const CObArray& src);
// overloaded operator helpers
CObject* operator[](INT_PTR nIndex) const;
CObject*& operator[](INT_PTR nIndex);
// Operations that move elements around
void InsertAt(INT_PTR nIndex, CObject* newElement, INT_PTR nCount = 1);
void RemoveAt(INT_PTR nIndex, INT_PTR nCount = 1);
void InsertAt(INT_PTR nStartIndex, CObArray* pNewArray);
// Implementation
protected:
CObject** m_pData; // the actual array of data
INT_PTR m_nSize; // # of elements (upperBound - 1)
INT_PTR m_nMaxSize; // max allocated
INT_PTR m_nGrowBy; // grow amount
public:
~CObArray();
void Serialize(CArchive&);
#ifdef _DEBUG
void Dump(CDumpContext&) const;
void AssertValid() const;
#endif
protected:
// local typedefs for class templates
typedef CObject* BASE_TYPE;
typedef CObject* BASE_ARG_TYPE;
};
Код: Выделить всё
CObArray m_MyArray;
m_MyArray.Add((CObject*)new CDetObj(lineID, orderID, sku, quantity));
Код: Выделить всё
1,9991,845,3
2,9991,338,1
3,9991,672,2
Код: Выделить всё
1,9991,845,1
2,9991,845,1
3,9991,845,1
4,9991,338,1
5,9991,672,1
6,9991,672,1
Подробнее здесь: https://stackoverflow.com/questions/790 ... array-in-c