summaryrefslogtreecommitdiffstats
path: root/kugar/lib/mutil.h
blob: 9003221bc91c59d42590c47b0767349a6db32aba (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
/***************************************************************************
             mutil.h  -  Kugar utlity class
             -------------------
   begin     : Tue Aug 17 1999
   copyright : (C) 1999 by Mutiny Bay Software
   email     : info@mutinybaysoftware.com
   copyright : (C) 2002 Alexander Dymo
   email     : cloudtemple@mksat.net
***************************************************************************/

#ifndef MUTIL_H
#define MUTIL_H

#include <tqobject.h>
#include <tqstring.h>
#include <tqdatetime.h>
#include <tqmemarray.h>


/**Kugar utlity class
  *@author Mutiny Bay Software
  */

namespace Kugar
{

class MUtil
{

public:
    /** Formatting constants */
    enum DateFormatType {
        MDY_SLASH = 0, MDY_DASH,
        MMDDY_SLASH, MMDDY_DASH,
        MDYYYY_SLASH, MDYYYY_DASH,
        MMDDYYYY_SLASH, MMDDYYYY_DASH,
        YYYYMD_SLASH, YYYYMD_DASH,
        DDMMYY_PERIOD, DDMMYYYY_PERIOD
    };

    /** Formats a date using one of the pre-defined formats */
    static TQString formatDate( const TQDate& value, int format );

    /** Returns the count for an array of doubles */
    static int count( TQMemArray<double>* values );
    /** Returns the sum for an array of doubles */
    static double sum( TQMemArray<double>* values );
    /** Returns the average value for an array of doubles */
    static double average( TQMemArray<double>* values );
    /** Returns the variance for an array of doubles */
    static double variance( TQMemArray<double>* values );
    /** Returns the standard deviation for an array of doubles */
    static double stdDeviation( TQMemArray<double>* values );

};

}

#endif