File: Utility.h

package info (click to toggle)
clustalx 2.1%2Blgpl-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,324 kB
  • sloc: cpp: 40,050; sh: 163; xml: 102; makefile: 16
file content (74 lines) | stat: -rw-r--r-- 2,262 bytes parent folder | download | duplicates (10)
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
/**
 * Author: Mark Larkin
 * 
 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.  
 */
#ifndef UTILITY_H
#define UTILITY_H

#include <cstdlib>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <ctype.h>
#include "clustalw.h"
class QLabel;
using namespace std;

namespace clustalw
{
class Utility
{
    public:
        Utility();
	virtual ~Utility(){};

        char* rTrim(char *str);
        void rTrim(string *str);
        char* blankToUnderscore(char *str);
        string blankToUnderscore(string str);
        void getStr(string instr, string& outstr);
        char getChoice(string instr);
        double getReal(const char *instr, double minx, double maxx, double def);
        int getInt(const char *instr,int minx,int maxx, int def);
        unsigned long getUniqueSequenceIdentifier();
        bool lineType(char *line, const char *code);

        bool blankLine(char *line);
        bool blankLineNumericLabel(char *line);
        
        void getPath(string str, string *path);
        
        virtual char promptForYesNo(char *title, const char *prompt);
        virtual char promptForYesNo(const char *title, const char *prompt);
        virtual void error( char *msg,...);
        virtual void error( const char *msg,...);
        virtual void warning( char *msg,...);
        virtual void warning( const char *msg,...);
        virtual void info( char *msg,...);
        virtual void info( const char *msg,...);
        virtual void myname( char *myname );
        template <class T> T MIN(T x, T y){if (x <= y){return x;}return y;}
        template <class T> T MAX(T x, T y){if (x >= y){return x;}return y;}
        // Note the following function will never be used from this class. It is for the
        // QT version. I need it here so that I can add the function to QTUtility.
        virtual void setInfoLabelPtr(QLabel* ptrToLabelObj);
        bool isNumeric(char ch);
        double average(std::vector<double>& v);
        double stdDev(std::vector<double>& v);
        double median(std::vector<double> v);
        /* Attributes */
        void beQuiet(bool b) {quiet=b;};
        
    private:
        /* Functions */


        /* Attributes */
        bool quiet;

};
}
#endif