?? adapter.c
字號(hào):
/**/#include "Geom.H"// Compilation Instructions// With ClassAdapter defined and not defined#define ClassAdapter 0/**/class Manipulator;/**/class Shape {public: Shape(); virtual void BoundingBox( Point& bottomLeft, Point& topRight ) const; virtual Manipulator* CreateManipulator() const;};/**/class TextView {public: TextView(); void GetOrigin(Coord& x, Coord& y) const; void GetExtent(Coord& width, Coord& height) const; virtual bool IsEmpty() const;};/**/#ifdef ClassAdapter/**/class TextShape : public Shape, private TextView { TextShape(); virtual void BoundingBox( Point& bottomLeft, Point& topRight ) const; virtual bool IsEmpty() const; virtual Manipulator* CreateManipulator() const;};/**/void TextShape::BoundingBox ( Point& bottomLeft, Point& topRight) const { Coord bottom, left, width, height; GetOrigin(bottom, left); GetExtent(width, height);/**/ bottomLeft = Point(bottom, left); topRight = Point(bottom + height, left + width);}/**/bool TextShape::IsEmpty () const { return TextView::IsEmpty();}/**/class Manipulator {};class TextManipulator : public Manipulator { public: TextManipulator(const TextShape*);};/**/Manipulator* TextShape::CreateManipulator () const { return new TextManipulator(this);}/**/#endif#ifndef ClassAdapterclass TextView;class Manipulator {};class TextManipulator : public Manipulator { public: TextManipulator();};/**/class TextShape : public Shape {public: TextShape(TextView*); virtual void BoundingBox( Point& bottomLeft, Point& topRight ) const; virtual bool IsEmpty() const; virtual Manipulator* CreateManipulator() const;private: TextView* _text;};/**/TextShape::TextShape (TextView* t) { _text = t;}/**/void TextShape::BoundingBox ( Point& bottomLeft, Point& topRight) const { Coord bottom, left, width, height; _text->GetOrigin(bottom, left); _text->GetExtent(width, height); bottomLeft = Point(bottom, left); topRight = Point(bottom + height, left + width);}/**/bool TextShape::IsEmpty () const { return _text->IsEmpty();}/**/Manipulator* TextShape::CreateManipulator () const { return new TextManipulator(this);}/**/#endif/**/
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -