All pastes #67460 Raw Edit

Someone

public text v1 · immutable
#67460 ·published 2006-06-20 00:33 UTC
rendered paste body
class Screen {
    deque<Field> fields;
    int n_fields;
    int fields_size;
    
public:
    /* constructors/destructors */
    Screen(int row, int col, int len, const char *s=NULL, bool editable=true);
    Screen(const Screen &right);
    Screen();
    virtual ~Screen();

    /* overloaded operators */
    const Screen& operator=(const Screen &right);
    Screen& operator+=(const Field &right);

    /* public functions */
    int add(int row, int col, int len, const char *s=NULL, bool editable=true);
    int add(const Field &f);
    void display(bool clear=false);
    int edit(bool clear=false) { return edit(NULL, clear); };
    int edit(int *pfield=NULL, bool clear=false);
    Field *getField(int n);
    int remove(int n);
private:
    /* internal functions */
    int grow(int s=10);
};


const Screen& Screen::operator=(const Screen &right) {
    deque<Field>::iterator i;

    if (this != &right) {
        for (i = right.fields.begin(); i != right.fields.end(); i++) {
            *this += *i;
        }
        this->n_fields = right.n_fields;
    }

    return *this;
}