move comparison out of class Token; bugfix;

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2532 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-08-17 11:37:48 +00:00
parent 60e132e76e
commit 3c93fa9279

View File

@ -175,10 +175,6 @@ public:
/// ///
Token(const string & cs) : cs_(cs), char_(0), cat_(catIgnore) {} Token(const string & cs) : cs_(cs), char_(0), cat_(catIgnore) {}
///
bool operator==(Token const & t) const;
///
bool operator!=(Token const & t) const;
/// ///
string const & cs() const { return cs_; } string const & cs() const { return cs_; }
/// ///
@ -202,14 +198,15 @@ string Token::asString() const
return cs_.size() ? cs_ : string(1, char_); return cs_.size() ? cs_ : string(1, char_);
} }
bool Token::operator==(Token const & t) const bool operator==(Token const & s, Token const & t)
{ {
return char_ == t.char_ && cat_ == t.cat_ && cs_ == t.cs_; return s.character() == t.character()
&& s.cat() == t.cat() && s.cs() == t.cs();
} }
bool Token::operator!=(Token const & t) const bool operator!=(Token const & s, Token const & t)
{ {
return char_ != t.char_ && cat_ != t.cat_ && cs_ != t.cs_; return !(s == t);
} }
ostream & operator<<(ostream & os, Token const & t) ostream & operator<<(ostream & os, Token const & t)