Ejemplo n.º 1
0
void Field::draw(std::ostream& os) {
    Disc* dsc;
    for(unsigned int i = height; i > 0; i--) {
        for(unsigned int j = 0; j < width; j++) {
            dsc = getDisc(j,i-1);
            if(dsc == NULL) {
                os << " [";
                Field::spacer(os, tlMax, " ");
                os << "]";
             } else {
                 os << " [" << *dsc->getColor()->getToken();
                 Field::spacer(os, (unsigned int)(tlMax-dsc->getColor()->getToken()->length()), " ");
                 os << "]";
             }
        }
        os << std::endl;
    }
    // draw column numbers and separation line
    for(unsigned int i = 0; i < width; i++) {
        os << "---";
        Field::spacer(os, tlMax, "-");
    }
    os << std::endl;
    for(unsigned int i = 0; i < width; i++) {
        os << " [" << i+1;
        Field::spacer(os, tlMax-1, " ");
        os << "]";
    }
    os << std::endl << std::endl;
}