iRoCS Toolbox  1.1.0
Compiler.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (C) 2005-2015 Olaf Ronneberger, Jörg Mechnich, Florian Pigorsch,
4  * Mario Emmenlauer, Thorsten Schmidt
5  *
6  * Image Analysis Lab, University of Freiburg, Germany
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  **************************************************************************/
23 
24 /**************************************************************************
25 ** Title: basic compiler class
26 ** $RCSfile$
27 ** $Revision: 16 $$Name$
28 ** $Date: 2002-03-26 08:36:28 +0100 (Tue, 26 Mar 2002) $
29 ** Copyright: GPL $Author: ronneber $
30 ** Description:
31 **
32 **
33 **
34 **-------------------------------------------------------------------------
35 **
36 ** $Log$
37 ** Revision 1.1 2002/03/26 07:36:28 ronneber
38 ** restructuring for autoconf
39 **
40 ** Revision 1.1.1.1 2002/03/22 13:45:07 pigorsch
41 ** moved from polsoft repository
42 **
43 **
44 **
45 **************************************************************************/
46 
47 #ifndef COMPILER_HH
48 #define COMPILER_HH
49 
50 #ifdef HAVE_CONFIG_H
51 #include <config.hh>
52 #endif
53 
54 #include <string>
55 
56 /*======================================================================*/
62 /*======================================================================*/
63 template<typename T>
64 class Compiler
65 {
66 public:
67 
68  /*====================================================================*/
82  /*====================================================================*/
83  bool
84  compile(
85  const char* arg,
86  const char*& enptr,
87  T& value);
88 
89 
90  /*====================================================================*/
96  /*====================================================================*/
97  const std::string&
98  errorMsg() const
99  {
100  return pErrorMsg;
101  };
102 
103 
104 protected:
105 
106  /*====================================================================*/
112  /*====================================================================*/
113  void
114  setErrorMsg(const std::string& msg)
115  {
116  pErrorMsg=msg;
117  };
118 
119 
120  std::string pErrorMsg;
121 };
122 
123 #endif
const std::string & errorMsg() const
Return the error message of the last compilation.
Definition: Compiler.hh:98
void setErrorMsg(const std::string &msg)
Set the error message.
Definition: Compiler.hh:114
std::string pErrorMsg
Definition: Compiler.hh:117
The Compiler class is used by CmdArg classes to convert strings into desired datatypes.
Definition: Compiler.hh:64
bool compile(const char *arg, const char *&enptr, T &value)
Convert the given string into the desired datatype T.