2 * FileName: ConfigHolder.h
3 * Used to define the class ConfigHolder which is used to hold the config files.
5 * Copyright (C) 2008 Kermit Mei <kermit.mei@gmail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 3 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
21 * Written by Kermit Mei <kermit.mei@gmail.com>
23 * Many of the ideas implemented here are from the author's experiment.
24 * But the dictionary's format coincide with the other word recite software
25 * to help the users get more available data. And the review times designed
26 * by means of the theory named Forgetting Curve which dicoveried by the
27 * German psychologist named Hermann Ebbinghaus(1850–1909).
31 #ifndef CONFIGHOLDER_H
32 #define CONFIGHOLDER_H
37 namespace freeRecite
{
40 extern ConfigHolder configHolder
;
46 void load(const char *rootDir
, const char *globleDir
,
47 const char *soundDir
= 0);
48 void setRootDir(const char *dir
);
49 void setGlobalDir(const char *dir
);
50 void soundDir(const char *dir
);
52 std::string
rootDir() const;
53 std::string
tasksDir() const;
54 std::string
mgrFile() const;
55 std::string
localDictFile() const;
56 std::string
globalDictFile() const;
57 std::string
keyFile() const;
58 std::string
doneFile() const;
59 std::string
soundDir() const;
60 std::string
musicDir() const;
62 const std::vector
<unsigned> *e_list();
63 const std::vector
<unsigned> *r_list();
64 const std::vector
<unsigned> *s_list();
65 const std::vector
<unsigned> *t_list();
68 std::string rootDirectory
;
69 std::string globalDirectory
;
70 std::string soundDirectory
;
71 std::vector
<unsigned> initPt
;
75 std::string
ConfigHolder::doneFile() const {
77 return rootDirectory
+ "tasks\\done.txt";
79 return rootDirectory
+ "tasks/done.txt";
84 std::string
ConfigHolder::rootDir() const {
89 std::string
ConfigHolder::tasksDir() const {
91 return rootDirectory
+ "tasks\\";
93 return rootDirectory
+ "tasks/";
98 std::string
ConfigHolder::mgrFile() const {
99 return rootDirectory
+ "freeRecite.mgr";
103 std::string
ConfigHolder::localDictFile() const {
104 return rootDirectory
+ "freeRecite.dict";
108 std::string
ConfigHolder::globalDictFile() const {
109 return globalDirectory
+ "freeRecite.dict";
113 std::string
ConfigHolder::keyFile() const {
114 return rootDirectory
+ "keystone.txt";
118 std::string
ConfigHolder::soundDir() const {
120 return soundDirectory
;
122 return soundDirectory
;
127 std::string
ConfigHolder::musicDir() const {
129 return globalDirectory
+ "music\\";
131 return globalDirectory
+ "music/";
135 }//End of namespace freeRecite.