]> git.lyx.org Git - features.git/commitdiff
some other things
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 15 Nov 1999 14:45:17 +0000 (14:45 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 15 Nov 1999 14:45:17 +0000 (14:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@317 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/mathed/math_parser.C
src/support/LSubstring.C
src/support/LSubstring.h
src/support/lyxstring.C
src/support/lyxstring.h

index 5691c5a8db39ab1313ce3bf2bbb7b3faa97bfbfc..1247802360ccb47ff2b19cab26d8df34c1ca4585 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 1999-11-15  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
+       * src/support/LSubstring.[Ch]: made the second arg of most of the
+       constructors be a const reference. 
+
+       * src/mathed/math_parser.C (LexInitCodes): small bug introduced by
+       me fixed.
+
+       * src/support/lyxstring.[Ch] (swap): added missing member function
+       and specialization of swap(str, str); 
+
        * src/menus.C (ShowBufferMenu): to use the new BufferStorage
 
        * src/bufferlist.[Ch]: use the new BufferStorage class and remove all
index be49f67e1d1f05043398f0ab9355b06d13ed8ccd..d8db81f1c19cda34b3d454eb698f0429ef2fd3bb 100644 (file)
@@ -119,7 +119,7 @@ static void LexInitCodes()
    lexcode['%'] = LexComment;
    lexcode['#'] = LexArgument;
    lexcode['+'] = lexcode['-'] = lexcode['*'] = lexcode['/'] = 
-   lexcode['<'] = lexcode['>'] = lexcode['= '] = LexBOP;
+   lexcode['<'] = lexcode['>'] = lexcode['='] = LexBOP;
    
    lexcode['!'] = lexcode[','] = lexcode[':'] = lexcode[';'] = LexMathSpace;
    lexcode['('] = lexcode[')'] = lexcode['|'] = lexcode['.'] = lexcode['?'] = LexOther; 
index b2c2ef05de9133d01395e6c15a26c7ffbb022040..6c5509fdadafc90f7c4426d8dee2aae40ae642c3 100644 (file)
@@ -21,14 +21,14 @@ LSubstring::LSubstring(string & s, size_type i, size_type l)
 }
 
 
-LSubstring::LSubstring(string & s, string & s2)
+LSubstring::LSubstring(string & s, string const & s2)
        : ps(&s), n(s2.length())
 {
        pos = s.find(s2);
 }
 
 
-LSubstring::LSubstring(string & s, char * p)
+LSubstring::LSubstring(string & s, string::value_type const * p)
        : ps(&s)
 {
        n = strlen(p);
@@ -36,7 +36,7 @@ LSubstring::LSubstring(string & s, char * p)
 }
 
 
-LSubstring::LSubstring(string & s, LRegex & r)
+LSubstring::LSubstring(string & s, LRegex const & r)
        : ps(&s)
 {
        LRegex::MatchPair res = r.first_match(s);
@@ -82,13 +82,3 @@ LSubstring::operator string() const
 {
        return string(*ps, pos, n); // copy from *ps
 }
-
-
-#if 0
-LSubstring::operator char const * () const
-{
-       static string tr;
-       tr.assign(*ps, pos, n);
-       return tr.c_str();
-}
-#endif
index 96164f11b99631b50c9c01646a6083bc9eb40f10..f5ec98b8f91b54e30e5abfb5cb6e3535e33347b8 100644 (file)
@@ -31,11 +31,11 @@ public:
        ///
        LSubstring(string & s, size_type i, size_type n);
        ///
-       LSubstring(string & s, string & s2);
+       LSubstring(string & s, string const & s2);
        ///
-       LSubstring(string & s, string::value_type * p);
+       LSubstring(string & s, string::value_type const * p);
        ///
-       LSubstring(string & s, LRegex & r);
+       LSubstring(string & s, LRegex const & r);
        ///
        LSubstring & operator=(string const &);
        ///
@@ -46,10 +46,6 @@ public:
        LSubstring & operator=(string::value_type);
        ///
        operator string() const;
-#if 0
-       ///
-       operator char const * () const;
-#endif
 private:
        ///
        string * ps;
index 129cd75746b3b8bb366687bc7ff3cda8cb40a20f..1083669415cb55e15b69b6226a7c82261672e078 100644 (file)
@@ -1345,6 +1345,15 @@ lyxstring & lyxstring::replace(iterator i, iterator i2,
 }
 
 
+void lyxstring::swap(lyxstring & str)
+{
+       if (rep == str.rep) return;
+       Srep * tmp = str.rep;
+       str.rep = rep;
+       rep = tmp;
+}
+
+
 lyxstring & lyxstring::erase(size_type i, size_type n)
 {
        Assert(i <= rep->sz); // STD!
@@ -1667,6 +1676,13 @@ lyxstring operator+(lyxstring const & a, lyxstring::value_type b)
        return tmp;
 }
 
+
+void swap(lyxstring & str1, lyxstring & str2)
+{
+       str1.swap(str2);
+}
+
+
 #include <iostream>
 
 istream & operator>>(istream & is, lyxstring & s)
index 22e0b88cc3a1af0790bd57a152a3c1d3245647ec..f2cd44fbf32130494238b79b72f33c8ae60fa5bc 100644 (file)
@@ -449,6 +449,9 @@ public:
        ///
        lyxstring & replace(iterator i, iterator i2, iterator j, iterator j2);
 
+       ///
+       void swap(lyxstring & str);
+       
        /// Erase n chars from position i.
        lyxstring & erase(size_type i = 0, size_type n = npos);
 
@@ -599,6 +602,8 @@ lyxstring operator+(lyxstring::value_type a, lyxstring const & b);
 lyxstring operator+(lyxstring const & a, lyxstring::value_type const * b);
 lyxstring operator+(lyxstring const & a, lyxstring::value_type b);
 
+void swap(lyxstring & s1, lyxstring & s2);
+
 istream & operator>>(istream &, lyxstring &);
 ostream & operator<<(ostream &, lyxstring const &);
 istream & getline(istream &, lyxstring &, lyxstring::value_type delim = '\n');