ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/shstr.h
(Generate patch)

Comparing deliantra/server/include/shstr.h (file contents):
Revision 1.13 by root, Mon Apr 23 15:27:46 2007 UTC vs.
Revision 1.15 by root, Mon May 14 21:52:32 2007 UTC

29 } 29 }
30 30
31 int length () const 31 int length () const
32 { 32 {
33 return length (s); 33 return length (s);
34 }
35
36 // returns wether this shared string begins with the given prefix,
37 // used mainly for searched when users give only the start of a name.
38 bool begins_with (const char *prefix) const
39 {
40 int plen = strlen (prefix);
41 return !strncasecmp (s, prefix, plen) && length () >= plen;
34 } 42 }
35 43
36 static const char *find (const char *s); 44 static const char *find (const char *s);
37 static const char *intern (const char *s); 45 static const char *intern (const char *s);
38 46
113 do_not_use_strcmp_to_compare_shstr_values (); 121 do_not_use_strcmp_to_compare_shstr_values ();
114#endif 122#endif
115 return a != b; 123 return a != b;
116} 124}
117 125
118std::ostream &operator <<(std::ostream &o, const shstr &sh) 126static std::ostream &operator <<(std::ostream &o, const shstr &sh)
119{ 127{
120 o.write (sh.s, sh.length ()); 128 o.write (sh.s, sh.length ());
121 return o; 129 return o;
122} 130}
123 131

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines