Y
yinglcs
I find the following class declaration in a .cpp file.
If I need to move it to .h file so that other class can include that .h
file and see this class,
do I need to move all the implementation of all the code back to .cpp?
Things like 'Constructor', 'Destructor', inline method, non-inline
method?
Thank you.
class nsCanvasPattern : public nsIDOMCanvasPattern
{
public:
nsCanvasPattern(cairo_pattern_t *cpat, PRUint8 *dataToFree)
: mPattern(cpat), mData(dataToFree)
{ }
~nsCanvasPattern() {
if (mPattern)
cairo_pattern_destroy(mPattern);
if (mData)
nsMemory::Free(mData);
}
void Apply(cairo_t *cairo) {
cairo_set_source(cairo, mPattern);
}
inline void Clear() {
mPattern->clear();
}
protected:
cairo_pattern_t *mPattern;
PRUint8 *mData;
};
If I need to move it to .h file so that other class can include that .h
file and see this class,
do I need to move all the implementation of all the code back to .cpp?
Things like 'Constructor', 'Destructor', inline method, non-inline
method?
Thank you.
class nsCanvasPattern : public nsIDOMCanvasPattern
{
public:
nsCanvasPattern(cairo_pattern_t *cpat, PRUint8 *dataToFree)
: mPattern(cpat), mData(dataToFree)
{ }
~nsCanvasPattern() {
if (mPattern)
cairo_pattern_destroy(mPattern);
if (mData)
nsMemory::Free(mData);
}
void Apply(cairo_t *cairo) {
cairo_set_source(cairo, mPattern);
}
inline void Clear() {
mPattern->clear();
}
protected:
cairo_pattern_t *mPattern;
PRUint8 *mData;
};