class Composition {
public:
Composition(Compositor *);
void Repair();
private:
Compositor *_compositor;
Component *_component;
int _componentCount;
int _lineWidth;
int *_lineBreaks;
int _lineCount;
};
class Compositor {
public:
virtual int Compose {
Coord natural[], Coord stretch[], Coord shrink[], int componentCount, int lineWidth, int breaks[]) = 0;
protected:
Compositor();
}
};
void Composition::Repair() {
Coord *natural;
Coord *stretchability;
Coord *shrinkability;
int componentCount;
int *breaks;
//determine where the breaks are
int breakCount;
breakCount = _compositor->Compose(natural, strechability, shrinkability, componentCount, _lineWidth, breaks);
}
class SimpleCompositor : public Compositor {
public:
SimpleCompositor();
vitual int Compose(Coord natural, Coord stretch[], Coord shrink, int componentCount, int lineWidth, int breaks[]);
//...
};
class TexCompositor : public Compositor {
public:
TexCompositor();
vitual int Compose(Coord natural, Coord stretch[], Coord shrink, int componentCount, int lineWidth, int breaks[]);
};
class ArrayCompositor : public Compositor {
public:
ArrayCompositor();
vitual int Compose(Coord natural, Coord stretch[], Coord shrink, int componentCount, int lineWidth, int breaks[]);
};
Composition *quick = new Composition(new SimpleCompositor);
Composition *slick = new Composition(new TexCompositor);
Composition *iconic = new Composition(new ArrayCompositor);
|