*
* Dependencies: None (almost)
*
- * Copyright: (c) 1996, Alejandro Aguilar Sierra
+ * Copyright: 1996, Alejandro Aguilar Sierra
* 1997 The LyX Team!
*
* You are free to use and modify this code under the terms of
#define byte unsigned char
#endif
-/*@Doc: A resizable array
- Why is it called "LyXArrayBase" if it is generic? (Lgb)
- Initially I thought it could be the base class for both mathed's
- and LyX' kernels data buffer. (Ale)
-
+/** A resizable array.
+ A general purpose resizable array.
+ @author Alejandro Aguilar Sierra
+ @version January 1996
*/
class LyxArrayBase {
public:
};
///
- LyxArrayBase(int size= ARRAY_STEP);
+ explicit
+ LyxArrayBase(int size = ARRAY_STEP);
///
- LyxArrayBase(const LyxArrayBase&);
+ LyxArrayBase(LyxArrayBase const &);
///
~LyxArrayBase();
-
+ /// Constructs a new array with dx elements starting at pos
+ LyxArrayBase & operator= (LyxArrayBase const &);
+
///
- int Empty() { return (last == 0); }
+ int empty() const { return (last == 0); }
///
int Last() { return last; }
void Remove(int pos, int dx);
/// Merge dx elements from array a at pos. Changes the size if necessary.
- void Merge(LyxArrayBase *a, int pos, int dx);
+ void Merge(LyxArrayBase * a, int pos, int dx);
/// Same as Merge but doesn't changes the size (dangerous)
- void MergeF(LyxArrayBase *a, int pos, int dx);
+ void MergeF(LyxArrayBase * a, int pos, int dx);
/// Copy dx byts from an array at position pos
void Copy(void *, int pos, int dx);
/// Constructs a new array with dx elements starting at pos
- LyxArrayBase* Extract(int pos, int dx);
+ LyxArrayBase * Extract(int pos, int dx);
/// Insert a character at position pos
void Insert(int pos, byte);
/// Constructs a new array with dx elements starting at pos
byte operator[](const int);
- /// Constructs a new array with dx elements starting at pos
- LyxArrayBase& operator= (const LyxArrayBase&);
-
protected:
///
void Resize(int newsize);
bool Move(int p, int shift);
/// Buffer
- byte *bf;
+ byte * bf;
/// Last position inserted.
int last;
/// Max size of the array.