File: cmdparser.h

package info (click to toggle)
gxtuner 2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 704 kB
  • sloc: cpp: 8,429; makefile: 126
file content (78 lines) | stat: -rw-r--r-- 2,377 bytes parent folder | download | duplicates (3)
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
/*
 * Copyright (C) 2011 Hermann Meyer, Andreas Degert
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 * ---------------------------------------------------------------------------
 *
 *        file: comparse.h      guitar tuner for jack
 *
 * ----------------------------------------------------------------------------
 */
 
#pragma once

#ifndef CMD_PARSER_H_
#define CMD_PARSER_H_

#include <glib.h>
#include <string> 
#include <cstdlib>


#define JACK_INP        (0)
#define SIZE_X          (1)
#define SIZE_Y          (2)
#define POS_X           (3)
#define POS_Y           (4)
#define PITCH           (5)
#define THRESHOLD       (6)
#define JACK_UUID       (7)
#define DESK            (8)

class CmdParse {
 private:
    GError*             error;
    GOptionContext*     opt_context;
    GOptionGroup*       optgroup_gtk;
    GOptionGroup*       optgroup_jack;
    GOptionGroup*       optgroup_engine;
    gchar*              jack_uuid;
    gchar*              jack_input;
    gchar*              size_x;
    gchar*              size_y;
    gchar*              pos_x;
    gchar*              pos_y;
    gchar*              desktop;
    gchar*              pitch;
    gchar*              threshold;
    std::string         infostring;
    void                init();
    void                setup_groups();
    void                parse(int& argc, char**& argv);
    void                write_optvar();
 protected:
    std::string         optvar[9];

 public:
    explicit CmdParse();
    ~CmdParse();
    std::string         get_optvar(int a) {return optvar[a];}
    void                process_cmdline_options(int& argc, char**& argv);
};
extern CmdParse         cmd;

#endif // CMD_PARSER_H_