summaryrefslogtreecommitdiffstats
path: root/kugar/lib/mspecialobject.cpp
blob: 74e248d707e9fc38ec7031dfd4d9834a0d25c1db (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/***************************************************************************
             mspecialobject.cpp  -  Kugar report special field object
             -------------------
   begin     : Mon Aug 23 1999
   copyright : (C) 1999 by Mutiny Bay Software
   email     : [email protected]
***************************************************************************/

#include "mspecialobject.h"
#include "mutil.h"

namespace Kugar
{

/** Constructor */
MSpecialObject::MSpecialObject() : MLabelObject()
{
    // Set the defaults
    type = MSpecialObject::Date;
    format = MUtil::MDY_SLASH;
}

/** Copy constructor */
MSpecialObject::MSpecialObject( const MSpecialObject& mSpecialObject ) : MLabelObject( ( MLabelObject & ) mSpecialObject )
{
    copy( &mSpecialObject );
}

/** Assignment operator */
MSpecialObject MSpecialObject::operator=( const MSpecialObject& mSpecialObject )
{
    if ( &mSpecialObject == this )
        return * this;

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

    // Copy the base class's data
    ( ( MLabelObject & ) * this ) = mSpecialObject;

    return *this;
}

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

/** Sets the field's data string with a date */
void MSpecialObject::setText( TQDate d )
{
    text = MUtil::formatDate( d, format );
}

/** Sets the field's data string with a page number */
void MSpecialObject::setText( int page )
{
    text.setNum( page );
}

/** Sets the field's data type */
void MSpecialObject::setType( int t )
{
    type = t;
}

/** Gets the field's type */
int MSpecialObject::getType()
{
    return type;
}

/** Sets the field's date formatting */
void MSpecialObject::setDateFormat( int f )
{
    format = f;
}

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

}