remove macro NO_CODING_LOG

This commit is contained in:
aholic 2013-11-28 09:17:29 +08:00
parent 1b1ed6e3aa
commit 12328a3a7e
3 changed files with 1 additions and 16 deletions

View File

@ -24,13 +24,11 @@ namespace CppJieba
public: public:
bool init() bool init()
{ {
#ifndef NO_CODING_LOG
if(_getInitFlag()) if(_getInitFlag())
{ {
LogError("already inited before now."); LogError("already inited before now.");
return false; return false;
} }
#endif
if(!_trie.init()) if(!_trie.init())
{ {
LogError("_trie.init failed."); LogError("_trie.init failed.");
@ -47,12 +45,10 @@ namespace CppJieba
} }
bool dispose() bool dispose()
{ {
#ifndef NO_CODING_LOG
if(!_getInitFlag()) if(!_getInitFlag())
{ {
return true; return true;
} }
#endif
_trie.dispose(); _trie.dispose();
_setInitFlag(false); _setInitFlag(false);
return true; return true;
@ -65,7 +61,6 @@ namespace CppJieba
bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<Unicode>& res) const bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<Unicode>& res) const
{ {
assert(_getInitFlag()); assert(_getInitFlag());
#ifndef NO_CODING_LOG
//if (!_getInitFlag()) //if (!_getInitFlag())
//{ //{
// LogError("not inited."); // LogError("not inited.");
@ -76,7 +71,6 @@ namespace CppJieba
LogError("begin >= end"); LogError("begin >= end");
return false; return false;
} }
#endif
//resut of searching in trie tree //resut of searching in trie tree
vector<pair<uint, const TrieNodeInfo*> > tRes; vector<pair<uint, const TrieNodeInfo*> > tRes;
@ -123,7 +117,6 @@ namespace CppJieba
bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<string>& res) const bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<string>& res) const
{ {
#ifndef NO_CODING_LOG
if (!_getInitFlag()) if (!_getInitFlag())
{ {
LogError("not inited."); LogError("not inited.");
@ -134,7 +127,6 @@ namespace CppJieba
LogError("begin > end"); LogError("begin > end");
return false; return false;
} }
#endif
vector<Unicode> uRes; vector<Unicode> uRes;
if (!cut(begin, end, uRes)) if (!cut(begin, end, uRes))
{ {

View File

@ -55,6 +55,7 @@ namespace CppJieba
public: public:
using SegmentBase::cut; using SegmentBase::cut;
public: public:
virtual bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<string>& res)const virtual bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<string>& res)const
{ {
//if(!_getInitFlag()) //if(!_getInitFlag())

View File

@ -27,12 +27,10 @@ namespace CppJieba
public: public:
bool init() bool init()
{ {
#ifndef NO_CODING_LOG
if (_getInitFlag()) if (_getInitFlag())
{ {
LogError("inited."); LogError("inited.");
} }
#endif
if (!_hmmSeg.init()) if (!_hmmSeg.init())
{ {
LogError("_hmmSeg init"); LogError("_hmmSeg init");
@ -47,12 +45,10 @@ namespace CppJieba
} }
bool dispose() bool dispose()
{ {
#ifndef NO_CODING_LOG
if(!_getInitFlag()) if(!_getInitFlag())
{ {
return true; return true;
} }
#endif
_fullSeg.dispose(); _fullSeg.dispose();
_hmmSeg.dispose(); _hmmSeg.dispose();
_setInitFlag(false); _setInitFlag(false);
@ -66,7 +62,6 @@ namespace CppJieba
bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<Unicode>& res) const bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<Unicode>& res) const
{ {
assert(_getInitFlag()); assert(_getInitFlag());
#ifndef NO_CODING_LOG
//if (!_getInitFlag()) //if (!_getInitFlag())
//{ //{
// LogError("not inited."); // LogError("not inited.");
@ -77,7 +72,6 @@ namespace CppJieba
LogError("begin >= end"); LogError("begin >= end");
return false; return false;
} }
#endif
//use hmm cut first //use hmm cut first
vector<Unicode> hmmRes; vector<Unicode> hmmRes;
if (!_hmmSeg.cut(begin, end, hmmRes)) if (!_hmmSeg.cut(begin, end, hmmRes))
@ -113,7 +107,6 @@ namespace CppJieba
bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<string>& res) const bool cut(Unicode::const_iterator begin, Unicode::const_iterator end, vector<string>& res) const
{ {
#ifndef NO_CODING_LOG
if (!_getInitFlag()) if (!_getInitFlag())
{ {
LogError("not inited."); LogError("not inited.");
@ -124,7 +117,6 @@ namespace CppJieba
LogError("begin > end"); LogError("begin > end");
return false; return false;
} }
#endif
vector<Unicode> uRes; vector<Unicode> uRes;
if (!cut(begin, end, uRes)) if (!cut(begin, end, uRes))
{ {