#include <iostream>

using namespace std;

#include "funcStr.hpp"
#include "funcXY.hpp"
#include "funcStack.hpp"


int main()
{
    fstr hello("hello world\n");
    fchg H(&hello,'H',0);
    fsub world(&hello,5,11);
    fins hww(&H,&world, 11);
    fstrip hw(&hww, 5, 11);

    funcStr * msg = & hw;
    for (int i=0;i<20;i++)
        cout << (*msg)[i];
    cout << endl;
    cout << "size = " << msg->size() << endl;
    cout << "find(o) = " << msg->find('o') << endl;

    fXY un(10,10);
    fXYsub deux(&un,2,2,4,4);
    fXYsub trois(&un,0,0,5,5);

    funcXY * xy = &trois;
    cout << xy->size() << endl;
    for (int i=0;i<xy->size();i++)
        cout << (*xy)(i) << " ";
    cout << endl;
    for (int x=0;x<xy->w();x++)
        for (int y=0;y<xy->h();y++)
            cout << (*xy)(x,y) << " ";
    cout << endl;

    cout << endl;
    
    fpush a('a');
    fpush b(&a,'b');
    fpush c(&b, 'c');
    fpop bb(&c);
    fpop aa(&bb);
    
    funcStack * st = &aa;
    cout << (*st)() << endl;

    return 0;
}


