summaryrefslogtreecommitdiff
path: root/include/Main.h
blob: 6d4ac9c7ab6a5cf5e35c517ea0e3e4cec971f4c5 (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
#ifndef __MAIN_H__
#define __MAIN_H__

#include "Exceptions.h"

extern char ** environ;

class Main : public Base {
  public:
      Main();
      virtual ~Main();
    virtual int startup() throw (GeneralException) = 0;
    static int truemain(Main *, int, char **, char **);
  protected:
    int argc;
    char ** argv;
    char ** enve;
    bool setted;
  private:
    void set_args(int, char **, char **);
    
};

#define CODE_BEGINS class Appli : public Main {
#define CODE_ENDS }; \
int main(int argc, char ** argv) { \
    int r; \
    Appli * Application = new Appli(); \
    r = Main::truemain(Application, argc, argv, environ); \
    delete Application; \
    return r; \
}

#endif