summaryrefslogtreecommitdiffstats
path: root/kugar/lib/mutil.h
blob: b7aa764f80807fb14cff1a10ab74b4a9cff88072 (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 <qobject.h>
#include <qstring.h>
#include <qdatetime.h>
#include <qmemarray.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 QString formatDate( const QDate& value, int format );

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

};

}

#endif