summaryrefslogtreecommitdiffstats
path: root/kugar/lib/mcalcobject.cpp
blob: fbb7345fa384e34819352539098403a68aa830ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/***************************************************************************
            mcalcobject.cpp  -  Kugar report calculation field object
            -------------------
  begin     : Thu Sep 2 1999
  copyright : (C) 1999 by Mutiny Bay Software
  email     : [email protected]
***************************************************************************/

#include "mcalcobject.h"

namespace Kugar
{

/** Constructor */
MCalcObject::MCalcObject() : MFieldObject()
{
    // Set the default calculation type
    calcType = MCalcObject::Count;
}

/** Copy constructor */
MCalcObject::MCalcObject( const MCalcObject& mCalcObject ) : MFieldObject( ( MFieldObject & ) mCalcObject )
{
    copy( &mCalcObject );
}

/** Assignment operator */
MCalcObject MCalcObject::operator=( const MCalcObject& mCalcObject )
{
    if ( &mCalcObject == this )
        return * this;

    // Copy the derived class's data
    copy( &mCalcObject );

    // Copy the base class's data
    ( ( MFieldObject & ) * this ) = mCalcObject;

    return *this;
}

/** Destructor */
MCalcObject::~MCalcObject()
{}

/** Sets the field's  calculation type */
void MCalcObject::setCalculationType( int type )
{
    calcType = type;
}

/** Returns the field's calculation type */
int MCalcObject::getCalculationType()
{
    return calcType;
}

/** Copies member data from one object to another.
      Used by the copy constructor and assignment operator */
void MCalcObject::copy( const MCalcObject* mCalcObject )
{
    // Copy the fields's calculation type
    calcType = mCalcObject->calcType;
}

}