FreeRecite Version 2.0
[FreeRecite.git] / src / core / DictItem.h
blobc11ff697042bcfb18f6a34bf7803bb5ea36c2347
1 /**
2 * FileName: DictItem.h.
3 * Used to define the class DictItem to declare the items from the dictionary.
5 * Copyright (C) 2008 Kermit Mei <kermit.mei@gmail.com>
6 * All Rights Reserved.
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
19 * Foundation.
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).
29 **/
31 #ifndef DICTITEM_HPP
32 #define DICTITEM_HPP
34 #include <string>
36 namespace freeRecite {
38 class DictItem
40 public:
41 DictItem() : strItem(0)
42 { /* Do Nothing! */ }
43 ~DictItem()
44 { /* Do Nothing! */ }
46 bool refer(const std::string &str);
48 const std::string & getW() const
49 { return bufW; }
50 const std::string & getT() const
51 { return bufT; }
52 const std::string & getM() const
53 { return bufM; }
55 private:
57 const std::string *strItem;
59 const static std::string sW;
60 const static std::string sT;
61 const static std::string sM;
62 const static int offset;
64 size_t posW;
65 size_t posT;
66 size_t posM;
68 std::string bufW;
69 std::string bufT;
70 std::string bufM;
73 } // namespace freeRecite end
74 #endif