Unicorn XML Toolkit
Version 1.50.00

Namespace Core
Class CSortable

class CSortable {
public:
    CSortable();
    ~CSortable();
public:
    virtual int GetSize() const = 0;
    virtual int Compare(int nIndex1, int nIndex2) const = 0;
    virtual void Swap(int nIndex1, int nIndex2) = 0;
    };

The base class for arrays which can be sorted.

Since:
1.00.00
Version:
1.50.00
Author:
Alexey Gokhberg
Constructor/Destructor Summary
CSortable ();
����������Constructs the sortable array.
~CSortable ();
����������Destroys the sortable array.

Function Summary
int GetSize () const;
����������Returns a number of elements in this sortable array.
int Compare (int nIndex1, int nIndex2) const;
����������Compares two elements of this sortabe array.
void Swap (int nIndex1, int nIndex2);
����������Swaps two elements of this sortable array.

Constructor/Destructor Detail

CSortable

CSortable();

Constructs the sortable array.

~CSortable

~CSortable();

Destroys the sortable array.

Function Detail

GetSize

virtual int GetSize() const = 0;

Returns a number of elements in this sortable array.

Returns:
the number of elements in this sortable array

Compare

virtual int Compare(int nIndex1, int nIndex2) const = 0;

Compares two elements of this sortabe array.

Parameters:
nIndex1 - the index of the first element (zero-based)
nIndex2 - the index of the second element (zero-based)
Returns:
the result of comparison: negative integer if the first element is less that the second element; positive integer if the first element is greater than the second element; zero if elements are equal

Swap

virtual void Swap(int nIndex1, int nIndex2) = 0;

Swaps two elements of this sortable array.

Parameters:
nIndex1 - the index of the first element (zero-based)
nIndex2 - the index of the second element (zero-based)

Unicorn XML Toolkit
Version 1.50.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.