Debian Codegraph @

src/tools/dlgedit/cfg_project.cc

raw
1 /*
2 Copyright (C) 2002 Kai Sterker <[email protected]>
3 Part of the Adonthell Project <http://adonthell.nongnu.org>
4
5 Dlgedit is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 Dlgedit is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Dlgedit. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /**
20 * @file cfg_project.cc
21 *
22 * @author Kai Sterker
23 * @brief Project specific configuration data
24 */
25
26 #include "cfg_project.h"
27 #include "dlg_types.h"
28
29 extern int parse_cfgfile (std::string&, int&);
30
31 // ctor
32 CfgProject::CfgProject (std::string name)
33 {
34 Name = name;
35 BaseDir = "";
36 }
37
38 // load project data
39 bool CfgProject::load ()
40 {
41 int token = 1, n;
42 std::string s;
43
44 // as long as reading something from file ...
45 while (token)
46 {
47 // get next token
48 switch (token = parse_cfgfile (s, n))
49 {
50 case LOAD_END: return true;
51
52 case LOAD_BASE_DIR:
53 {
54 if (parse_cfgfile (s, n) == LOAD_STR) BaseDir = s;
55 break;
56 }
57
58 default: break;
59 }
60 }
61
62 return false;
63 }
64
65 // save project data
66 void CfgProject::save (std::ofstream &out)
67 {
68 out << "\nProject [" << Name << "]\n"
69 << " BaseDir [" << BaseDir << "]\n"
70 << "End" << std::endl;
71 }