5 //Initialize the const static members of DictItem.
7 const std::string
DictItem::sW("[W]");
8 const std::string
DictItem::sT("[T]");
9 const std::string
DictItem::sM("[M]");
10 const std::string
DictItem::sE("[E]");
11 const int DictItem::offset(3);
14 bool DictItem::refer(const std::string
&str
) {
16 posW
= str
.find(DictItem::sW
);
17 posT
= str
.find(DictItem::sT
);
18 posM
= str
.find(DictItem::sM
);
19 posE
= str
.find(DictItem::sE
);
21 if(posW
== std::string::npos
22 || posT
== std::string::npos
23 || posM
== std::string::npos
) {
30 bufW
= strItem
->substr(posW
+offset
,posT
-posW
-offset
);
31 bufT
= strItem
->substr(posT
+offset
,posM
-posT
-offset
);
32 if(posE
== std::string::npos
){
33 bufM
= strItem
->substr(posM
+offset
,strItem
->size()-posM
-offset
);
34 bufE
= std::string("");
36 bufM
= strItem
->substr(posM
+offset
,posE
-posM
-offset
);
37 bufE
= strItem
->substr(posE
+offset
,strItem
->size()-posE
-offset
);
43 } // namespace freeRecite end