📄 wzfunction.hxx
字号:
#ifndef wzfunction_hxx#define wzfunction_hxx#ifndef wzpoint_hxx#include "wzpoint.hxx"#endifclass wzPointToFloat;class wzPointToSegment;class wzPointToIndex;class wzPointToPoint;// the following classes are abstract classes. They are designed so// that behind a given class which looks like a function something// very complex may be hidden:class wzPointToFloat{public: virtual wzFloat operator()(const wzPoint& p) const=0; wzFloat call(const wzPoint& p) const {return operator()(p);}};class wzPointToIndex{public: virtual wzIndex operator()(const wzPoint& p) const=0; wzIndex call(const wzPoint& p) const {return operator()(p);}};class wzPointToSegment{public: virtual wzSegment operator()(const wzPoint& p) const=0; wzSegment call(const wzPoint& p) const {return operator()(p);}};class wzPointToPoint{public: virtual void operator()(wzPoint& p, const wzPoint& pold) const=0; void call(wzPoint& p, const wzPoint& o) const {operator()(p,o);}};// The following classes are the simplest implementations, using the// relevant standard C function types:class wzSimplePointToFloat: public wzPointToFloat{ wzFloat (*f)(const wzPoint& p);public: virtual wzFloat operator()(const wzPoint& p) const {return (*f)(p);} wzSimplePointToFloat(wzFloat (*func)(const wzPoint& p)):f(func){;}};class wzSimplePointToIndex: public wzPointToIndex{ wzIndex (*f)(const wzPoint& p);public: virtual wzIndex operator()(const wzPoint& p) const {return (*f)(p);} wzSimplePointToIndex(wzIndex (*func)(const wzPoint& p)):f(func){;}};class wzSimplePointToSegment: public wzPointToSegment{ wzSegment (*f)(const wzPoint& p);public: virtual wzSegment operator()(const wzPoint& p) const {return (*f)(p);} wzSimplePointToSegment(wzSegment (*func)(const wzPoint& p)):f(func){;}};class wzSimplePointToPoint: public wzPointToPoint{ void (*f)(wzPoint& p, const wzPoint& o);public: virtual void operator()(wzPoint& p, const wzPoint& o) const {(*f)(p,o);} wzSimplePointToPoint(void (*func)(wzPoint& p, const wzPoint& o)):f(func){;}};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -