--- deliantra/server/include/shstr.h 2007/11/08 19:43:25 1.20 +++ deliantra/server/include/shstr.h 2008/12/28 06:59:27 1.23 @@ -1,7 +1,7 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * * Deliantra is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,17 +118,17 @@ return *this; } - bool operator ==(const shstr &b) - { - return s == b.s; - } - bool operator !=(const shstr &b) { return !(*this == b); } }; +inline bool operator ==(const shstr &a, const shstr &b) +{ + return a.s == b.s; +} + inline int strlen (const shstr &sh) { return sh.length (); @@ -167,6 +167,14 @@ { } + shstr_cmp (const shstr &sh) + : s (sh.s) + { + } + + // this is used for informational messages and the like + const char *operator &() const { return s; } + shstr_cmp &operator =(const shstr_cmp sh) { s = sh.s; return *this; } operator const char *() const { return s; } }; @@ -181,6 +189,8 @@ return b == a; } +extern const shstr shstr_null; + #define def(str) extern const shstr shstr_ ## str; # include "shstrinc.h" #undef def