]> git.lyx.org Git - features.git/commitdiff
introduce namespace lyx::support
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 30 Jun 2003 23:56:22 +0000 (23:56 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 30 Jun 2003 23:56:22 +0000 (23:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7224 a592a061-630c-0410-9148-cb99ea01b6c8

258 files changed:
boost/boost/format/format_implementation.hpp
boost/boost/format/parsing.hpp
src/BufferView.C
src/BufferView_pimpl.C
src/Bullet.C
src/ChangeLog
src/Chktex.C
src/CutAndPaste.C
src/DepTable.C
src/LColor.C
src/LString.h
src/LaTeX.C
src/LaTeXFeatures.C
src/LyXAction.C
src/MenuBackend.C
src/ParagraphParameters.C
src/PrinterParams.h
src/ToolbarBackend.C
src/author.C
src/boost.C
src/buffer.C
src/buffer_funcs.C
src/bufferlist.C
src/bufferparams.C
src/bufferview_funcs.C
src/changes.C
src/chset.C
src/converter.C
src/counters.C
src/debug.C
src/exporter.C
src/factory.C
src/format.C
src/frontends/LyXView.C
src/frontends/Timeout.C
src/frontends/controllers/ButtonController.C
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlAboutlyx.C
src/frontends/controllers/ControlBibtex.C
src/frontends/controllers/ControlButtons.C
src/frontends/controllers/ControlChanges.C
src/frontends/controllers/ControlCommandBuffer.C
src/frontends/controllers/ControlDocument.C
src/frontends/controllers/ControlExternal.C
src/frontends/controllers/ControlForks.C
src/frontends/controllers/ControlGraphics.C
src/frontends/controllers/ControlInclude.C
src/frontends/controllers/ControlMath.C
src/frontends/controllers/ControlParagraph.C
src/frontends/controllers/ControlPrefs.C
src/frontends/controllers/ControlPrint.C
src/frontends/controllers/ControlRef.C
src/frontends/controllers/ControlSendto.C
src/frontends/controllers/ControlShowFile.C
src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/ControlTabular.C
src/frontends/controllers/ControlVCLog.C
src/frontends/controllers/Dialog.C
src/frontends/controllers/ViewBase.C
src/frontends/controllers/biblio.C
src/frontends/controllers/helper_funcs.C
src/frontends/controllers/tex_helpers.C
src/frontends/qt2/BulletsModule.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/FileDialog_private.C
src/frontends/qt2/QAbout.C
src/frontends/qt2/QBibtex.C
src/frontends/qt2/QBibtexDialog.C
src/frontends/qt2/QCitation.C
src/frontends/qt2/QCommandBuffer.C
src/frontends/qt2/QDocumentDialog.C
src/frontends/qt2/QExternal.C
src/frontends/qt2/QGraphics.C
src/frontends/qt2/QLImage.C
src/frontends/qt2/QLPopupMenu.C
src/frontends/qt2/QMinipage.C
src/frontends/qt2/QParagraph.C
src/frontends/qt2/QPrefs.C
src/frontends/qt2/QTexinfo.C
src/frontends/qt2/QVCLog.C
src/frontends/qt2/QWrap.C
src/frontends/qt2/QtView.C
src/frontends/qt2/floatplacement.C
src/frontends/qt2/lyx_gui.C
src/frontends/qt2/panelstack.C
src/frontends/qt2/qfont_loader.C
src/frontends/screen.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/ColorHandler.C
src/frontends/xforms/FileDialog.C
src/frontends/xforms/FontInfo.C
src/frontends/xforms/FormBase.C
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/FormCharacter.C
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormDialogView.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormExternal.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/FormFloat.C
src/frontends/xforms/FormForks.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/FormInclude.C
src/frontends/xforms/FormMathsBitmap.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/FormPrint.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/FormSendto.C
src/frontends/xforms/FormTabular.C
src/frontends/xforms/FormTexinfo.C
src/frontends/xforms/FormText.C
src/frontends/xforms/FormThesaurus.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormWrap.C
src/frontends/xforms/Menubar_pimpl.C
src/frontends/xforms/RadioButtonGroup.C
src/frontends/xforms/Tooltips.C
src/frontends/xforms/XFormsView.C
src/frontends/xforms/XPainter.C
src/frontends/xforms/checkedwidgets.C
src/frontends/xforms/forms_gettext.C
src/frontends/xforms/input_validators.C
src/frontends/xforms/lyx_gui.C
src/frontends/xforms/xfont_loader.C
src/frontends/xforms/xfont_metrics.C
src/frontends/xforms/xformsImage.C
src/frontends/xforms/xforms_helpers.C
src/frontends/xforms/xforms_resize.C
src/graphics/ChangeLog
src/graphics/GraphicsCache.C
src/graphics/GraphicsCacheItem.C
src/graphics/GraphicsConverter.C
src/graphics/GraphicsTypes.h
src/graphics/PreviewImage.C
src/graphics/PreviewLoader.C
src/graphics/PreviewedInset.C
src/graphics/Previews.C
src/importer.C
src/insets/ChangeLog
src/insets/ExternalTemplate.C
src/insets/inset.C
src/insets/inset.h
src/insets/insetbibitem.C
src/insets/insetbibtex.C
src/insets/insetcaption.C
src/insets/insetcite.C
src/insets/insetcollapsable.C
src/insets/insetert.C
src/insets/insetexternal.C
src/insets/insetfloat.C
src/insets/insetfloatlist.C
src/insets/insetgraphics.C
src/insets/insetgraphicsParams.C
src/insets/insetinclude.C
src/insets/insetlabel.C
src/insets/insetlatexaccent.C
src/insets/insetquotes.C
src/insets/insetref.C
src/insets/insettabular.C
src/insets/insettext.C
src/insets/inseturl.C
src/insets/mailinset.C
src/insets/renderers.C
src/insets/updatableinset.C
src/ispell.C
src/ispell.h
src/lastfiles.C
src/lyx_cb.C
src/lyx_main.C
src/lyxfind.C
src/lyxfont.C
src/lyxfunc.C
src/lyxlayout.C
src/lyxlex.C
src/lyxlex_pimpl.C
src/lyxrc.C
src/lyxserver.C
src/lyxtextclass.C
src/lyxtextclasslist.C
src/lyxvc.C
src/main.C
src/mathed/ChangeLog
src/mathed/formulabase.C
src/mathed/formulamacro.C
src/mathed/math_autocorrect.C
src/mathed/math_cursor.C
src/mathed/math_data.C
src/mathed/math_exfuncinset.C
src/mathed/math_extern.C
src/mathed/math_factory.C
src/mathed/math_fontinset.C
src/mathed/math_hullinset.C
src/mathed/math_iterator.C
src/mathed/math_pos.C
src/mathed/math_scriptinset.C
src/mathed/math_tabularinset.C
src/messages.C
src/paragraph.C
src/paragraph_funcs.C
src/paragraph_pimpl.C
src/pspell.C
src/rowpainter.C
src/support/ChangeLog
src/support/FileInfo.C
src/support/FileInfo.h
src/support/FileMonitor.C
src/support/FileMonitor.h
src/support/LAssert.C
src/support/LAssert.h
src/support/abort.C
src/support/atoi.C
src/support/chdir.C
src/support/copy.C
src/support/filetools.C
src/support/filetools.h
src/support/forkedcall.C
src/support/forkedcall.h
src/support/forkedcallqueue.C
src/support/forkedcallqueue.h
src/support/forkedcontr.C
src/support/forkedcontr.h
src/support/getcwd.C
src/support/kill.C
src/support/lstrings.C
src/support/lstrings.h
src/support/lyxlib.h
src/support/lyxstring.C
src/support/lyxstring.h
src/support/lyxsum.C
src/support/mkdir.C
src/support/os.h
src/support/os_unix.C
src/support/path.C
src/support/path.h
src/support/putenv.C
src/support/rename.C
src/support/rmdir.C
src/support/systemcall.C
src/support/systemcall.h
src/support/tempname.C
src/support/translator.h
src/support/unlink.C
src/support/userinfo.C
src/support/userinfo.h
src/tabular.C
src/tabular_funcs.C
src/text.C
src/text2.C
src/text3.C
src/trans.C
src/trans_mgr.C
src/undo_funcs.C
src/vc-backend.C
src/vspace.C

index a41113a9400603cfc93e3efd73c747c2991ddd8e..0ad23f88cbefa7ebf069d74200c3cdf6d4594960 100644 (file)
@@ -58,7 +58,7 @@ basic_format<Ch, Tr> ::basic_format(const string_t& s, const std::locale & loc)
 {
     oss_.imbue( loc );
     state0_.set_by_stream(oss_);
-    parse(s);  
+    parse(s);
 }
 #endif //BOOST_NO_STD_LOCALE
 
@@ -68,18 +68,18 @@ basic_format<Ch, Tr> ::basic_format(const string_t& s)
       items_(),  oss_(), exceptions_(io::all_error_bits)
 {
     state0_.set_by_stream(oss_);
-    parse(s);  
+    parse(s);
 }
 
 template< class Ch, class Tr>
 basic_format<Ch, Tr> :: basic_format(const basic_format& x)
-    : style_(x.style_), cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false), 
-      items_(x.items_), prefix_(x.prefix_), bound_(x.bound_), 
+    : style_(x.style_), cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(false),
+      items_(x.items_), prefix_(x.prefix_), bound_(x.bound_),
       oss_(),   // <- we obviously can't copy x.oss_
       state0_(x.state0_), exceptions_(x.exceptions_)
-{ 
+{
     state0_.apply_on(oss_);
-} 
+}
 
 template< class Ch, class Tr>
 basic_format<Ch, Tr>& basic_format<Ch, Tr> ::operator= (const basic_format& x)
@@ -94,8 +94,8 @@ basic_format<Ch, Tr>& basic_format<Ch, Tr> ::operator= (const basic_format& x)
     items_ = x.items_;
     prefix_ = x.prefix_;
     bound_=x.bound_;
-    style_=x.style_; 
-    cur_arg_=x.cur_arg_; 
+    style_=x.style_;
+    cur_arg_=x.cur_arg_;
     num_args_=x.num_args_;
     dumped_=x.dumped_;
     return *this;
@@ -103,17 +103,17 @@ basic_format<Ch, Tr>& basic_format<Ch, Tr> ::operator= (const basic_format& x)
 
 
 template< class Ch, class Tr>
-unsigned char basic_format<Ch,Tr> ::exceptions() const 
+unsigned char basic_format<Ch,Tr> ::exceptions() const
 {
-  return exceptions_; 
+  return exceptions_;
 }
 
 template< class Ch, class Tr>
-unsigned char basic_format<Ch,Tr> ::exceptions(unsigned char newexcept) 
-{ 
-  unsigned char swp = exceptions_; 
-  exceptions_ = newexcept; 
-  return swp; 
+unsigned char basic_format<Ch,Tr> ::exceptions(unsigned char newexcept)
+{
+  unsigned char swp = exceptions_;
+  exceptions_ = newexcept;
+  return swp;
 }
 
 
@@ -139,7 +139,7 @@ basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear()
 }
 
 template< class Ch, class Tr>
-basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_binds() 
+basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_binds()
   // cancel all bindings, and clear()
 {
     bound_.resize(0);
@@ -148,10 +148,10 @@ basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_binds()
 }
 
 template< class Ch, class Tr>
-basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_bind(int argN) 
+basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_bind(int argN)
   // cancel the binding of ONE argument, and clear()
 {
-    if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] ) 
+    if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] )
       {
         if( exceptions() & io::out_of_range_bit )
           boost::throw_exception(io::out_of_range()); // arg not in range.
@@ -176,18 +176,18 @@ std::basic_string<Ch,Tr> basic_format<Ch,Tr> ::str() const
 
   unsigned long sz = prefix_.size();
   unsigned long i;
-  for(i=0; i < items_.size(); ++i) 
+  for(i=0; i < items_.size(); ++i)
     sz += items_[i].res_.size() + items_[i].appendix_.size();
   string_t res;
   res.reserve(sz);
 
   res += prefix_;
-  for(i=0; i < items_.size(); ++i) 
+  for(i=0; i < items_.size(); ++i)
   {
     const format_item_t& item = items_[i];
     res += item.res_;
-    if( item.argN_ == format_item_t::argN_tabulation) 
-    { 
+    if( item.argN_ == format_item_t::argN_tabulation)
+    {
       BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation);
       std::streamsize  n = item.state_.width_ - res.size();
       if( n > 0 )
@@ -201,33 +201,33 @@ std::basic_string<Ch,Tr> basic_format<Ch,Tr> ::str() const
 namespace io {
 namespace detail {
 
-template<class Ch, class Tr, class T> 
-basic_format<Ch, Tr>&  bind_arg_body( basic_format<Ch, Tr>& self, 
-                                      int argN, 
+template<class Ch, class Tr, class T>
+basic_format<Ch, Tr>&  bind_arg_body( basic_format<Ch, Tr>& self,
+                                      int argN,
                                       const T& val)
   // bind one argument to a fixed value
   // this is persistent over clear() calls, thus also over str() and <<
 {
     if(self.dumped_) self.clear(); // needed, because we will modify cur_arg_..
-    if(argN<1 || argN > self.num_args_) 
+    if(argN<1 || argN > self.num_args_)
       {
         if( self.exceptions() & io::out_of_range_bit )
           boost::throw_exception(io::out_of_range()); // arg not in range.
         else return self;
       }
-    if(self.bound_.size()==0) 
+    if(self.bound_.size()==0)
       self.bound_.assign(self.num_args_,false);
-    else 
+    else
       BOOST_ASSERT( self.num_args_ == static_cast<signed int>(self.bound_.size()) );
     int o_cur_arg = self.cur_arg_;
     self.cur_arg_ = argN-1; // arrays begin at 0
 
     self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets..
     self.operator%(val); // put val at the right place, because cur_arg is set
-    
+
 
     // Now re-position cur_arg before leaving :
-    self.cur_arg_ = o_cur_arg; 
+    self.cur_arg_ = o_cur_arg;
     self.bound_[argN-1]=true;
     if(self.cur_arg_ == argN-1 )
       // hum, now this arg is bound, so move to next free arg
@@ -239,16 +239,16 @@ basic_format<Ch, Tr>&  bind_arg_body( basic_format<Ch, Tr>& self,
     return self;
 }
 
-template<class Ch, class Tr, class T> 
+template<class Ch, class Tr, class T>
 basic_format<Ch, Tr>&  modify_item_body( basic_format<Ch, Tr>& self,
-                                      int itemN, 
+                                      int itemN,
                                       const T& manipulator)
   // applies a manipulator to the format_item describing a given directive.
   // this is a permanent change, clear or clear_binds won't cancel that.
 {
-  if(itemN<1 || itemN >= static_cast<signed int>(self.items_.size() )) 
+  if(itemN<1 || itemN >= static_cast<signed int>(self.items_.size() ))
     {
-      if( self.exceptions() & io::out_of_range_bit ) 
+      if( self.exceptions() & io::out_of_range_bit )
         boost::throw_exception(io::out_of_range()); // item not in range.
       else return self;
     }
index 1e8bd904c38ccc427ba7c688301fa311f57a677d..d745bb9af2a351f59f59b826a4aee230fd6e3815 100644 (file)
@@ -32,21 +32,21 @@ namespace io {
 namespace detail {
 
   template<class Ch, class Stream> inline
-  bool wrap_isdigit(Ch c, Stream &os) 
+  bool wrap_isdigit(Ch c, Stream &os)
   {
 #ifndef BOOST_NO_LOCALE_ISIDIGIT
     return std::isdigit(c, os.rdbuf()->getloc() );
 # else
     using namespace std;
-    return isdigit(c); 
-#endif 
+    return isdigit(c);
+#endif
   } //end- wrap_isdigit(..)
 
   template<class Res, class Ch, class Tr> inline
-  Res str2int(const std::basic_string<Ch, Tr>& s, 
-              typename std::basic_string<Ch, Tr>::size_type start, 
+  Res str2int(const std::basic_string<Ch, Tr>& s,
+              typename std::basic_string<Ch, Tr>::size_type start,
               BOOST_IO_STD basic_ios<Ch,Tr> &os,
-              const Res = Res(0)  ) 
+              const Res = Res(0)  )
     // Input : char string, with starting index
     //         a basic_ios& merely to call its widen/narrow member function in the desired locale.
     // Effects : reads s[start:] and converts digits into an integral n, of type Res
@@ -64,7 +64,7 @@ namespace detail {
   }
 
   template<class Ch, class Tr>
-  void skip_asterisk(const std::basic_string<Ch,Tr> & buf, 
+  void skip_asterisk(const std::basic_string<Ch,Tr> & buf,
                      typename std::basic_string<Ch,Tr>::size_type * pos_p,
                      BOOST_IO_STD basic_ios<Ch, Tr> &os)
     // skip printf's "asterisk-fields" directives in the format-string buf
@@ -92,7 +92,7 @@ namespace detail {
     if(exceptions & io::bad_format_string_bit)
           boost::throw_exception(io::bad_format_string());
   }
-    
+
 
 
   template<class Ch, class Tr>
@@ -104,15 +104,15 @@ namespace detail {
     // Input   : a 'printf-directive' in the format-string, starting at buf[ *pos_p ]
     //           a basic_ios& merely to call its widen/narrow member function in the desired locale.
     //           a bitset'excpetions' telling whether to throw exceptions on errors.
-    // Returns : true if parse somehow succeeded (possibly ignoring errors if exceptions disabled) 
+    // Returns : true if parse somehow succeeded (possibly ignoring errors if exceptions disabled)
     //           false if it failed so bad that the directive should be printed verbatim
     // Effects : - *pos_p is incremented so that buf[*pos_p] is the first char after the directive
     //           - *fpar is set with the parameters read in the directive
   {
     typedef format_item<Ch, Tr>  format_item_t;
     BOOST_ASSERT( pos_p != 0);
-    typename std::basic_string<Ch, Tr>::size_type       &i1 = *pos_p,      
-                                                        i0; 
+    typename std::basic_string<Ch, Tr>::size_type       &i1 = *pos_p,
+                                                        i0;
     fpar->argN_ = format_item_t::argN_no_posit;  // if no positional-directive
 
     bool in_brackets=false;
@@ -126,38 +126,38 @@ namespace detail {
       }
 
     // the flag '0' would be picked as a digit for argument order, but here it's a flag :
-    if(buf[i1]==os.widen('0')) 
+    if(buf[i1]==os.widen('0'))
       goto parse_flags;
 
     // handle argument order (%2$d)  or possibly width specification: %2d
     i0 = i1;  // save position before digits
     while (i1 < buf.size() && wrap_isdigit(buf[i1], os))
       ++i1;
-    if (i1!=i0) 
+    if (i1!=i0)
       {
         if( i1 >= buf.size() ) {
           maybe_throw_exception(exceptions);
           return false;
         }
         int n=str2int(buf,i0, os, int(0) );
-        
+
         // %N% case : this is already the end of the directive
-        if( buf[i1] == os.widen('%') ) 
+        if( buf[i1] == os.widen('%') )
           {
             fpar->argN_ = n-1;
             ++i1;
-            if( in_brackets) 
-              maybe_throw_exception(exceptions); 
+            if( in_brackets)
+              maybe_throw_exception(exceptions);
               // but don't return.  maybe "%" was used in lieu of '$', so we go on.
             else return true;
           }
 
-        if ( buf[i1]==os.widen('$') ) 
+        if ( buf[i1]==os.widen('$') )
           {
             fpar->argN_ = n-1;
             ++i1;
-          } 
-        else  
+          }
+        else
           {
             // non-positionnal directive
             fpar->ref_state_.width_ = n;
@@ -165,13 +165,13 @@ namespace detail {
             goto parse_precision;
           }
       }
-    
-  parse_flags: 
+
+  parse_flags:
     // handle flags
     while ( i1 <buf.size()) // as long as char is one of + - = # 0 l h   or ' '
-      {  
+      {
         // misc switches
-        switch (os.narrow(buf[i1], 0)) 
+        switch (os.narrow(buf[i1], 0))
           {
           case '\'' : break; // no effect yet. (painful to implement)
           case 'l':
@@ -190,7 +190,7 @@ namespace detail {
             fpar->ref_state_.flags_ |= std::ios_base::showpos;
             break;
           case '0':
-            fpar->pad_scheme_ |= format_item_t::zeropad; 
+            fpar->pad_scheme_ |= format_item_t::zeropad;
             // need to know alignment before really setting flags,
             // so just add 'zeropad' flag for now, it will be processed later.
             break;
@@ -204,7 +204,7 @@ namespace detail {
       } // loop on flag.
     if( i1>=buf.size()) {
       maybe_throw_exception(exceptions);
-      return true; 
+      return true;
     }
 
   parse_width:
@@ -213,17 +213,17 @@ namespace detail {
     i0 = i1;  // save position before digits
     while (i1<buf.size() && wrap_isdigit(buf[i1], os))
       i1++;
-    
-    if (i1!=i0) 
+
+    if (i1!=i0)
       { fpar->ref_state_.width_ = str2int( buf,i0, os, std::streamsize(0) ); }
 
   parse_precision:
-    if( i1>=buf.size()) { 
+    if( i1>=buf.size()) {
       maybe_throw_exception(exceptions);
       return true;
     }
     // handle precision spec
-    if (buf[i1]==os.widen('.'))  
+    if (buf[i1]==os.widen('.'))
       {
         ++i1;
         skip_asterisk(buf, &i1, os);
@@ -233,25 +233,25 @@ namespace detail {
 
         if(i1==i0)
           fpar->ref_state_.precision_ = 0;
-        else 
+        else
           fpar->ref_state_.precision_ = str2int(buf,i0, os, std::streamsize(0) );
       }
-    
+
     // handle  formatting-type flags :
-    while( i1<buf.size() && 
+    while( i1<buf.size() &&
            ( buf[i1]==os.widen('l') || buf[i1]==os.widen('L') || buf[i1]==os.widen('h')) )
       ++i1;
     if( i1>=buf.size()) {
       maybe_throw_exception(exceptions);
       return true;
     }
-    
-    if( in_brackets && buf[i1]==os.widen('|') ) 
+
+    if( in_brackets && buf[i1]==os.widen('|') )
       {
         ++i1;
         return true;
       }
-    switch (os.narrow(buf[i1], 0) )  
+    switch (os.narrow(buf[i1], 0) )
       {
       case 'X':
         fpar->ref_state_.flags_ |= std::ios_base::uppercase;
@@ -260,7 +260,7 @@ namespace detail {
         fpar->ref_state_.flags_ &= ~std::ios_base::basefield;
         fpar->ref_state_.flags_ |= std::ios_base::hex;
         break;
-      
+
       case 'o':
         fpar->ref_state_.flags_ &= ~std::ios_base::basefield;
         fpar->ref_state_.flags_ |=  std::ios_base::oct;
@@ -275,7 +275,7 @@ namespace detail {
         fpar->ref_state_.flags_ &= ~std::ios_base::basefield;
         fpar->ref_state_.flags_ |=  std::ios_base::dec;
         break;
-      
+
       case 'f':
         fpar->ref_state_.flags_ &= ~std::ios_base::floatfield;
         fpar->ref_state_.flags_ |=  std::ios_base::fixed;
@@ -293,12 +293,12 @@ namespace detail {
         else
           fpar->ref_state_.fill_ = buf[i1];
         fpar->pad_scheme_ |= format_item_t::tabulation;
-        fpar->argN_ = format_item_t::argN_tabulation; 
+        fpar->argN_ = format_item_t::argN_tabulation;
         break;
-      case 't': 
+      case 't':
         fpar->ref_state_.fill_ = os.widen(' ');
         fpar->pad_scheme_ |= format_item_t::tabulation;
-        fpar->argN_ = format_item_t::argN_tabulation; 
+        fpar->argN_ = format_item_t::argN_tabulation;
         break;
 
       case 'G':
@@ -309,29 +309,29 @@ namespace detail {
         fpar->ref_state_.flags_ |=  std::ios_base::dec;
 
         // CLEAR all floatield flags, so stream will CHOOSE
-        fpar->ref_state_.flags_ &= ~std::ios_base::floatfield; 
+        fpar->ref_state_.flags_ &= ~std::ios_base::floatfield;
         break;
 
       case 'C':
-      case 'c': 
+      case 'c':
         fpar->truncate_ = 1;
         break;
       case 'S':
-      case 's': 
+      case 's':
         fpar->truncate_ = fpar->ref_state_.precision_;
         fpar->ref_state_.precision_ = -1;
         break;
-      case 'n' :  
+      case 'n' :
         fpar->argN_ = format_item_t::argN_ignored;
         break;
-      default: 
+      default:
         maybe_throw_exception(exceptions);
       }
     ++i1;
 
     if( in_brackets )
       {
-        if( i1<buf.size() && buf[i1]==os.widen('|') ) 
+        if( i1<buf.size() && buf[i1]==os.widen('|') )
           {
             ++i1;
             return true;
@@ -349,19 +349,19 @@ namespace detail {
 //  format :: parse(..)
 
 template<class Ch, class Traits>
-void basic_format<Ch, Traits> ::parse(const string_t & buf) 
+void basic_format<Ch, Traits> ::parse(const string_t & buf)
   // parse the format-string
 {
     using namespace std;
     const Ch arg_mark = oss_.widen('%');
-    bool ordered_args=true; 
+    bool ordered_args=true;
     int max_argN=-1;
     typename string_t::size_type i1=0;
     int num_items=0;
-    
+
     // A: find upper_bound on num_items and allocates arrays
-    i1=0; 
-    while( (i1=buf.find(arg_mark,i1)) != string::npos ) 
+    i1=0;
+    while( (i1=buf.find(arg_mark,i1)) != string_t::npos )
     {
       if( i1+1 >= buf.size() ) {
         if(exceptions() & io::bad_format_string_bit)
@@ -370,7 +370,7 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
       }
       if(buf[i1+1] == buf[i1] ) { i1+=2; continue; } // escaped "%%" / "##"
       ++i1;
-      
+
       // in case of %N% directives, dont count it double (wastes allocations..) :
       while(i1 < buf.size() && io::detail::wrap_isdigit(buf[i1],oss_)) ++i1;
       if( i1 < buf.size() && buf[i1] == arg_mark ) ++ i1;
@@ -378,28 +378,28 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
       ++num_items;
     }
     items_.assign( num_items, format_item_t() );
-    
+
     // B: Now the real parsing of the format string :
     num_items=0;
     i1 = 0;
     typename string_t::size_type i0 = i1;
     bool special_things=false;
     int cur_it=0;
-    while( (i1=buf.find(arg_mark,i1)) != string::npos ) 
+    while( (i1=buf.find(arg_mark,i1)) != string_t::npos )
     {
       string_t & piece = (cur_it==0) ? prefix_ : items_[cur_it-1].appendix_;
 
       if( buf[i1+1] == buf[i1] ) // escaped mark, '%%'
       {
-        piece += buf.substr(i0, i1-i0) + buf[i1]; 
+        piece += buf.substr(i0, i1-i0) + buf[i1];
         i1+=2; i0=i1;
-        continue; 
+        continue;
       }
       BOOST_ASSERT(  static_cast<unsigned int>(cur_it) < items_.size() || cur_it==0);
 
       if(i1!=i0) piece += buf.substr(i0, i1-i0);
       ++i1;
-      
+
       bool parse_ok;
       parse_ok = io::detail::parse_printf_directive(buf, &i1, &items_[cur_it], oss_, exceptions());
       if( ! parse_ok ) continue; // the directive will be printed verbatim
@@ -418,12 +418,12 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
       ++cur_it;
     } // loop on %'s
     BOOST_ASSERT(cur_it == num_items);
-    
+
     // store the final piece of string
     string_t & piece = (cur_it==0) ? prefix_ : items_[cur_it-1].appendix_;
     piece += buf.substr(i0);
-    
-    if( !ordered_args) 
+
+    if( !ordered_args)
     {
       if(max_argN >= 0 )  // dont mix positional with non-positionnal directives
         {
@@ -434,14 +434,14 @@ void basic_format<Ch, Traits> ::parse(const string_t & buf)
       // set things like it would have been with positional directives :
       int non_ordered_items = 0;
       for(int i=0; i< num_items; ++i)
-        if(items_[i].argN_ == format_item_t::argN_no_posit) 
+        if(items_[i].argN_ == format_item_t::argN_no_posit)
           {
             items_[i].argN_ = non_ordered_items;
             ++non_ordered_items;
           }
       max_argN = non_ordered_items-1;
     }
-    
+
     // C: set some member data :
     items_.resize(num_items);
 
index 697d85cc2b9d074d586ce75f5d599c88ff228592..5f34fa5885a692ce0df9df8c0f44399295a840be 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright 1995-2002 the LyX Team
  * Read the file COPYING
  *
- * \author unknown
+ * \author Lars Gullik Bjønnes
  * \author John Levon <moz@compsoc.man.ac.uk>
  */
 
@@ -49,6 +49,7 @@
 extern BufferList bufferlist;
 
 using lyx::pos_type;
+using namespace lyx::support;
 
 using std::pair;
 using std::endl;
index 59c7df3c5a7f42f13d868b0832d22c2ece3ea5df..9088f5c681f236a03e43f726106beb93304d1569 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright 2002 the LyX Team
  * Read the file COPYING
  *
+ * \author Lars Gullik Bjønnes
  * \author various
  */
 
@@ -75,6 +76,7 @@ using std::make_pair;
 using std::min;
 
 using lyx::pos_type;
+using namespace lyx::support;
 using namespace bv_funcs;
 
 extern BufferList bufferlist;
@@ -168,7 +170,7 @@ bool BufferView::Pimpl::loadLyXFile(string const & filename, bool tolastfiles)
        Buffer * b = bufferlist.newBuffer(s);
 
        //attach to the error signal in the buffer
-       b->parseError.connect(boost::bind(&BufferView::Pimpl::addError, 
+       b->parseError.connect(boost::bind(&BufferView::Pimpl::addError,
                                          this, _1));
 
        bool loaded = ::loadLyXFile(b, s);
@@ -187,7 +189,7 @@ bool BufferView::Pimpl::loadLyXFile(string const & filename, bool tolastfiles)
                else
                        return false;
 
-       } 
+       }
 
        buffer(b);
 
@@ -358,7 +360,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                mark_set = bv_->text->selection.mark();
                the_locking_inset = bv_->theLockingInset();
                buffer_->resizeInsets(bv_);
-               // I don't think the delete and new are necessary here we 
+               // I don't think the delete and new are necessary here we
                // just could call only init! (Jug 20020419)
                delete bv_->text;
                bv_->text = new LyXText(bv_);
@@ -720,7 +722,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
                        b = bufferlist.newBuffer(fname);
                        ::loadLyXFile(b, fname); // don't ask, just load it
                }
-               if (b != 0) 
+               if (b != 0)
                        buffer(b);
        }
 
index 3d66257cbdac24935febc24b63bbf5243a12d41f..8493c0bd34ed7195409c07eedc7c98e420a94283 100644 (file)
@@ -17,6 +17,8 @@
 #include "Bullet.h"
 #include "support/LAssert.h"
 
+using namespace lyx::support;
+
 /** The four LaTeX itemize environment default bullets
  */
 extern
@@ -365,17 +367,17 @@ string const Bullet::bulletEntry(int f, int c)
 
 #ifdef ENABLE_ASSERTIONS
 void Bullet::testInvariant() const {
-       lyx::Assert(font >= MIN);
-       lyx::Assert(font < FONTMAX);
-       lyx::Assert(character >= MIN);
-       lyx::Assert(character < CHARMAX);
-       lyx::Assert(size >= MIN);
-       lyx::Assert(size < SIZEMAX);
-       lyx::Assert(user_text >= -1);
-       lyx::Assert(user_text <= 1);
+       Assert(font >= MIN);
+       Assert(font < FONTMAX);
+       Assert(character >= MIN);
+       Assert(character < CHARMAX);
+       Assert(size >= MIN);
+       Assert(size < SIZEMAX);
+       Assert(user_text >= -1);
+       Assert(user_text <= 1);
        // now some relational/operational tests
        if (user_text == 1) {
-               lyx::Assert(font == -1 && (character == -1 && size == -1));
+               Assert(font == -1 && (character == -1 && size == -1));
                //        Assert(!text.empty()); // this isn't necessarily an error
        }
        //      else if (user_text == -1) {
index b92d163eaeb7809cee2e7fe4eff3d4289c9330fb..82bc7260709e0d3b7c2673944a70bf19a4087925 100644 (file)
@@ -1,3 +1,6 @@
+2003-07-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * introduce namespace lyx::support
 
 2003-06-30  André Pönitz  <poenitz@gmx.net>
 
index 7b728fc9d4ec1262623be06311501e21559c0abb..d3950f7595c04d6d4c36eb27f6710aca2d76132f 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <fstream>
 
+using namespace lyx::support;
+
 using std::ifstream;
 using std::getline;
 
@@ -80,7 +82,7 @@ int Chktex::scanLogFile(TeXErrors & terr)
                token = split(token, warno, ':');
                token = split(token, warning, ':');
 
-               int const lineno = lyx::atoi(line);
+               int const lineno = atoi(line);
 
 #if USE_BOOST_FORMAT
                msg % warno;
index 54ae59110bd5089a809690c9e2c16ca81bd908f8..cf6ba8e8ff21501b1f79bdfb35c1c7aaf52d2c2b 100644 (file)
@@ -38,6 +38,7 @@ using std::make_pair;
 using std::for_each;
 using std::vector;
 
+using namespace lyx::support;
 using lyx::pos_type;
 using lyx::textclass_type;
 
@@ -180,11 +181,11 @@ bool CutAndPaste::copySelection(ParagraphList::iterator startpit,
                                ParagraphList::iterator endpit,
                                int start, int end, textclass_type tc)
 {
-       lyx::Assert(&*startpit);
-       lyx::Assert(&*endpit);
-       lyx::Assert(0 <= start && start <= startpit->size());
-       lyx::Assert(0 <= end && end <= endpit->size());
-       lyx::Assert(startpit != endpit || start <= end);
+       Assert(&*startpit);
+       Assert(&*endpit);
+       Assert(0 <= start && start <= startpit->size());
+       Assert(0 <= end && end <= endpit->size());
+       Assert(startpit != endpit || start <= end);
 
        ParagraphList paragraphs;
 
@@ -229,7 +230,7 @@ CutAndPaste::pasteSelection(Buffer const & buffer,
        if (!checkPastePossible())
                return make_pair(PitPosPair(pit, pos), pit);
 
-       lyx::Assert (pos <= pit->size());
+       Assert (pos <= pit->size());
 
        // Make a copy of the CaP paragraphs.
        ParagraphList simple_cut_clone = cuts[cut_index].first;
@@ -384,7 +385,7 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
                                             ParagraphList & pars,
                                             ErrorList & errorlist)
 {
-       lyx::Assert(!pars.empty());
+       Assert(!pars.empty());
 
        int ret = 0;
        if (c1 == c2)
index a23c091660f58f9ffc9b4d8e0301743e6c2d4e51..90849bb0d770ca7e2e5687a8abadcda0eab15609 100644 (file)
@@ -33,6 +33,8 @@
 using std::time;
 #endif
 
+using namespace lyx::support;
+
 using std::make_pair;
 using std::ofstream;
 using std::ifstream;
@@ -57,7 +59,7 @@ void DepTable::insert(string const & fi, bool upd)
                di.crc_prev = 0;
                if (upd) {
                        lyxerr[Debug::DEPEND] << " CRC..." << flush;
-                       di.crc_cur = lyx::sum(f);
+                       di.crc_cur = sum(f);
                        lyxerr[Debug::DEPEND] << "done." << endl;
                        struct stat f_info;
                        stat(fi.c_str(), &f_info);
@@ -90,7 +92,7 @@ void DepTable::update()
                        } else {
                                di.crc_prev = di.crc_cur;
                                lyxerr[Debug::DEPEND] << itr->first << " CRC... ";
-                               di.crc_cur = lyx::sum(itr->first);
+                               di.crc_cur = sum(itr->first);
                                lyxerr[Debug::DEPEND] << "done";
                        }
                } else {
index aa81477110d1fca4b415b4af3191330116ef227b..836f7744c6d70e390aa40dfc68b9006aa9398a1d 100644 (file)
@@ -17,6 +17,8 @@
 
 #include <map>
 
+using namespace lyx::support;
+
 using std::endl;
 
 
@@ -198,7 +200,7 @@ void LColor::setColor(LColor::color col, string const & x11name)
                return;
        }
        lyxerr << "LyX internal error: color and such.\n";
-       lyx::Assert(false);
+       Assert(false);
 }
 
 
index 1e135594b319e992bc4e2ab19cd3ba86af47d77e..95d20bdae05df9e7b85d90f1364e6844e0abac1d 100644 (file)
@@ -31,8 +31,7 @@ using std::string;
 #define __STRING__
 #endif
 #include "support/lyxstring.h"
-// using lyx::string;
-typedef lyxstring string;
+using lyx::string;
 #define STRCONV(STR) STR.c_str()
 #endif
 
index 53cf4e9241b19993ac8c5b8257ca291aaf4f16fa..d069babb2a40409882f8c8a7f3dc4aa890643a00 100644 (file)
@@ -33,6 +33,8 @@
 #include <fstream>
 #include <cstdio>  // sscanf
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::sscanf;
 #endif
@@ -129,7 +131,7 @@ void LaTeX::deleteFilesOnError() const
        // What files do we have to delete?
 
        // This will at least make latex do all the runs
-       lyx::unlink(depfile);
+       unlink(depfile);
 
        // but the reason for the error might be in a generated file...
 
@@ -137,15 +139,15 @@ void LaTeX::deleteFilesOnError() const
 
        // bibtex file
        string const bbl = ChangeExtension(ofname, ".bbl");
-       lyx::unlink(bbl);
+       unlink(bbl);
 
        // makeindex file
        string const ind = ChangeExtension(ofname, ".ind");
-       lyx::unlink(ind);
+       unlink(ind);
 
        // Also remove the aux file
        string const aux = ChangeExtension(ofname, ".aux");
-       lyx::unlink(aux);
+       unlink(aux);
 }
 
 
@@ -164,7 +166,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
        bool rerun = false; // rerun requested
 
        // The class LaTeX does not know the temp path.
-       bufferlist.updateIncludedTeXfiles(lyx::getcwd(), runparams);
+       bufferlist.updateIncludedTeXfiles(getcwd(), runparams);
 
        // Never write the depfile if an error was encountered.
 
index a8754d033f02cfef0537b6d6f57d461e13538b23..5380932443a7eb72ba229aa3c208eed49ee40e90 100644 (file)
@@ -24,6 +24,8 @@
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using lyx::textclass_type;
 
 using std::endl;
index 09e7c7c85b82bd4099ea062d3be2e938d47a4da6..89c883ed2691a5978e8739c85626ef62d41ea8f1 100644 (file)
@@ -12,6 +12,8 @@
 #include "gettext.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 using std::pair;
index 3ce73b3636b7e20b8c8c2ab615200c2ee398a7bc..9eb756c7f8527726690294299aa85fa1cf8cea57 100644 (file)
@@ -40,6 +40,8 @@
 extern BufferList bufferlist;
 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
 
+using namespace lyx::support;
+
 using std::endl;
 using std::vector;
 using std::max;
@@ -619,10 +621,10 @@ void expandPasteRecent(Menu & tomenu, LyXView const * view)
 {
        vector<string> const selL =
                CutAndPaste::availableSelections(*view->buffer());
-       
+
        vector<string>::const_iterator cit = selL.begin();
        vector<string>::const_iterator end = selL.end();
-       
+
        for (unsigned int index = 0; cit != end; ++cit, ++index) {
                int const action = lyxaction.getPseudoAction(LFUN_PASTE,
                                                             tostr(index));
@@ -780,7 +782,7 @@ Menu const & MenuBackend::getMenu(string const & name) const
                                     lyx::compare_memfun(&Menu::name, name));
        if (cit == end())
                lyxerr << "No submenu named " << name << endl;
-       lyx::Assert(cit != end());
+       Assert(cit != end());
        return (*cit);
 }
 
@@ -790,7 +792,7 @@ Menu & MenuBackend::getMenu(string const & name)
        MenuList::iterator it =
                find_if(menulist_.begin(), menulist_.end(),
                        lyx::compare_memfun(&Menu::name, name));
-       lyx::Assert(it != menulist_.end());
+       Assert(it != menulist_.end());
        return (*it);
 }
 
index 2e95e9f56418dfaf8b4f8c2915be04e45ffa0f44..958e3b1f416c8a2669721dae940728cd0cc86a17 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <iostream>
 
+using namespace lyx::support;
+
 using std::ostream;
 
 // Initialize static member var.
index 06dd555d15db2d4c9f808b7711414b60e90a89ab..aa6d499664e0b3d7f4159961263673592ce73a1e 100644 (file)
@@ -87,13 +87,13 @@ struct PrinterParams {
 #ifdef ENABLE_ASSERTIONS
                        switch (target) {
                        case PRINTER:
-                               //Assert(!printer_name.empty());
+                               //lyx::support::Assert(!printer_name.empty());
                                break;
                        case FILE:
-                               lyx::Assert(!file_name.empty());
+                               lyx::support::Assert(!file_name.empty());
                                break;
                        default:
-                               lyx::Assert(false);
+                               lyx::support::Assert(false);
                                break;
                        }
 #endif
index 69cddfe234f567c4b80ad17af7371d744c8678f8..e4d4232bdeb44470a9c2a7331dae05e6b765ecd3 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <vector>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::vector;
 using std::make_pair;
@@ -236,9 +238,9 @@ string const ToolbarBackend::getIcon(int action)
                                   << fullname << '\'' << endl;
                return fullname;
        }
-       
-       lyxerr[Debug::GUI] << "Cannot find icon for command \"" 
-                          << lyxaction.getActionName(f.action) 
+
+       lyxerr[Debug::GUI] << "Cannot find icon for command \""
+                          << lyxaction.getActionName(f.action)
                           << ' ' << f.argument << '"' << endl;
        return LibFileSearch("images", "unknown", "xpm");
 }
index 45b36b4f150e37c64e7657946c1ee06157346c8c..9901659948df65fb4d57befb3a1298c6ea589dcf 100644 (file)
@@ -17,6 +17,8 @@
 #include "support/LIstream.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 bool operator==(Author const & l, Author const & r)
 {
        return l.name() == r.name() && l.email() == r.email();
@@ -62,7 +64,7 @@ int AuthorList::record(Author const & a)
 
 void AuthorList::record(int id, Author const & a)
 {
-       lyx::Assert(unsigned(id) < authors_.size());
+       Assert(unsigned(id) < authors_.size());
 
        authors_[id] = a;
 }
@@ -71,7 +73,7 @@ void AuthorList::record(int id, Author const & a)
 Author const & AuthorList::get(int id)
 {
        Authors::const_iterator it(authors_.find(id));
-       lyx::Assert(it != authors_.end());
+       Assert(it != authors_.end());
        return it->second;
 }
 
index ef997c801c836d25164aa05902e2bc79ae83df0d..74c200bdbfb0679ac8acfc20f08add0ce7b670b7 100644 (file)
@@ -5,6 +5,8 @@
 
 #include <exception>
 
+using namespace lyx::support;
+
 using std::endl;
 
 namespace boost {
@@ -13,7 +15,7 @@ void throw_exception(std::exception const & e)
 {
        lyxerr << "Exception caught:\n"
            << e.what() << endl;
-       lyx::Assert(false);
+       Assert(false);
 }
 
 
index 15d21658e15084f79459176926c66656725d7374..b51a4762d4dca385f285934cf225c262d53a1818 100644 (file)
@@ -86,6 +86,8 @@
 #include <locale>
 #endif
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::pow;
 #endif
@@ -543,7 +545,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename,
                        // This code is reached if lyx2lyx failed (for
                        // some reason) to change the file format of
                        // the file.
-                       lyx::Assert(false);
+                       Assert(false);
                        return false;
                }
        }
@@ -627,7 +629,7 @@ bool Buffer::save() const
        } else {
                // Saving failed, so backup is not backup
                if (lyxrc.make_backup) {
-                       lyx::rename(s, fileName());
+                       rename(s, fileName());
                }
                return false;
        }
@@ -1647,7 +1649,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
                        sgmlparam = style->latexparam();
                        c_params = split(sgmlparam, c_depth,'|');
 
-                       cmd_depth = lyx::atoi(c_depth);
+                       cmd_depth = atoi(c_depth);
 
                        if (command_flag) {
                                if (cmd_depth < command_base) {
index 0eaca7c0dd7070f0834e218c729ca0d29f2f2c62..0f039eaa9f8eb0992e1955786c28fdd2f271d76b 100644 (file)
@@ -32,6 +32,8 @@
 
 extern BufferList bufferlist;
 
+using namespace lyx::support;
+
 
 namespace {
 
@@ -98,7 +100,7 @@ bool readFile(Buffer * b, string const & s)
                                        b->markDirty();
                                } else {
                                        // Here, we should delete the autosave
-                                       lyx::unlink(a);
+                                       unlink(a);
                                }
                        }
                }
@@ -126,8 +128,8 @@ bool loadLyXFile(Buffer * b, string const & s)
                        b->lyxvc.file_found_hook(s);
                        return true;
                }
-               break; 
-       case -1: 
+               break;
+       case -1:
                string const file = MakeDisplayPath(s, 20);
                // Here we probably should run
                if (LyXVC::file_not_found_hook(s)) {
@@ -150,7 +152,7 @@ bool loadLyXFile(Buffer * b, string const & s)
 }
 
 
-Buffer * newFile(string const & filename, string const & templatename, 
+Buffer * newFile(string const & filename, string const & templatename,
                 bool isNamed)
 {
        // get a free buffer
@@ -198,7 +200,7 @@ Buffer * newFile(string const & filename, string const & templatename,
 }
 
 
-void parseErrors(Buffer const & buf, TeXErrors const & terr) 
+void parseErrors(Buffer const & buf, TeXErrors const & terr)
 {
        TeXErrors::Errors::const_iterator cit = terr.begin();
        TeXErrors::Errors::const_iterator end = terr.end();
@@ -217,12 +219,12 @@ void parseErrors(Buffer const & buf, TeXErrors const & terr)
 }
 
 
-void parseErrors(Buffer const & buf, ErrorList const & el) 
+void parseErrors(Buffer const & buf, ErrorList const & el)
 {
        ErrorList::const_iterator it = el.begin();
        ErrorList::const_iterator end = el.end();
 
-       for (; it != end; ++it) 
+       for (; it != end; ++it)
                buf.parseError(*it);
 }
 
index 7d7b327b4e63cf95ffa742931b4ef7fcf752c482..0ae822582e6718860291c1a7cacf929b2be2685a 100644 (file)
@@ -41,6 +41,8 @@
 #include <functional>
 
 
+using namespace lyx::support;
+
 using std::vector;
 using std::find;
 using std::endl;
@@ -118,7 +120,7 @@ bool BufferList::quitWriteAll()
 
 void BufferList::release(Buffer * buf)
 {
-       lyx::Assert(buf);
+       Assert(buf);
        BufferStorage::iterator it = find(bstore.begin(), bstore.end(), buf);
        if (it != bstore.end()) {
                // Make sure that we don't store a LyXText in
@@ -157,7 +159,7 @@ void BufferList::closeAll()
 
 bool BufferList::close(Buffer * buf, bool ask)
 {
-       lyx::Assert(buf);
+       Assert(buf);
 
        // FIXME: is the quitting check still necessary ?
        if (!ask || buf->isClean() || quitting || buf->paragraphs.empty()) {
@@ -316,7 +318,7 @@ bool BufferList::exists(string const & s) const
 
 bool BufferList::isLoaded(Buffer const * b) const
 {
-       lyx::Assert(b);
+       Assert(b);
 
        BufferStorage::const_iterator cit =
                find(bstore.begin(), bstore.end(), b);
index 6ee643655c6b142e54129446612e5538fa1531d4..bf70b6a66d2ca086c405f39d027912e88d1b2813 100644 (file)
@@ -34,6 +34,8 @@
 #include <cstdlib>
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 using std::pair;
index c1747beb64a62663838deceaf77f480033af3f5f..a58c0c9e9c0ae1ade6684220676d0a50811c3444 100644 (file)
@@ -36,6 +36,8 @@
 
 #include "insets/updatableinset.h"
 
+using namespace lyx::support;
+
 
 namespace {
 
index c60357718b1ab17385541124168eec26bac65473..fe4b087680c46923394abe74a342e4e5b2b313a2 100644 (file)
@@ -17,6 +17,8 @@
 #include "support/LAssert.h"
 #include "support/LOstream.h"
 
+using namespace lyx::support;
+
 using std::vector;
 using std::endl;
 using lyx::pos_type;
@@ -325,7 +327,7 @@ Change const Changes::lookupFull(pos_type pos) const
        }
 
        check();
-       lyx::Assert(0);
+       Assert(false);
        return Change(Change::UNCHANGED);
 }
 
@@ -347,7 +349,7 @@ Change::Type Changes::lookup(pos_type pos) const
        }
 
        check();
-       lyx::Assert(0);
+       Assert(0);
        return Change::UNCHANGED;
 }
 
@@ -485,7 +487,7 @@ void Changes::check() const
        if (lyxerr.debugging(Debug::CHANGES))
                lyxerr[Debug::CHANGES] << "End" << endl;
 
-       lyx::Assert(dont_assert);
+       Assert(dont_assert);
 }
 
 
index 3b60e4ebd89699b02b2a5df3f39b40e44dc3d253..e8072d739e58be96f4d23f982f78c216b04db494 100644 (file)
@@ -9,6 +9,8 @@
 
 #include <fstream>
 
+using namespace lyx::support;
+
 using std::ifstream;
 using std::getline;
 using std::pair;
@@ -58,7 +60,7 @@ bool CharacterSet::loadFile(string const & fname)
                cmatch sub;
 #endif
                if (regex_match(STRCONV(line), sub, reg)) {
-                       int const n = lyx::atoi(STRCONV(sub.str(1)));
+                       int const n = atoi(STRCONV(sub.str(1)));
                        string const str = STRCONV(sub.str(2));
                        if (lyxerr.debugging(Debug::KBMAP))
                                lyxerr << "Chardef: " << n
index 5061d37218bfa03e3bf8b4510513c2ada8a7a0f3..a39664e385a89f353891ea65ad23cc3eb497f69e 100644 (file)
@@ -35,6 +35,8 @@
 
 #include <cctype>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::isdigit;
 #endif
@@ -344,7 +346,7 @@ bool Converters::convert(Buffer const * buffer,
                                res = one.startscript(type, command);
 
                        if (!real_outfile.empty()) {
-                               if (!lyx::rename(outfile, real_outfile))
+                               if (!rename(outfile, real_outfile))
                                        res = -1;
                                else
                                        lyxerr[Debug::FILES]
@@ -394,7 +396,7 @@ bool Converters::convert(Buffer const * buffer,
                                            token_base, from_base);
                        string to = subst(conv.result_dir,
                                          token_base, to_base);
-                       if (!lyx::rename(from, to)) {
+                       if (!rename(from, to)) {
                                Alert::error(_("Cannot convert file"),
                                        bformat(_("Could not move a temporary file from %1$s to %2$s."),
                                                from, to));
@@ -430,8 +432,8 @@ bool Converters::move(string const & from, string const & to, bool copy)
                        lyxerr[Debug::FILES] << "moving " << from2
                                             << " to " << to2 << endl;
                        bool const moved = (copy)
-                               ? lyx::copy(from2, to2)
-                               : lyx::rename(from2, to2);
+                               ? lyx::support::copy(from2, to2)
+                               : rename(from2, to2);
                        if (!moved && no_errors) {
                                Alert::error(_("Cannot convert file"),
                                        bformat(_("Could not move a temporary file from %1$s to %2$s."),
index 094dcd8bf7937e856de8730a8b1c33ab5186aaa9..a69b6a3c086e692148f6455af0ca56355fc70e68 100644 (file)
@@ -18,6 +18,8 @@
 #include "support/lstrings.h"
 #include "support/LAssert.h"
 
+using namespace lyx::support;
+
 using std::endl;
 using std::vector;
 
@@ -169,7 +171,7 @@ void Counters::reset()
 
 void Counters::reset(string const & match)
 {
-       lyx::Assert(!match.empty());
+       Assert(!match.empty());
 
        CounterList::iterator it = counterList.begin();
        CounterList::iterator end = counterList.end();
index 9c7e8c58d03676e81b2533fcf087bcb8691671e7..ab90e5e3c48d2d6cfbdf371d9175d19cae6a2b8f 100644 (file)
@@ -15,6 +15,8 @@
 
 #include <iomanip>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::setw;
 using std::endl;
index 49e59e194951a16fd7358f2829e612419475412a..ac661422b15b3076b083fc035d738722ded404ca 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::find;
 
@@ -157,4 +159,3 @@ Exporter::GetExportableFormats(Buffer const * buffer, bool only_viewable)
        }
        return result;
 }
-
index 44eb7c70f17d51a852ec60a7d5351cd4d28c04f3..7d908149c619828a524157f478100f750d8020c7 100644 (file)
@@ -54,6 +54,8 @@
 
 #include <cstdio>
 
+using namespace lyx::support;
+
 using std::endl;
 
 Inset * createInset(FuncRequest const & cmd)
index 73e037cc309cc0491e3cefdf2c0e3b6e2101f5e8..9404be7726d0a298714d01e2b15b53c49b947489 100644 (file)
@@ -26,6 +26,8 @@
 #include "support/systemcall.h"
 #include "support/lyxfunctional.h"
 
+using namespace lyx::support;
+
 
 namespace {
 
index fd25d66e65ed59836ea0580f27df36063d807dcf..4b00b244fe97370c77a7659088b86a12f712abe4 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <config.h>
 
-
 #include "LyXView.h"
 #include "debug.h"
 #include "intl.h"
@@ -40,6 +39,7 @@
 #include <sys/time.h>
 #include <unistd.h>
 
+using namespace lyx::support;
 using std::endl;
 
 string current_layout;
index 0cef024ee9acee35a24f804a3d6ecbd807755284..9d7052fe548e9ed7e6a353ae26b613e3c1e96734 100644 (file)
@@ -14,6 +14,8 @@
 #include "Timeout.h"
 #include "support/LAssert.h"
 
+using namespace lyx::support;
+
 
 Timeout::~Timeout()
 {
@@ -65,7 +67,7 @@ Timeout & Timeout::setType(Type t)
 Timeout & Timeout::setTimeout(unsigned int msec)
 {
        // Can't have a timeout of zero!
-       lyx::Assert(msec);
+       Assert(msec);
 
        timeout_ms = msec;
        return * this;
index 8d63bd3cb9149a3a3135115f2098ec84e2d65cb1..5a0f78583422a9b2b3f6968a2166d987348be79b 100644 (file)
 #include "support/LAssert.h"
 #include "debug.h"
 
+using namespace lyx::support;
 
 BCView & ButtonController::view() const
 {
-       lyx::Assert(view_.get());
+       Assert(view_.get());
        return *view_.get();
 }
 
@@ -30,7 +31,7 @@ void ButtonController::view(BCView * view)
 
 ButtonPolicy & ButtonController::bp() const
 {
-       lyx::Assert(bp_.get());
+       Assert(bp_.get());
        return *bp_.get();
 }
 
index ee0c3ee78f013a0113161dedba4254373b83a110..ccdcc247abfdd4743b7333516d26d380ea412ae5 100644 (file)
@@ -1,3 +1,7 @@
+2003-07-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * introduce namespace lyx::support
+
 2003-06-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * Kernel.h: fix some \class issues
index 1887f0f63a851cb9c199a38e7dd178d966ad35dc..4b456e47ab92d64409bfd7cb37a120ad10a6154e 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <fstream>
 
+using namespace lyx::support;
+
 using std::ostream;
 
 // needed for the browser
index 8e8f076cb9b7e11874cc8eea2fef731da018736c..36d67785723bf00c04247f162e05a45d53761df6 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "support/filetools.h"
 
+using namespace lyx::support;
+
 using std::pair;
 using std::vector;
 
index cf3745f1f3344553cd0c09e2639ac9e54f705351..505b45eb769d4cbb0dca3fd081f86aaa1aa593eb 100644 (file)
@@ -18,6 +18,7 @@
 #include "lyxrc.h"
 #include "support/LAssert.h"
 
+using namespace lyx::support;
 
 ControlButtons::ControlButtons()
        : emergency_exit_(false), is_closing_(false),
@@ -68,14 +69,14 @@ bool ControlButtons::IconifyWithMain() const
 
 ButtonController & ControlButtons::bc()
 {
-       lyx::Assert(bc_ptr_.get());
+       Assert(bc_ptr_.get());
        return *bc_ptr_.get();
 }
 
 
 ViewBase & ControlButtons::view()
 {
-       lyx::Assert(view_ptr_);
+       Assert(view_ptr_);
        return *view_ptr_;
 }
 
index 25348a8532b63cd5b55dee050606e5d4271b24c9..1d5053ff1df45966603143b7da72b44848c72313 100644 (file)
@@ -18,6 +18,7 @@
 #include "author.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
 
 ControlChanges::ControlChanges(Dialog & parent)
        : Dialog::Controller(parent)
index e3468234c0c588ff69593506b0af2932bc9ceba3..adb454122fa70775663c3311dfd56b4ec1b53c25 100644 (file)
@@ -21,6 +21,8 @@
 #include "support/lyxalgo.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::vector;
 using std::back_inserter;
 using std::transform;
index 29f11a19dd07e261ca451ecdadcb504fd63bc96d..0e603f65aa66212f21494bbba3952f4b1c953dcc 100644 (file)
@@ -34,6 +34,8 @@
 #include "support/lstrings.h"
 #include "support/filetools.h"
 
+using namespace lyx::support;
+
 using std::endl;
 
 
@@ -48,7 +50,7 @@ ControlDocument::~ControlDocument()
 
 BufferParams & ControlDocument::params()
 {
-       lyx::Assert(bp_.get());
+       Assert(bp_.get());
        return *bp_;
 }
 
index 287cdaed1bf8114342f5b26f2adca44e26d9c4ef..8874e85487920ac03d6923d454eef6b155feeb01 100644 (file)
@@ -24,6 +24,7 @@
 #include "support/LAssert.h"
 #include <vector>
 
+using namespace lyx::support;
 using std::vector;
 
 
@@ -55,21 +56,21 @@ void ControlExternal::dispatchParams()
 
 void ControlExternal::setParams(InsetExternal::Params const & p)
 {
-       lyx::Assert(params_.get());
+       Assert(params_.get());
        *params_ = p;
 }
 
 
 InsetExternal::Params const & ControlExternal::params() const
 {
-       lyx::Assert(params_.get());
+       Assert(params_.get());
        return *params_;
 }
 
 
 void ControlExternal::editExternal()
 {
-       lyx::Assert(params_.get());
+       Assert(params_.get());
 
        dialog().view().apply();
        string const lfun = InsetExternalMailer::params2string(params());
@@ -129,7 +130,7 @@ ExternalTemplate const * getTemplatePtr(InsetExternal::Params const & params)
                return 0;
        return &templ;
 }
+
 } // namespace anon
 
 
index 10052155ebf471ba46c979d371e8c6074cc64b64..6f71ddf8b7a8157c575174a5c6979048d16952a8 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <boost/bind.hpp>
 
+using namespace lyx::support;
+
 using std::vector;
 
 
index d94cad7090ffd220fc14349cedd8915ac0472b27..cd342c1ea6878ec5be9113a806439acddd5418d5 100644 (file)
@@ -32,6 +32,8 @@
 #include "support/filetools.h"
 #include "support/FileInfo.h"
 
+using namespace lyx::support;
+
 using std::pair;
 using std::make_pair;
 using std::vector;
index 98a8819b55e2ef1d10209024ce5030ccbc4e3a14..3f4af1cece46378c7054ae5d71fd93c57387e839 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <utility>
 
+using namespace lyx::support;
+
 using std::pair;
 
 
index 11bfdefbf28f0787ea36abe9df936db1096d9f55..98997ad1f489db1694e609e9ef51f969a914d2b1 100644 (file)
@@ -18,6 +18,7 @@
 #include "support/lstrings.h"
 #include "support/filetools.h"
 
+using namespace lyx::support;
 
 ControlMath::ControlMath(Dialog & dialog)
        : Dialog::Controller(dialog)
index 3caf7a194625c2f37e675781da96877762a85d16..ae9c3e9c85002ebc62ecaf73c3a9984768a88bd6 100644 (file)
@@ -20,6 +20,7 @@
 #include "support/LAssert.h"
 #include "Lsstream.h"
 
+using namespace lyx::support;
 
 ControlParagraph::ControlParagraph(Dialog & parent)
        : Dialog::Controller(parent), ininset_(false)
@@ -125,14 +126,14 @@ void ControlParagraph::dispatchParams()
 
 ParagraphParameters & ControlParagraph::params()
 {
-       lyx::Assert(params_.get());
+       Assert(params_.get());
        return *params_;
 }
 
 
 ParagraphParameters const & ControlParagraph::params() const
 {
-       lyx::Assert(params_.get());
+       Assert(params_.get());
        return *params_;
 }
 
index de6c73763b7c95afe4428907cfc21ae0d5087519..ed442139e54797d1eafd3fdc55005f1a5b4ab7c5 100644 (file)
@@ -30,6 +30,8 @@ extern string system_lyxdir;
 extern string user_lyxdir;
 extern BufferList bufferlist;
 
+using namespace lyx::support;
+
 using std::endl;
 using std::pair;
 
index c05d001dfe815c36189aed912eabe22718824a00..66642c6a873aca289270bcfbbb7ede00460c1547 100644 (file)
@@ -30,7 +30,9 @@
 #include "support/path.h"
 #include "support/systemcall.h"
 
-#include "debug.h" // for lyxerr
+#include "debug.h"
+
+using namespace lyx::support;
 
 using std::endl;
 
@@ -42,7 +44,7 @@ ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
 
 PrinterParams & ControlPrint::params() const
 {
-       lyx::Assert(params_);
+       Assert(params_);
        return *params_;
 }
 
index c47722477ae19fd8db7df4b9eb7c5c8449492399..570f07fece1c46de728db7d94c15a02c14c06923 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
 
+using namespace lyx::support;
+
 using std::vector;
 
 extern BufferList bufferlist;
index 4b414272b33737726ac268e8a05d3f4f3615b9e0..75f76fdc46d3daa6bf7c892b95a9c7c21bcfca60 100644 (file)
@@ -24,6 +24,8 @@
 #include "support/lstrings.h"
 #include "support/systemcall.h"
 
+using namespace lyx::support;
+
 using std::vector;
 
 
index b541dfd228423a5adbd2b6a785c85e6b26af5129..5a756c0ad2e1724fe38bc7f4c912c892ea6e1fbe 100644 (file)
@@ -13,6 +13,8 @@
 #include "ControlShowFile.h"
 #include "support/filetools.h"
 
+using namespace lyx::support;
+
 
 ControlShowFile::ControlShowFile(Dialog & parent)
        : Dialog::Controller(parent)
index 7406da6c97bd76796ef43a12a18b7ce72a796785..19c1acf035b26061234b2db86803c1b817fae122 100644 (file)
@@ -33,6 +33,8 @@
 
 #include "frontends/Alert.h"
 
+using namespace lyx::support;
+
 using std::endl;
 
 
@@ -271,5 +273,3 @@ void ControlSpellchecker::ignoreAll()
        speller_->accept(word_);
        check();
 }
-
-
index 0aa5551df1881bf43779383dbdbca6408f59ec20..d403a09de1fdd06aa77406b39a4e32a77cb39b53 100644 (file)
@@ -17,6 +17,8 @@
 #include "insets/insettabular.h"
 #include "support/LAssert.h"
 
+using namespace lyx::support;
+
 
 ControlTabular::ControlTabular(Dialog & parent)
        : Dialog::Controller(parent), active_cell_(-1)
@@ -54,7 +56,7 @@ int ControlTabular::getActiveCell() const
 
 LyXTabular const & ControlTabular::tabular() const
 {
-       lyx::Assert(params_.get());
+       Assert(params_.get());
        return *params_.get();
 }
 
index 5f79518a179fbc059e40854c085a3cff38160a68..e10e9b757aba7360883ed72232f795c61a4b30f1 100644 (file)
@@ -17,6 +17,8 @@
 #include "support/lyxlib.h"
 #include <fstream>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::ostream;
 
@@ -48,5 +50,5 @@ void ControlVCLog::getVCLogFile(ostream & ss) const
        if (!found)
                ss << _("No version control log file found.") << endl;
 
-       lyx::unlink(name);
+       unlink(name);
 }
index 3873dbe2085956366a5851d6fe5cffbc800be9a0..95643a0b3f6b3101bd58b7c923f2cd7decf6f5da 100644 (file)
@@ -18,6 +18,7 @@
 #include "debug.h"
 #include "support/LAssert.h"
 
+using namespace lyx::support;
 
 Dialog::Dialog(LyXView & lv, string const & name)
        : is_closing_(false), kernel_(lv), name_(name),
@@ -123,7 +124,7 @@ void Dialog::apply()
 
        if (controller().disconnectOnApply() && !is_closing_) {
                kernel().disconnect(name());
-               controller().initialiseParams(string());
+               controller().initialiseParams(string());
                view().update();
        }
 }
@@ -143,21 +144,21 @@ void Dialog::redraw()
 
 ButtonController & Dialog::bc() const
 {
-       lyx::Assert(bc_ptr_.get());
+       Assert(bc_ptr_.get());
        return *bc_ptr_.get();
 }
 
 
 Dialog::Controller & Dialog::controller() const
 {
-       lyx::Assert(controller_ptr_.get());
+       Assert(controller_ptr_.get());
        return *controller_ptr_.get();
 }
 
 
 Dialog::View & Dialog::view() const
 {
-       lyx::Assert(view_ptr_.get());
+       Assert(view_ptr_.get());
        return *view_ptr_.get();
 }
 
@@ -176,13 +177,13 @@ string const & Dialog::View::getTitle() const
 
 void Dialog::setController(Controller * i)
 {
-       lyx::Assert(i && !controller_ptr_.get());
+       Assert(i && !controller_ptr_.get());
        controller_ptr_.reset(i);
 }
 
 
 void Dialog::setView(View * v)
 {
-       lyx::Assert(v && !view_ptr_.get());
+       Assert(v && !view_ptr_.get());
        view_ptr_.reset(v);
 }
index d4745470a1eb67dc8dc8f761fd92d1b07b2b2391..54578e2090c327462756e78d1c5cc638bd377a41 100644 (file)
@@ -14,6 +14,7 @@
 #include "ControlButtons.h"
 #include "support/LAssert.h"
 
+using namespace lyx::support;
 
 ViewBase::ViewBase(string const & t)
        : controller_ptr_(0), title_(t)
@@ -40,14 +41,14 @@ string const & ViewBase::getTitle() const
 
 ControlButtons & ViewBase::getController()
 {
-       lyx::Assert(controller_ptr_);
+       Assert(controller_ptr_);
        return *controller_ptr_;
 }
 
 
 ControlButtons const & ViewBase::getController() const
 {
-       lyx::Assert(controller_ptr_);
+       Assert(controller_ptr_);
        return *controller_ptr_;
 }
 
index 60ca6d2d8b1369875699be71e4ee4cdd189ae4aa..e689b2213d51d18e43eaca556807f34349f5e17d 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::vector;
 
 
@@ -57,7 +59,7 @@ string const familyName(string const & name)
 
 string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
 {
-       lyx::Assert(!map.empty());
+       Assert(!map.empty());
 
        InfoMap::const_iterator it = map.find(key);
        if (it == map.end())
@@ -109,7 +111,7 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
 
 string const getYear(InfoMap const & map, string const & key)
 {
-       lyx::Assert(!map.empty());
+       Assert(!map.empty());
 
        InfoMap::const_iterator it = map.find(key);
        if (it == map.end())
@@ -173,7 +175,7 @@ vector<string> const getKeys(InfoMap const & map)
 
 string const getInfo(InfoMap const & map, string const & key)
 {
-       lyx::Assert(!map.empty());
+       Assert(!map.empty());
 
        InfoMap::const_iterator it = map.find(key);
        if (it == map.end())
index 235ec3470600a7246f059f33fbb5a541497b4f7f..28826ad9e732a50e80f49046fe95c01f8ff17dc8 100644 (file)
@@ -21,6 +21,8 @@
 #include "gettext.h" // _()
 #include "frontends/Alert.h"
 
+using namespace lyx::support;
+
 using std::pair;
 using std::vector;
 using std::make_pair;
index 4bba95c08dd57a6125383addbfc4a05948a6bd78..ad72098e1558f72551403b14bd2724489b23bc6b 100644 (file)
@@ -26,6 +26,8 @@
 #include <fstream>
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::endl;
 using std::sort;
@@ -71,7 +73,7 @@ void getTexFileList(string const & filename, std::vector<string> & list)
        std::vector<string>::iterator it  = list.begin();
        std::vector<string>::iterator end = list.end();
        for (; it != end; ++it) {
-               *it = STRCONV(regex.Merge(it->c_str(), "/"));
+               *it = STRCONV(regex.Merge(STRCONV((*it)), "/"));
        }
 
        lyx::eliminate_duplicates(list);
index 4d2cb14b4f1789d3938505b138f487ac6007b6e7..8fb056f87422799c3ce531823d2d9afcf22b24ad 100644 (file)
@@ -27,6 +27,8 @@
 #include <qpushbutton.h>
 #include <qcombobox.h>
 
+using namespace lyx::support;
+
 BulletsModule::BulletsModule(QWidget * parent,  const char * name, WFlags fl)
        : BulletsModuleBase(parent, name, fl), tmpbulletset(0)
 {
@@ -238,7 +240,7 @@ void BulletsModule::setBullet(int level, const Bullet & bullet)
                case 1: pb = bullet2PB; co = bulletsize2CO; break;
                case 2: pb = bullet3PB; co = bulletsize3CO; break;
                case 3: pb = bullet4PB; co = bulletsize4CO; break;
-               default: lyx::Assert(false); break;
+               default: Assert(false); break;
        }
 
        setBullet(pb, co, bullet);
index 2053ef25447310a1ce4ffe61620c77d8ea20168a..a677c91bee59bc40d851cc5e611a9c9d7b414884 100644 (file)
@@ -1,3 +1,7 @@
+2003-07-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * introduce namespace lyx::support
+
 2003-06-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * QLPopupMenu.C: fix \file
index 67c57c71be703a2bcf883755c3bcac8d39543c76..aa261b05bbbf8c3ca7c88491fe1c1832e0b70687 100644 (file)
@@ -24,6 +24,7 @@
 #include <qfiledialog.h>
 #include <qtoolbutton.h>
 
+using namespace lyx::support;
 
 namespace {
 
index 0bf9ab2b8dd538cf311c6ab77162a66744c9c044..2eb6c437440a0d56659422dc7512c5a3c01fda8d 100644 (file)
@@ -27,6 +27,8 @@
 #include "Qt2BC.h"
 #include "QAbout.h"
 
+using namespace lyx::support;
+
 using std::getline;
 
 typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
index 7925a9ba11f511e85fcb821ac0e6dab100b92a1d..120f40228140e4ee16a6db6f124477e8b84f9746 100644 (file)
@@ -32,6 +32,8 @@
 #include "QBibtex.h"
 #include "Qt2BC.h"
 
+using namespace lyx::support;
+
 using std::vector;
 
 typedef QController<ControlBibtex, QView<QBibtexDialog> > base_class;
index a659786c8c611477f5a9567421deb926fd3525f1..326ee65d79dc60692d65dde5a2a848388a7bc054 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <vector>
 
+using namespace lyx::support;
 
 QBibtexDialog::QBibtexDialog(QBibtex * form)
        : QBibtexDialogBase(0, 0, false, 0),
index 5f1aadf0608bba1964ec04cbe665ec29acde9839..adb787bc5f2124f3ba7103a47319a1bfd623ab61 100644 (file)
@@ -31,6 +31,7 @@
 #include "support/lstrings.h"
 #include "helper_funcs.h"
 
+using namespace lyx::support;
 
 using std::find;
 using std::max;
index 13fc43db4b5f6b9b6cbab278c86c76eaa7ef09e2..37aa5e1148c6c314f67442ccff956e4e80ed26bb 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "LString.h"
 
+using namespace lyx::support;
+
 using std::vector;
 using std::endl;
 
index 5964d23d519a91e4fae84fc5d5413ba1dad6537b..10956f6101f90eb70f8de0121f6c58e5e0bef4a6 100644 (file)
@@ -52,6 +52,7 @@
 #include <qslider.h>
 #include "lengthcombo.h"
 
+using namespace lyx::support;
 
 QDocumentDialog::QDocumentDialog(QDocument * form)
        : QDocumentDialogBase(0, 0, false, 0), form_(form)
@@ -309,7 +310,7 @@ void QDocumentDialog::updateFontsize(string const & items, string const & sel)
        textLayoutModule->fontsizeCO->clear();
        textLayoutModule->fontsizeCO->insertItem("default");
 
-       for (int n=0; !token(items,'|',n).empty(); ++n)
+       for (int n = 0; !token(items,'|',n).empty(); ++n)
                textLayoutModule->fontsizeCO->
                        insertItem(toqstr(token(items,'|',n)));
 
index da958b70efb373d763798f2bf2d3b35e6018bd0d..399a9c7bcec78e5863a56dfecafef74164c2dc49 100644 (file)
@@ -31,6 +31,8 @@
 
 #include <vector>
 
+using namespace lyx::support;
+
 typedef QController<ControlExternal, QView<QExternalDialog> > base_class;
 
 
index b33169037e100ea946f38d268fb5dcd437ecbfcf..9ec47c7931056944281cc825a655b49a5db01817 100644 (file)
@@ -19,6 +19,7 @@
 #include "support/tostr.h"
 #include "support/FileInfo.h"
 #include "support/filetools.h"
+#include "support/lyxlib.h"
 #include "insets/insetgraphicsParams.h"
 #include "lyxrc.h"
 #include "lengthcombo.h"
@@ -40,6 +41,8 @@
 #include "QGraphics.h"
 #include "Qt2BC.h"
 
+using namespace lyx::support;
+
 using std::vector;
 using std::endl;
 
@@ -242,7 +245,7 @@ void QGraphics::update_contents()
        for (int i = 0; i < num_units; i++)
                dialog_->widthUnit->insertItem(unit_name_gui[i], -1);
 
-       if (!lyx::float_equal(igp.scale, 0.0, 0.05)) {
+       if (!float_equal(igp.scale, 0.0, 0.05)) {
                // there is a scale value > 0.05
                dialog_->width->setText(toqstr(tostr(igp.scale)));
                dialog_->widthUnit->setCurrentItem(0);
index 4921ad6fa8fc3a85ad43bd058618e84df001d7f5..72dca212ba78537d266fe61d8d8912e730674391 100644 (file)
@@ -27,6 +27,8 @@
 
 #include <boost/tuple/tuple.hpp>
 
+using namespace lyx::support;
+
 using std::find_if;
 using std::endl;
 
index f03836cc10cc0483efaad099a07e8cd969500c99..40b24685e1f65460d577824be90fa1c867b480e4 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <boost/scoped_ptr.hpp>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::pair;
 using std::make_pair;
index 08a41c076e199420ccc25413bd740a66fb2faf8b..2b5ba7e41f3a6e9b08f992a6fd7c88fbf192369a 100644 (file)
@@ -26,6 +26,8 @@
 #include <qcombobox.h>
 #include <qlineedit.h>
 
+using namespace lyx::support;
+
 typedef QController<ControlMinipage, QView<QMinipageDialog> > base_class;
 
 
index 74cce8bc11fa66f8e4a02c9f15d12e4fe64236dd..c7e6a4d2d39769efd08873f76fdad3467a83ed18 100644 (file)
@@ -35,6 +35,8 @@
 
 #include <functional>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::bind2nd;
 using std::remove_if;
index 6832c844fc5fca8df0f786f187bdb33ba3d5ff2a..77ce4bc0a26e978e6542c0f7dd429e01b5e6f420 100644 (file)
@@ -54,6 +54,8 @@
 #include <qfontinfo.h>
 #include "qcoloritem.h"
 
+using namespace lyx::support;
+
 using std::vector;
 using std::pair;
 using std::ostringstream;
@@ -302,7 +304,7 @@ void QPrefs::apply()
                // FIXME: dubious, but it's what xforms does
                if (qcol != ci->color()) {
                        ostringstream ostr;
-                       
+
                        ostr << '#' << std::setbase(16) << setfill('0')
                             << setw(2) << ci->color().red()
                             << setw(2) << ci->color().green()
@@ -352,7 +354,7 @@ void setComboxFont(QComboBox * cb, string const & family, string const & foundry
 
        // Bleh, default fonts, and the names couldn't be found. Hack
        // for bug 1063. Qt makes baby Jesus cry.
-       
+
        QFont font;
 
        if (family == lyx_gui::roman_font_name()) {
@@ -501,7 +503,7 @@ void QPrefs::update_contents()
        } else if (rc.isp_command == "hspell") {
                spellmod->spellCommandCO->setCurrentItem(2);
        }
-       
+
        if (rc.use_spell_lib) {
 #if defined(USE_ASPELL) || defined(USE_PSPELL)
                spellmod->spellCommandCO->setCurrentItem(3);
index c19655c06c6333aefbde9663bd505aee735da88d..07a626e7505b0d63210491b7b3adc9cf27687d20 100644 (file)
@@ -25,6 +25,8 @@
 #include <qpushbutton.h>
 #include <qcheckbox.h>
 
+using namespace lyx::support;
+
 using std::vector;
 
 typedef QController<ControlTexinfo, QView<QTexinfoDialog> > base_class;
index 5769148bb8731052c52c79f879a9535c82818e42..12dee158f82b6387f8815e2e735a1d92ddfd1704 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "support/BoostFormat.h"
 
+using namespace lyx::support;
+
 typedef QController<ControlVCLog, QView<QVCLogDialog> > base_class;
 
 
@@ -45,7 +47,7 @@ void QVCLog::build_dialog()
 
 void QVCLog::update_contents()
 {
-       setTitle(bformat(_("Version control log for %1$s"), 
+       setTitle(bformat(_("Version control log for %1$s"),
                         controller().getBufferFileName()));
 
        dialog_->vclogTV->setText("");
index 0780f285c8844c650eec5f888a327e67f5badc81..b8577b5a435fa61bcb0e98fe95de95c46be2a192 100644 (file)
@@ -28,6 +28,7 @@
 #include <qcombobox.h>
 #include <qlineedit.h>
 
+using namespace lyx::support;
 
 typedef QController<ControlWrap, QView<QWrapDialog> > base_class;
 
index 437b85790a7a79dd667c45fbfda8563d761967ea..8e03a988613c5752ee0eaf96c63bc432311b8fd6 100644 (file)
@@ -39,6 +39,8 @@
 #include <qmenubar.h>
 #include <qstatusbar.h>
 
+using namespace lyx::support;
+
 using std::endl;
 
 namespace {
index 3cd0245bc4ea2c4100e9a5b5ff46755cdc236565..8d83cc592915235e9db71190d16669db76d2c2f4 100644 (file)
@@ -21,6 +21,8 @@
 #include <qlayout.h>
 #include <qgroupbox.h>
 
+using namespace lyx::support;
+
 // FIXME: set disabled doesn't work properly
 
 FloatPlacement::FloatPlacement(QWidget * parent, char * name)
index ce6371da26ac6a80380ed637e9f5a56a25f77c69..6b8038ad83cc248236fb60d018301f87563ad1e6 100644 (file)
@@ -55,6 +55,8 @@
 #include <fcntl.h>
 #include <cstdlib>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::exit;
 #endif
index 32e0715f9d99188db39885dd76c55bdee7bd8a97..44c0f3c420e050dd7c6e8ae812d67f32ca2daf12 100644 (file)
@@ -18,6 +18,8 @@
 #include <qlayout.h>
 #include <qlistview.h>
 
+using namespace lyx::support;
+
 using std::map;
 
 
@@ -59,7 +61,7 @@ void PanelStack::addCategory(string const & n, string const & parent)
 
        if (!parent.empty()) {
                PanelMap::iterator it = panel_map_.find(parent);
-               lyx::Assert(it != panel_map_.end());
+               Assert(it != panel_map_.end());
 
                QListViewItem * before = it->second->firstChild();
                if (before) {
@@ -108,7 +110,7 @@ void PanelStack::addPanel(QWidget * panel, string const & name, string const & p
 void PanelStack::setCurrentPanel(string const & name)
 {
        PanelMap::const_iterator cit = panel_map_.find(name);
-       lyx::Assert(cit != panel_map_.end());
+       Assert(cit != panel_map_.end());
 
        // force on first set
        if (list_->currentItem() ==  cit->second)
index 7a19c9f72c7dd184be1d314ee50fda055e811d30..dc68828150744b71fb1be341ddd57bd0d08f65d8 100644 (file)
@@ -35,6 +35,8 @@
 #include "support/filetools.h"
 #endif
 
+using namespace lyx::support;
+
 using std::endl;
 using std::vector;
 using std::pair;
index 8fb9f8e6441f286f6d2a1e6b7d6b2c2a964eff20..7bdee9bc086320f1281beff451ef40f455a26b80 100644 (file)
@@ -42,6 +42,8 @@
 #include <boost/bind.hpp>
 #include <boost/signals/trackable.hpp>
 
+using namespace lyx::support;
+
 using std::min;
 using std::max;
 using std::endl;
@@ -266,7 +268,7 @@ unsigned int LyXScreen::topCursorVisible(LyXText * text)
                                - row->baseline() - vheight;
                } else {
                        // scroll down, the scroll region must be so big!!
-                       newtop = cursor.y() - vheight / 2; 
+                       newtop = cursor.y() - vheight / 2;
                }
 
        } else if (static_cast<int>((cursor.y()) - row->baseline()) <
index 268340caa6026dbbe8a15610dcb8cad47abbe730..879ba05c76cd51592d5dc306e54c7317f8295290 100644 (file)
@@ -1,3 +1,6 @@
+2003-07-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * introcude namespace lyx::support
 
 2003-06-30  André Pönitz  <poenitz@gmx.net>
 
index 65f45e7c286e0fe56ecc68054d29daeb88617dae..3b5ba5d3f23be6a44d7026b7a9e3661d36313ee3 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <cmath>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::pow;
 #endif
@@ -158,7 +160,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
 
                lyxerr << bformat(
                                _("     Using closest allocated color with (r,g,b)=%1$s instead.\n"
-                         "Pixel [%2$s] is used."), 
+                         "Pixel [%2$s] is used."),
                        tostr(cmap[closest_pixel]), tostr(closest_pixel)) << endl;
 
                val.foreground = cmap[closest_pixel].pixel;
index e39a253105eef092430d9572c92431bb4b50e15b..0f43d3ee7fd6611b9030816692a65150adae529c 100644 (file)
@@ -21,6 +21,7 @@
 #include "support/lstrings.h"
 #include <utility>
 
+using namespace lyx::support;
 
 using std::make_pair;
 using std::pair;
index 9316c0b5827d1f83cbded79051c43eedc831e878..17f1475a463e37ea9795d592ad772c94c345ecfb 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <cmath>       // abs()
 
+using namespace lyx::support;
+
 using std::endl;
 using std::abs;
 
@@ -134,14 +136,14 @@ void FontInfo::query()
                        string name(list[i]);
                        lyxerr[Debug::FONT] << "match #" << i << ' '
                                            << name << endl;
-                       sizes[i] = lyx::atoi(token(name, '-', 7));
+                       sizes[i] = atoi(token(name, '-', 7));
                        strings[i] = name;
                        if (sizes[i] == 0) {
                                if (scaleindex == -1) {
                                        scaleindex = i;
                                }
                                scalable = true;
-                       } else if (lyx::atoi(token(name, '-', 12)) == 0)
+                       } else if (atoi(token(name, '-', 12)) == 0)
                                // Ignore bogus matches of scalable fonts.
                                sizes[i] = 0;
                };
index 49821961eaf9486f93ebb04b6a9c788b416ce42d..afb14a27701ec57ea8b0390ffd61ebe3c2f9ab45 100644 (file)
@@ -27,6 +27,8 @@
 
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 extern "C" {
 
 #if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL == 0)
@@ -123,7 +125,7 @@ void FormBase::show()
 {
        // build() is/should be called from the controller, so form() should
        // always exist.
-       lyx::Assert(form());
+       Assert(form());
 
        // we use minw_ to flag whether the dialog has ever been shown.
        // In turn, prepare_to_show() initialises various bits 'n' pieces
@@ -182,14 +184,14 @@ void FormBase::hide()
 
 void FormBase::setPrehandler(FL_OBJECT * ob)
 {
-       lyx::Assert(ob);
+       Assert(ob);
        fl_set_object_prehandler(ob, C_PrehandlerCB);
 }
 
 
 void FormBase::setMessageWidget(FL_OBJECT * ob)
 {
-       lyx::Assert(ob && ob->objclass == FL_TEXT);
+       Assert(ob && ob->objclass == FL_TEXT);
        message_widget_ = ob;
        fl_set_object_lsize(message_widget_, FL_NORMAL_SIZE);
 }
@@ -216,7 +218,7 @@ ButtonPolicy::SMInput FormBase::input(FL_OBJECT *, long)
 // preemptive handler for feedback messages
 void FormBase::MessageCB(FL_OBJECT * ob, int event)
 {
-       lyx::Assert(ob);
+       Assert(ob);
 
        switch (event) {
        case FL_ENTER:
@@ -243,7 +245,7 @@ void FormBase::MessageCB(FL_OBJECT * ob, int event)
 
 void FormBase::PrehandlerCB(FL_OBJECT * ob, int event, int key)
 {
-       lyx::Assert(ob);
+       Assert(ob);
 
        if (ob->objclass == FL_INPUT && event == FL_PUSH && key == 2) {
                // Trigger an input event when pasting in an xforms input object
@@ -295,7 +297,7 @@ void FormBase::postWarning(string const & warning)
 
 void FormBase::clearMessage()
 {
-       lyx::Assert(message_widget_);
+       Assert(message_widget_);
 
        warning_posted_ = false;
 
@@ -312,10 +314,9 @@ void FormBase::clearMessage()
 
 void FormBase::postMessage(string const & message)
 {
-       lyx::Assert(message_widget_);
+       Assert(message_widget_);
 
        int const width = message_widget_->w - 10;
-
        string const tmp = warning_posted_ ?
                bformat(_("WARNING! %1$s"), message) :
                message;
@@ -335,7 +336,7 @@ namespace {
 
 FormBase * GetForm(FL_OBJECT * ob)
 {
-       lyx::Assert(ob && ob->form && ob->form->u_vdata);
+       Assert(ob && ob->form && ob->form->u_vdata);
        FormBase * ptr = static_cast<FormBase *>(ob->form->u_vdata);
        return ptr;
 }
@@ -379,7 +380,7 @@ void C_FormBaseInputCB(FL_OBJECT * ob, long d)
 static int C_WMHideCB(FL_FORM * form, void *)
 {
        // Close the dialog cleanly, even if the WM is used to do so.
-       lyx::Assert(form && form->u_vdata);
+       Assert(form && form->u_vdata);
        FormBase * ptr = static_cast<FormBase *>(form->u_vdata);
        ptr->getController().CancelButton();
        return FL_CANCEL;
@@ -390,7 +391,7 @@ static int C_PrehandlerCB(FL_OBJECT * ob, int event,
 {
        // Note that the return value is important in the pre-emptive handler.
        // Don't return anything other than 0.
-       lyx::Assert(ob);
+       Assert(ob);
 
        // Don't Assert this one, as it can happen quite naturally when things
        // are being deleted in the d-tor.
index 9e7d688b3014b25bd767669a2b70fa9098d7457e..d4366205a8e4b2fc36c337b4fb5c1d0834b63a90 100644 (file)
@@ -20,6 +20,8 @@
 #include "gettext.h"
 #include "support/lstrings.h" // compare
 
+using namespace lyx::support;
+
 typedef FormController<ControlCommand, FormView<FD_bibitem> > base_class;
 
 FormBibitem::FormBibitem(Dialog & parent)
index 0211e226a7a86a1b03af271d2227b4e956362df6..91fc14de2f7085ff871863fd97abd75c5af5cf93 100644 (file)
@@ -27,6 +27,7 @@
 #include "support/filetools.h"
 #include "support/lyxalgo.h"
 
+using namespace lyx::support;
 
 using std::vector;
 using std::sort;
index 62174044cd0382d518bed1bf104123ca0176cc53..a1c30d470edf4cba4cdf94a9b335bd498023fe09 100644 (file)
@@ -9,9 +9,6 @@
  * Full author contact details are available in file CREDITS
  */
 
-#include <vector>
-
-
 #include <config.h>
 
 #include "xformsBC.h"
 
 #include "support/lstrings.h"
 
+#include <vector>
+
+using namespace lyx::support;
+
 using std::vector;
 using std::find;
 
index dc3feea29cef848d5ca3f0b85a49269db929c120..a30dd7b30ef89c4391f97a174990fefeae7c97bb 100644 (file)
@@ -10,8 +10,6 @@
  */
 
 #include <config.h>
-#include <algorithm>
-
 
 #include "xformsBC.h"
 #include "ControlCitation.h"
 #include "support/LAssert.h"
 #include "support/lstrings.h"
 
+#include <algorithm>
+
+using namespace lyx::support;
+
 using std::find;
 using std::max;
 using std::min;
index f7e7d48088ec3ad488f3f107dca013921e806d91..6ff800fc53587599e9da954075b96617e7bf86ab 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 extern "C" {
 
 #if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL == 0)
@@ -184,14 +186,14 @@ void FormDialogView::hide()
 
 void FormDialogView::setPrehandler(FL_OBJECT * ob)
 {
-       lyx::Assert(ob);
+       Assert(ob);
        fl_set_object_prehandler(ob, C_PrehandlerCB);
 }
 
 
 void FormDialogView::setMessageWidget(FL_OBJECT * ob)
 {
-       lyx::Assert(ob && ob->objclass == FL_TEXT);
+       Assert(ob && ob->objclass == FL_TEXT);
        message_widget_ = ob;
        fl_set_object_lsize(message_widget_, FL_NORMAL_SIZE);
 }
@@ -218,7 +220,7 @@ ButtonPolicy::SMInput FormDialogView::input(FL_OBJECT *, long)
 // preemptive handler for feedback messages
 void FormDialogView::MessageCB(FL_OBJECT * ob, int event)
 {
-       lyx::Assert(ob);
+       Assert(ob);
 
        switch (event) {
        case FL_ENTER:
@@ -245,7 +247,7 @@ void FormDialogView::MessageCB(FL_OBJECT * ob, int event)
 
 void FormDialogView::PrehandlerCB(FL_OBJECT * ob, int event, int key)
 {
-       lyx::Assert(ob);
+       Assert(ob);
 
        if (ob->objclass == FL_INPUT && event == FL_PUSH && key == 2) {
                // Trigger an input event when pasting in an xforms input
@@ -297,7 +299,7 @@ void FormDialogView::postWarning(string const & warning)
 
 void FormDialogView::clearMessage()
 {
-       lyx::Assert(message_widget_);
+       Assert(message_widget_);
 
        warning_posted_ = false;
 
@@ -315,11 +317,9 @@ void FormDialogView::clearMessage()
 #warning isnt this the same as in FormBase?
 void FormDialogView::postMessage(string const & message)
 {
-       lyx::Assert(message_widget_);
+       Assert(message_widget_);
 
        int const width = message_widget_->w - 10;
-
-
        string const tmp = warning_posted_ ?
                bformat(_("WARNING! %1$s"), message) :
                message;
@@ -339,7 +339,7 @@ namespace {
 
 FormDialogView * GetForm(FL_OBJECT * ob)
 {
-       lyx::Assert(ob && ob->form && ob->form->u_vdata);
+       Assert(ob && ob->form && ob->form->u_vdata);
        FormDialogView * ptr =
                static_cast<FormDialogView *>(ob->form->u_vdata);
        return ptr;
@@ -384,7 +384,7 @@ void C_FormDialogView_InputCB(FL_OBJECT * ob, long d)
 static int C_WMHideCB(FL_FORM * form, void *)
 {
        // Close the dialog cleanly, even if the WM is used to do so.
-       lyx::Assert(form && form->u_vdata);
+       Assert(form && form->u_vdata);
        FormDialogView * ptr = static_cast<FormDialogView *>(form->u_vdata);
        ptr->dialog().CancelButton();
        return FL_CANCEL;
@@ -395,7 +395,7 @@ static int C_PrehandlerCB(FL_OBJECT * ob, int event,
 {
        // Note that the return value is important in the pre-emptive handler.
        // Don't return anything other than 0.
-       lyx::Assert(ob);
+       Assert(ob);
 
        // Don't Assert this one, as it can happen quite naturally when things
        // are being deleted in the d-tor.
index 576e7672a178ad9c768f624598af438b4e4453e4..276c7d48ead9b9540c9ab0cb982b165b80e34258 100644 (file)
@@ -44,6 +44,8 @@
 
 #include <functional>
 
+using namespace lyx::support;
+
 using std::bind2nd;
 using std::vector;
 
index 8f259a3ae88c21d51f6972550e5d43f40fe98746..e48fba8b4c9cc2ccb0d1df85ddfd72f19c54a5a1 100644 (file)
@@ -30,6 +30,8 @@
 #include "support/lstrings.h"
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 typedef FormController<ControlExternal, FormView<FD_external> > base_class;
 
 FormExternal::FormExternal(Dialog & parent)
index 03599d8ac6f6660c602ca9d7ddd731240bdf46df..1ed9e2adabff7e324f0de6a0af7e21e1c4056a8c 100644 (file)
@@ -61,6 +61,8 @@ using std::sort;
 #include "forms/form_filedialog.h"
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 namespace {
 
 // six months, in seconds
@@ -196,7 +198,7 @@ void FileDialog::Private::Reread()
                Alert::err_alert(_("Warning! Couldn't open directory."),
                        directory_);
 #endif
-               directory_ = lyx::getcwd();
+               directory_ = getcwd();
                dir = ::opendir(directory_.c_str());
        }
 
@@ -356,7 +358,7 @@ void FileDialog::Private::SetDirectory(string const & path)
 {
        string tmp;
        if (path.empty())
-               tmp = lyx::getcwd();
+               tmp = getcwd();
        else
                tmp = MakeAbsPath(ExpandPath(path), directory_);
 
index d72294115ecb7412edb581c757951c1f73f9f1c8..df7c56cbd5d945e6902bb0c602eec990aa123ee2 100644 (file)
@@ -23,6 +23,8 @@
 #include "support/lstrings.h"
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 namespace {
 
 enum {
index d2f1e84e22c636a5626f4c89034d942cce124cd4..1c1a9a7e4dbf6f2f12b54f777d036aa704cfb6e2 100644 (file)
@@ -24,6 +24,8 @@
 #include "lyx_forms.h"
 #include "support/tostr.h"
 
+using namespace lyx::support;
+
 using std::vector;
 using std::find;
 using std::find_if;
index 70a79a3e2a381263ee7c3b01ea8ecbe6410e2fb4..8dd690560d7ee63be265e92fa6203e50451f90d6 100644 (file)
@@ -40,6 +40,8 @@
 
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 using std::endl;
 using std::vector;
 
@@ -317,7 +319,7 @@ void FormGraphics::apply()
        // first item in choice_width means scaling
        if (fl_get_choice(file_->choice_width) == 1) {
                igp.scale = strToDbl(getString(file_->input_width));
-               if (lyx::float_equal(igp.scale, 0.0, 0.05)) {
+               if (float_equal(igp.scale, 0.0, 0.05)) {
                        igp.scale = 100.0;
                }
                igp.width = LyXLength();
@@ -443,7 +445,7 @@ void FormGraphics::update() {
        }
 
        // set width input fields according to scaling or width/height input
-       if (!lyx::float_equal(igp.scale, 0.0, 0.05)) {
+       if (!float_equal(igp.scale, 0.0, 0.05)) {
                fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
                fl_set_input_maxchars(file_->input_width, 0);
                fl_set_input(file_->input_width, tostr(igp.scale).c_str());
@@ -459,7 +461,7 @@ void FormGraphics::update() {
                                igp.height, defaultUnit);
 
        // disable height input in case of scaling
-       bool const disable_height = !lyx::float_equal(igp.scale, 0.0, 0.05);
+       bool const disable_height = !float_equal(igp.scale, 0.0, 0.05);
        setEnabled(file_->input_height, !disable_height);
        setEnabled(file_->choice_height, !disable_height);
 
index e51ca031d3731e5de8a7b5b0fee01037e139704b..1ccfde20ceaafd2e62443fdd0cf503a69bab4281 100644 (file)
@@ -11,8 +11,6 @@
  */
 
 #include <config.h>
-#include <algorithm>
-
 
 #include "debug.h"
 
 #include "support/lstrings.h" // strip
 #include "lyx_forms.h"
 
+#include <algorithm>
+
+using namespace lyx::support;
+
 typedef FormController<ControlInclude, FormView<FD_include> > base_class;
 
 FormInclude::FormInclude(Dialog & parent)
index 0b9f8b8fd2ccb6f720afd9fb03ad695d7da0ea19..3ecc8792b209bcf7fe3aeb46f18e2d1b78c444a6 100644 (file)
@@ -29,6 +29,8 @@
 extern  "C" void C_FormDialogView_CancelCB(FL_OBJECT *, long);
 extern  "C" void C_FormDialogView_InputCB(FL_OBJECT *, long);
 
+using namespace lyx::support;
+
 using std::vector;
 using std::max;
 
@@ -76,7 +78,7 @@ void FormMathsBitmap::addBitmap(BitmapStore const & bm)
 
 void FormMathsBitmap::build()
 {
-       lyx::Assert(bitmaps_.size() > 0);
+       Assert(bitmaps_.size() > 0);
 
        h_+= 42; // Allow room for a Close button
 
index b807ca1983fc639a7b57fe6002987960415c03c6..b071274b90e90e5a61bf5240cc86be45f2c75e34 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <algorithm>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::strlen;
 #endif
@@ -44,10 +46,10 @@ extern "C" {
        int C_FormMathsMatrixAlignFilter(FL_OBJECT * ob, char const *,
                                         char const * cur, int c)
        {
-               lyx::Assert(ob);
+               Assert(ob);
                FormMathsMatrix * pre =
                        static_cast<FormMathsMatrix *>(ob->u_vdata);
-               lyx::Assert(pre);
+               Assert(pre);
                return pre->AlignFilter(cur, c);
        }
 
index 4c224ed4c322933717ee6f6ba600170b847af8ae..780a52bee379e1a9510b6394d47293d078e2931d 100644 (file)
@@ -21,6 +21,8 @@
 #include "xforms_helpers.h"
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 typedef FormController<ControlMinipage, FormView<FD_minipage> > base_class;
 
 FormMinipage::FormMinipage(Dialog & parent)
index 03e2cdb797a3dc4b845c433149f4d35de11b962f..6b45eb0f258467cf0572c338c8b3ec3815972bf1 100644 (file)
@@ -35,6 +35,8 @@
 
 #include <functional>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::bind2nd;
 using std::remove_if;
@@ -440,7 +442,7 @@ namespace {
 void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
 {
        // Paranoia check!
-       lyx::Assert(choice_type  && choice_type->objclass  == FL_CHOICE &&
+       Assert(choice_type  && choice_type->objclass  == FL_CHOICE &&
                    input_length && input_length->objclass == FL_INPUT);
 
        if (fl_get_choice(choice_type) != 7)
@@ -460,7 +462,7 @@ VSpace const setVSpaceFromWidgets(FL_OBJECT * choice_type,
                                  FL_OBJECT * check_keep)
 {
        // Paranoia check!
-       lyx::Assert(choice_type   && choice_type->objclass   == FL_CHOICE &&
+       Assert(choice_type   && choice_type->objclass   == FL_CHOICE &&
                    input_length  && input_length->objclass  == FL_INPUT &&
                    choice_length && choice_length->objclass == FL_CHOICE &&
                    check_keep    && check_keep->objclass    == FL_CHECKBUTTON);
@@ -508,7 +510,7 @@ void setWidgetsFromVSpace(VSpace const & space,
                          FL_OBJECT * check_keep)
 {
        // Paranoia check!
-       lyx::Assert(choice_type   && choice_type->objclass   == FL_CHOICE &&
+       Assert(choice_type   && choice_type->objclass   == FL_CHOICE &&
                    input_length  && input_length->objclass  == FL_INPUT &&
                    choice_length && choice_length->objclass == FL_CHOICE &&
                    check_keep    && check_keep->objclass    == FL_CHECKBUTTON);
index 4bb1d2c4f18042bcdfdbf4d9c222bd29598c0f1a..b6e87f7df468df5498e7cfc62a0d292748173350 100644 (file)
@@ -66,6 +66,8 @@ using std::setfill;
 extern string system_lyxdir;
 extern string user_lyxdir;
 
+using namespace lyx::support;
+
 namespace {
 
 // These should probably go inside the class definition...
@@ -336,7 +338,7 @@ void FormPreferences::apply()
 
 string const FormPreferences::getFeedback(FL_OBJECT * ob)
 {
-       lyx::Assert(ob);
+       Assert(ob);
 
        if (ob->form->fdui == colors_.dialog())
                return colors_.feedback(ob);
@@ -369,7 +371,7 @@ string const FormPreferences::getFeedback(FL_OBJECT * ob)
 
 ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
 {
-       lyx::Assert(ob);
+       Assert(ob);
 
        bool valid = true;
 
index ed0c11debb6f9d6f20f068bfe54606fd77b08199..06da0e40d0fedc0f693dc7b68691e4445be4c363 100644 (file)
@@ -25,6 +25,7 @@
 #include "lyx_forms.h"
 #include "support/tostr.h"
 
+using namespace lyx::support;
 
 typedef FormCB<ControlPrint, FormDB<FD_print> > base_class;
 
index 7fe982295b67bb60e57f8ef9a4656d96b5b783a8..85a3b1f1926d8c47ff87dffb7d4bf4c74fc7fe56 100644 (file)
@@ -9,8 +9,6 @@
  */
 
 #include <config.h>
-#include <algorithm>
-
 
 #include "xformsBC.h"
 #include "ControlRef.h"
 #include "support/lstrings.h" // trim
 #include "lyx_forms.h"
 
+#include <algorithm>
+
+using namespace lyx::support;
+
 using std::find;
 using std::max;
 using std::sort;
index ac97db71dcf9338f5c0f0ab861237261b61acf6f..c4ef555ef8cd1240e8dc54f3f3cfeaae258d1070 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <config.h>
 
-
 #include "FormSendto.h"
 #include "forms/form_sendto.h"
 #include "ControlSendto.h"
@@ -22,6 +21,8 @@
 #include "lyx_forms.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::vector;
 
 typedef FormCB<ControlSendto, FormDB<FD_sendto> > base_class;
index f389621c1874e8c66116ca66a57df6f80dfa970c..0be76f3ff4f3376d96d6fa1e278af3b07a0b02cc 100644 (file)
 
 #include <config.h>
 
-
-#include <vector>
-#include <algorithm>
-
 #include "ControlTabular.h"
 #include "xformsBC.h"
 #include "ButtonController.h"
 
 #include "lyx_forms.h"
 
+#include <vector>
+#include <algorithm>
+
+using namespace lyx::support;
+
 using std::vector;
 using std::bind2nd;
 
index e97ca915a4014ad99f94fb269dc44ac436ef5ca2..70ca9967365e806aeff5f71ea3a7a787dd6af1df 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 typedef FormController<ControlTexinfo, FormView<FD_texinfo> > base_class;
 
 FormTexinfo::FormTexinfo(Dialog & parent)
index e4bc3951cabbfb55eda7fa085eafab6f43c9d8cb..93e822aa727337b65a626e55d81ac9ecc08d64f6 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 typedef FormController<ControlCommand, FormView<FD_text> > base_class;
 
 FormText::FormText(Dialog & parent, string const & title, string const & label)
index b2b5ac3931b2c6b1962d8e52ea37cd32295a6d85..1a380b812759290439919047d7fb5d006320a6f5 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <config.h>
 
-
 #include "ControlThesaurus.h"
 #include "FormThesaurus.h"
 #include "forms/form_thesaurus.h"
 #include "debug.h"
 #include "support/lstrings.h"
 #include "lyx_forms.h"
+
 #include <cctype>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::isupper;
 using std::islower;
index 45755c9ea3e27bb7739edb72385042082fd6a9ff..9c35604e4b357bd25645d89e431f92dc159beed6 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <vector>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::endl;
 
index 2160905bb306efa2e36e6a85bac795b8fee52e25..07e0eff8e3cd9c5b9ec1fc10c33cfeacf1b205c3 100644 (file)
@@ -25,6 +25,7 @@
 #include "lyx_forms.h"
 #include "support/tostr.h"
 
+using namespace lyx::support;
 
 typedef FormController<ControlWrap, FormView<FD_wrap> > base_class;
 
index 424b14a6a030c2101e2b92b0a164e3ef6cefb7b0..ea868c8dd1a277b82bd6478d5b44b8909f92257a 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::vector;
 using std::max;
@@ -342,7 +344,7 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
        }
 
        // Paranoia check
-       lyx::Assert(item->kind() == MenuItem::Submenu);
+       Assert(item->kind() == MenuItem::Submenu);
 
        // set tabstop length
        fl_set_tabstop(menu_tabstop);
index 374cb564bd1d685a4fe0e73ee0fad989a73fce7f..1f1eda9d40789e39e8bde8086581636b6dd90a71 100644 (file)
@@ -24,6 +24,8 @@
 #include <algorithm>
 #include <iterator>
 
+using namespace lyx::support;
+
 using std::find_if;
 using std::endl;
 
@@ -32,7 +34,7 @@ void RadioButtonGroup::init(FL_OBJECT * ob, size_type value)
 {
        // Object must be a ROUND3DBUTTON (let all radio buttons look the same)
        // and of type RADIO_BUTTON (otherwise it ain't work).
-       lyx::Assert(ob && ob->objclass == FL_ROUND3DBUTTON
+       Assert(ob && ob->objclass == FL_ROUND3DBUTTON
                        && ob->type == FL_RADIO_BUTTON);
 
        map.push_back(ButtonValuePair(ob, value));
index fe1e3b554a999df63788c760b064af76580a906e..f921864d0b22acc693bdbf801a65e0bff2129c1b 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <boost/bind.hpp>
 
+using namespace lyx::support;
+
 bool Tooltips::enabled_ = true;
 
 boost::signal0<void> Tooltips::toggled;
@@ -61,7 +63,7 @@ void Tooltips::set()
 
 void Tooltips::init(FL_OBJECT * ob, string const & tip)
 {
-       lyx::Assert(ob && ob->form);
+       Assert(ob && ob->form);
 
        // Store the tooltip string
        string const str = formatted(trim(tip), 400);
index 3f104fecc5d4328fbabc65e73c406986e6bc047e..a9fede2356a868ecd50551f9c3653f3b469bfe46 100644 (file)
@@ -31,6 +31,9 @@
 
 #include <boost/bind.hpp>
 #include <boost/signals/connection.hpp>
+
+using namespace lyx::support;
+
 using std::abs;
 using std::endl;
 
index a4dd8d6cbc7e7a656c0d4805df71bd15a465b3e7..a40e3342f3b20be0d55143644b67c6eeae0cbe48 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author unknown
+ * \author Lars Gullik Bjønnes
  * \author John Levon
  *
  * Full author contact details are available in file CREDITS
@@ -11,7 +11,6 @@
 
 #include <config.h>
 
-
 #include "XPainter.h"
 #include "LString.h"
 #include "debug.h"
@@ -31,6 +30,8 @@
 
 #include <cmath>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::max;
 
index 6b43aee35d74ae0c3c5aca6871d175e2f8547771..630a6e5098f954b4c5f35deefc7fe106f826727b 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "lyx_forms.h"
 
+using namespace lyx::support;
 
 void addCheckedLyXLength(BCView & bcview,
                         FL_OBJECT * input, FL_OBJECT * label)
@@ -65,7 +66,7 @@ void setWidget(bool valid, FL_OBJECT * input, FL_OBJECT * label)
 CheckedLyXLength::CheckedLyXLength(FL_OBJECT * input, FL_OBJECT * label)
        : input_(input), label_(label ? label : input)
 {
-       lyx::Assert(input && input->objclass == FL_INPUT);
+       Assert(input && input->objclass == FL_INPUT);
 }
 
 
@@ -85,7 +86,7 @@ bool CheckedLyXLength::check() const
 CheckedGlueLength::CheckedGlueLength(FL_OBJECT * input, FL_OBJECT * label)
        : input_(input), label_(label ? label : input)
 {
-       lyx::Assert(input && input->objclass == FL_INPUT);
+       Assert(input && input->objclass == FL_INPUT);
 }
 
 
index cfa58ad6cb2827d8d271bd4e0d4bd4d29311e818..e2e23e93bdf9a883ce2347af34e80e74c18e777b 100644 (file)
@@ -13,6 +13,8 @@
 #include "forms_gettext.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 // Extract shortcut from "<identifier>|<shortcut>" string
 string const scex(string const & str)
 {
index 49bd062dd09a41964128423c34b3764a6793c458..d1a29e1dd96e8098264869a7429c839416b2ebe1 100644 (file)
@@ -11,6 +11,8 @@
 #include "support/lstrings.h"
 #include "input_validators.h"
 
+using namespace lyx::support;
+
 #if defined(__cplusplus)
 extern "C"
 {
index 656d66357953ead0a58bdb010c9acb02dfadedf0..e39db69e87821158c19b27c49bc1e276fe85a163 100644 (file)
@@ -44,6 +44,8 @@
 #include <fcntl.h>
 #include <boost/bind.hpp>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::exit;
 #endif
@@ -117,7 +119,7 @@ int LyX_XErrHandler(Display * display, XErrorEvent * xeev) {
        XGetErrorText(display, xeev->error_code, etxt, 512);
        lyxerr << etxt << " id: " << xeev->resourceid << endl;
        // By doing an abort we get a nice backtrace. (hopefully)
-       lyx::abort();
+       lyx::support::abort();
        return 0;
 }
 
index 15168c4c13d9c031eb143d8e385dbafb3652f872..ecf875a2861a59a644738c5987ce10344f7198c9 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 using std::endl;
 
 // The global fontloader
index 4412065a12781ce5be6a0d94a38c00b6f0f3c535..30b5acedb550cbf773b3b63888b452b838555fa4 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <boost/scoped_array.hpp>
 
+using namespace lyx::support;
+
 namespace {
 
 inline
index 39feb72df75995053c09ec797793597cdba88028..52abc998b8c6624938eedfdbff2024ac3252dd47 100644 (file)
@@ -18,6 +18,7 @@
 #include "support/LAssert.h"
 #include "support/lstrings.h"
 #include "support/lyxfunctional.h"  // compare_memfun
+#include "support/lyxlib.h"
 
 #include "lyx_forms.h"
 
@@ -31,6 +32,8 @@
 
 #include <boost/tuple/tuple.hpp>
 
+using namespace lyx::support;
+
 using std::find_if;
 
 namespace {
@@ -296,7 +299,7 @@ void xformsImage::rotate(Params const & params)
        if (!image_)
                return ;
 
-       if (lyx::float_equal(params.angle, 0.0, 0.1))
+       if (float_equal(params.angle, 0.0, 0.1))
                // No rotation is necessary.
                return;
 
@@ -306,7 +309,7 @@ void xformsImage::rotate(Params const & params)
        // Work around xforms bug when params.angle == 270
        // the 'InternalError: bad special angle' error.
        // This bug fix is not needed in xforms 1.0 and greater.
-       if (lyx::float_equal(params.angle, 270.0, 0.1)) {
+       if (float_equal(params.angle, 270.0, 0.1)) {
                flimage_rotate(image_,  900, FLIMAGE_SUBPIXEL);
                flimage_rotate(image_, 1800, FLIMAGE_SUBPIXEL);
        } else {
@@ -370,7 +373,7 @@ extern "C" {
 
 int status_report(FL_IMAGE * ob, const char *s)
 {
-       lyx::Assert(ob && ob->u_vdata);
+       Assert(ob && ob->u_vdata);
 
        string const str = s ? rtrim(s) : string();
        if (str.empty())
@@ -389,7 +392,7 @@ int status_report(FL_IMAGE * ob, const char *s)
 
 static void error_report(FL_IMAGE * ob, const char *s)
 {
-       lyx::Assert(ob && ob->u_vdata);
+       Assert(ob && ob->u_vdata);
 
        string const str = s ? rtrim(s) : string();
        if (str.empty())
index 1d487f120845a08c95f72882d340ff2729e9a91d..be8833c60373872ed651bf829fefe0dd920b7064 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <fstream>
 
+using namespace lyx::support;
+
 using std::ofstream;
 using std::pair;
 using std::vector;
@@ -100,7 +102,7 @@ vector<string> const getVector(FL_OBJECT * ob)
                }
                break;
        default:
-               lyx::Assert(0);
+               Assert(0);
        }
 
        return vec;
@@ -111,7 +113,7 @@ vector<string> const getVector(FL_OBJECT * ob)
 string const getString(FL_OBJECT * ob, int line)
 {
        // Negative line value does not make sense.
-       lyx::Assert(line >= 0);
+       Assert(line >= 0);
 
        char const * tmp = 0;
        switch (ob->objclass) {
@@ -140,7 +142,7 @@ string const getString(FL_OBJECT * ob, int line)
                break;
 
        default:
-               lyx::Assert(0);
+               Assert(0);
        }
 
        return tmp ? trim(tmp) : string();
@@ -149,7 +151,7 @@ string const getString(FL_OBJECT * ob, int line)
 string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
 {
        // Paranoia check
-       lyx::Assert(input  && input->objclass  == FL_INPUT &&
+       Assert(input  && input->objclass  == FL_INPUT &&
                    choice && choice->objclass == FL_CHOICE);
 
        string const length = trim(fl_get_input(input));
@@ -190,7 +192,7 @@ void updateWidgetsFromLength(FL_OBJECT * input, FL_OBJECT * choice,
                             string const & default_unit)
 {
        // Paranoia check
-       lyx::Assert(input  && input->objclass  == FL_INPUT &&
+       Assert(input  && input->objclass  == FL_INPUT &&
                    choice && choice->objclass == FL_CHOICE);
 
        if (len.empty()) {
index 936e7582a7fb992a2331714929e7419a4d46e038..c8d5f32cef422bc1fba59517ddd8e9b7dd725070 100644 (file)
@@ -16,6 +16,8 @@
 #include <algorithm> // std::max. Use FL_max in .c code...
 #include "lyx_forms.h"
 
+using namespace lyx::support;
+
 namespace {
 
 /* This is hacked straight out of the xforms source.
@@ -93,7 +95,7 @@ double get_scaling_factor(FL_FORM * form)
 
 double get_tabfolder_scale_to_fit(FL_OBJECT * folder)
 {
-       lyx::Assert(folder && folder->objclass == FL_TABFOLDER);
+       Assert(folder && folder->objclass == FL_TABFOLDER);
 
        fl_freeze_form(folder->form);
        int const saved_folder_id = fl_get_folder_number(folder);
@@ -115,7 +117,7 @@ double get_tabfolder_scale_to_fit(FL_OBJECT * folder)
 
 void scale_tabfolder_horizontally(FL_OBJECT * folder, double factor)
 {
-       lyx::Assert(folder && folder->objclass == FL_TABFOLDER);
+       Assert(folder && folder->objclass == FL_TABFOLDER);
 
        fl_freeze_form(folder->form);
        int const saved_folder_id = fl_get_folder_number(folder);
@@ -136,7 +138,7 @@ void scale_tabfolder_horizontally(FL_OBJECT * folder, double factor)
 
 double get_scale_to_fit(FL_FORM * form)
 {
-       lyx::Assert(form);
+       Assert(form);
 
        double factor = get_scaling_factor(form);
        for (FL_OBJECT * ob = form->first; ob; ob = ob->next) {
@@ -150,7 +152,7 @@ double get_scale_to_fit(FL_FORM * form)
 
 void scale_form_horizontally(FL_FORM * form, double factor)
 {
-       lyx::Assert(form);
+       Assert(form);
 
        if (factor <= 1.0)
                return;
index 48e67610cbc59b01c46682c24b72543fd615053c..fb31eccd443bd300f60abbed00ddfb63fd98d2ec 100644 (file)
@@ -1,3 +1,7 @@
+2003-07-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * introcude namespace lyx::support
+
 2003-06-04  Angus Leeming  <leeming@lyx.org>
 
        * GraphicsLoader.C (Loader copy c-tor): make it work as expected. ;-)
@@ -38,7 +42,7 @@
 
 2003-05-12 André Pönitz <poenitz@gmx.net>
 
-       * PreviewLoader.C:  boost::format -> bformat 
+       * PreviewLoader.C:  boost::format -> bformat
 
 2003-04-15  Angus Leeming  <leeming@lyx.org>
 
 
        * GraphicsLoader.[Ch],
        * PreviewImage.[Ch],
-       * PreviewedInset.C: Removed unneeded list of owner insets 
+       * PreviewedInset.C: Removed unneeded list of owner insets
 
 2003-02-25  Alfredo Braunstein  <abraunst@libero.it>
 
        * GraphicsConverter (startConversion): add the call to
-       ForkedCallQueue::add 
+       ForkedCallQueue::add
 
        * GraphicsLoader.[Ch],
        * PreviewImage.[Ch],
-       * PreviewedInset.C: Removed unneeded BufferView 
-       
+       * PreviewedInset.C: Removed unneeded BufferView
+
 2003-02-25  Alfredo Braunstein  <abraunst@libero.it>
 
        * LoaderQueue.[Ch]: a simplification of the code, eliminated
        * PreviewLoader.C (FindFirst): use ==, not < with std::find.
 
 2003-02-21  Alfredo Braunstein  <abraunst@libero.it>
-       
+
        * LoaderQueue.[Ch] (setPriority): added
-       
-       * PreviewLoader.C (finishedGenerating): reversed the loading order so 
+
+       * PreviewLoader.C (finishedGenerating): reversed the loading order so
        first images get 'touched' last, and so load first.
 
 2003-02-20  Alfredo Braunstein  <abraunst@libero.it>
 
 2002-12-17  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
-       * Makefile.am (EXTRA_DIST): remove variable 
+       * Makefile.am (EXTRA_DIST): remove variable
 
 2002-12-13  Angus Leeming  <leeming@lyx.org>
 
index d11315363d9f86500e484c72156e4f519a24ae9a..107275cb62e2a0bc097fc9863cd27e031fc905d6 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <map>
 
+using namespace lyx::support;
+
 namespace grfx {
 
 /** The cache contains one item per file, so use a map to find the
index fe38fd16af8856726d452e06de754127e30b3d6c..02c730d37af824a07c57ca159245336a98009590 100644 (file)
 
 #include "support/LAssert.h"
 #include "support/filetools.h"
+#include "support/lyxlib.h"
 
 #include <boost/shared_ptr.hpp>
 #include <boost/bind.hpp>
 #include <boost/signals/trackable.hpp>
 
+using namespace lyx::support;
+
 using std::endl;
 
 namespace grfx {
@@ -207,11 +210,11 @@ void CacheItem::Impl::reset()
 {
        zipped_ = false;
        if (!unzipped_filename_.empty())
-               lyx::unlink(unzipped_filename_);
+               unlink(unzipped_filename_);
        unzipped_filename_.erase();
 
        if (remove_loaded_file_ && !file_to_load_.empty())
-               lyx::unlink(file_to_load_);
+               unlink(file_to_load_);
        remove_loaded_file_ = false;
        file_to_load_.erase();
 
@@ -259,7 +262,7 @@ void CacheItem::Impl::imageConverted(bool success)
                setStatus(ErrorConverting);
 
                if (zipped_)
-                       lyx::unlink(unzipped_filename_);
+                       unlink(unzipped_filename_);
 
                return;
        }
@@ -291,10 +294,10 @@ void CacheItem::Impl::imageLoaded(bool success)
 
        // Clean up after loading.
        if (zipped_)
-               lyx::unlink(unzipped_filename_);
+               unlink(unzipped_filename_);
 
        if (remove_loaded_file_ && unzipped_filename_ != file_to_load_)
-               lyx::unlink(file_to_load_);
+               unlink(file_to_load_);
 
        cl_.disconnect();
 
@@ -319,7 +322,7 @@ string const findTargetFormat(string const & from)
        FormatList const formats = grfx::Image::loadableFormats();
 
        // There must be a format to load from.
-       lyx::Assert(!formats.empty());
+       Assert(!formats.empty());
 
        // First ascertain if we can load directly with no conversion
        FormatList::const_iterator it  = formats.begin();
@@ -392,11 +395,11 @@ void CacheItem::Impl::convertToDisplayFormat()
 
        // Add some stuff to create a uniquely named temporary file.
        // This file is deleted in loadImage after it is loaded into memory.
-       string const to_file_base = lyx::tempName(string(), temp);
+       string const to_file_base = tempName(string(), temp);
        remove_loaded_file_ = true;
 
        // Remove the temp file, we only want the name...
-       lyx::unlink(to_file_base);
+       unlink(to_file_base);
 
        // Connect a signal to this->imageConverted and pass this signal to
        // the graphics converter so that we can load the modified file
index baf4abe44877fcfa088ab166d2c15a467b140be8..2333dde4610afbd523870c8f8f0a8b97ab7ab304 100644 (file)
@@ -31,6 +31,8 @@
 #include <fstream>
 #include <sys/types.h> // needed for pid_t
 
+using namespace lyx::support;
+
 using std::endl;
 using std::ostream;
 
@@ -195,7 +197,7 @@ void Converter::Impl::startConversion()
                return;
        }
 
-       Forkedcall::SignalTypePtr 
+       Forkedcall::SignalTypePtr
                ptr = ForkedCallQueue::get().add(script_command_);
 
        ptr->connect(boost::bind(&Impl::converted, this, _1, _2));
@@ -210,10 +212,10 @@ void Converter::Impl::converted(pid_t /* pid */, int retval)
 
        finished_ = true;
        // Clean-up behind ourselves
-       lyx::unlink(script_file_);
+       unlink(script_file_);
 
        if (retval > 0) {
-               lyx::unlink(to_file_);
+               unlink(to_file_);
                to_file_.erase();
                finishedConversion(false);
        } else {
@@ -277,8 +279,8 @@ bool build_script(string const & from_file,
        // Remember to remove the temp file because we only want the name...
        static int counter = 0;
        string const tmp = "gconvert" + tostr(counter++);
-       string const to_base = lyx::tempName(string(), tmp);
-       lyx::unlink(to_base);
+       string const to_base = tempName(string(), tmp);
+       unlink(to_base);
 
        string outfile = from_file;
 
index 455c26f1f7ed1f0217127bfc32641e50fb64e7ee..7dc58035b416d5d1273b7f7be8c0f81e04d85e5a 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef GRAPHICSTYPES_H
 #define GRAPHICSTYPES_H
 
+#include "LString.h"
 #include "support/translator.h"
 
 namespace grfx {
index bd96232e734e89bed30c7fba1aa3bd209ecbf017..61e112836b07a572696e4dbcb441d8679c12174e 100644 (file)
@@ -20,6 +20,7 @@
 #include <boost/bind.hpp>
 #include <boost/signals/trackable.hpp>
 
+using namespace lyx::support;
 
 namespace grfx {
 
@@ -112,7 +113,7 @@ PreviewImage::Impl::Impl(PreviewImage & p, PreviewLoader & l,
 
 PreviewImage::Impl::~Impl()
 {
-       lyx::unlink(iloader_.filename());
+       unlink(iloader_.filename());
 }
 
 
@@ -145,7 +146,7 @@ void PreviewImage::Impl::statusChanged()
                break;
 
        case Ready:
-               lyx::unlink(iloader_.filename());
+               unlink(iloader_.filename());
                ploader_.emitSignal(parent_);
                break;
        }
index cf4ae4faaf2f9bfce80d02a749a9af4b61cd4b72..5e3ee3d09f3806744ea04bf99093cbc8c9c2a9fb 100644 (file)
@@ -42,6 +42,8 @@
 #include <utility>
 #include <vector>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::find;
 using std::fill;
@@ -291,13 +293,13 @@ void InProgress::stop() const
                ForkedcallsController::get().kill(pid, 0);
 
        if (!metrics_file.empty())
-               lyx::unlink(metrics_file);
+               unlink(metrics_file);
 
        BitmapFile::const_iterator vit  = snippets.begin();
        BitmapFile::const_iterator vend = snippets.end();
        for (; vit != vend; ++vit) {
                if (!vit->second.empty())
-                       lyx::unlink(vit->second);
+                       unlink(vit->second);
        }
 }
 
@@ -455,7 +457,7 @@ void PreviewLoader::Impl::startLoading()
        string directory = buffer_.tmppath;
        if (directory.empty())
                directory = buffer_.filePath();
-       
+
        string const filename_base(unique_filename(directory));
 
        // Create an InProgress instance to place in the map of all
@@ -741,7 +743,7 @@ void setAscentFractions(vector<double> & ascent_fractions,
                        double const a = ascent + tp_ascent;
                        double const d = descent - tp_descent;
 
-                       if (!lyx::float_equal(a + d, 0, 0.1))
+                       if (!float_equal(a + d, 0, 0.1))
                                *it = a / (a + d);
 
                        if (++it == end)
index 468d1f65ce0249efbde5901931c2873a2f8cbea8..5a9450a2ed70e091827d7cb0e7b2d500ae26867c 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "debug.h"    // temporary
 
+using namespace lyx::support;
+
 namespace grfx {
 
 bool PreviewedInset::activated()
index 8881df2f1a2620970c5d300d14a0251654e0beb9..ce07495a3cbad06d656d11da34b0fa3dbdb6bdd6 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <map>
 
+using namespace lyx::support;
+
 namespace grfx {
 
 bool Previews::activated()
@@ -58,7 +60,7 @@ Previews::~Previews()
 
 PreviewLoader & Previews::loader(Buffer const * buffer) const
 {
-       lyx::Assert(buffer);
+       Assert(buffer);
 
        Impl::CacheType::iterator it = pimpl_->cache.find(buffer);
 
index fc260837f056e6bf9d827b4834074b5020f4ef18..3e6ccf69e09c3aa9f1ef4dafb818e27504864371 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::find;
 
index 327fcea65a5eb561c1e5371a3c96a2a7bc334cc4..d696383462ae10f054555b97be696d18dd3c51d7 100644 (file)
@@ -1,9 +1,12 @@
+2003-07-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * introduce namespace lyx::support
 
 2003-06-30  André Pönitz  <poenitz@gmx.net>
 
-       * insetcite.C (localDispatch): fix case of missing return value 
+       * insetcite.C (localDispatch): fix case of missing return value
 
-       * insetcite.C (ascii): remove unneeded temporary 
+       * insetcite.C (ascii): remove unneeded temporary
 
 2003-06-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
index bfa1e851b86d53ad6e372446f733ee52e04d0f25..45e2362ac7546216ff5dd2803ccf4f6d5a3b57e7 100644 (file)
@@ -21,6 +21,8 @@
 #include "support/LAssert.h"
 #include "support/filetools.h"
 
+using namespace lyx::support;
+
 using std::endl;
 using std::ostream;
 using std::for_each;
@@ -248,7 +250,7 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
                default:
                        lex.printError("ExternalTemplate::readTemplate: "
                                       "Wrong tag: $$Token");
-                       lyx::Assert(false);
+                       Assert(false);
                        break;
                }
        }
index 50d287d9a3d55cae96bbbf92bbbf3e4d96acbaa1..4d084c5dcaddc1cd2352c676fbeeb5836c620e28 100644 (file)
@@ -86,7 +86,7 @@ string const Inset::editMessage() const
 }
 
 
-LyXText * Inset::getLyXText(BufferView const * bv, bool const recursive) const
+LyXText * Inset::getLyXText(BufferView const * bv, bool /*recursive*/) const
 {
        if (owner())
                return owner()->getLyXText(bv, false);
index ff45c5eced180452ca01d5a30a2501cbff7bdb80..2e4165860e35cb91de686a726c891fc23c75c83f 100644 (file)
@@ -229,7 +229,7 @@ public:
        // inside them without cast!!!
        ///
        virtual LyXText * getLyXText(BufferView const *,
-                                    bool const recursive = false) const;
+                                    bool recursive = false) const;
        ///
        virtual void deleteLyXText(BufferView *, bool = true) const {}
        ///
index 0a3eabb568e04fb84116bbc81e884e262cd141d6..0ed0dc44bee4aa6ee1f51c7178af400a44eb3547 100644 (file)
@@ -20,6 +20,7 @@
 #include "support/tostr.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
 
 using std::max;
 
index 2db291500a7388b9e4086bfa2084bb3c42aac81a..ee54c840b5afce7c237dd3af48b9d1cad745b609 100644 (file)
@@ -27,6 +27,8 @@
 #include <fstream>
 #include <cstdlib>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::ifstream;
 using std::getline;
@@ -186,7 +188,7 @@ vector<string> const InsetBibtex::getFiles(Buffer const & buffer) const
 void InsetBibtex::fillWithBibKeys(Buffer const * buffer,
                                  std::vector<std::pair<string, string> > & keys) const
 {
-       lyx::Assert(buffer);
+       Assert(buffer);
        vector<string> const files = getFiles(*buffer);
        for (vector<string>::const_iterator it = files.begin();
             it != files.end(); ++ it) {
index 93a579f8c92eba098f2173b05b5b07a16c052f47..3df418448a7fd169daddac455ca77af00ab2e4e7 100644 (file)
@@ -26,6 +26,8 @@
 #include "support/LAssert.h"
 #include "support/BoostFormat.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 
@@ -85,7 +87,7 @@ void InsetCaption::draw(PainterInfo & pi, int x, int y) const
        else if (i2->lyxCode() == WRAP_CODE)
                type = static_cast<InsetWrap *>(i2)->params().type;
        else
-               lyx::Assert(0);
+               Assert(0);
 
        FloatList const & floats =
                pi.base.bv->buffer()->params.getLyXTextClass().floats();
index b883efeeab693dd30672363971b6ba2184595189..e7437b480436623e10b3a651da53316a9ba576fe 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <map>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::vector;
 using std::map;
index 9b1d4235d5d412b918be11c8f80b2a7d0bd4609c..3377fe3236961a420f6a960e04aa4ee6fb791a9c 100644 (file)
@@ -34,6 +34,8 @@
 #include "support/LAssert.h"
 #include "support/LOstream.h"
 
+using namespace lyx::support;
+
 using std::vector;
 using std::ostream;
 using std::endl;
@@ -144,7 +146,7 @@ void InsetCollapsable::draw_collapsed(PainterInfo & pi, int x, int y) const
 
 void InsetCollapsable::draw(PainterInfo & pi, int x, int y, bool inlined) const
 {
-       lyx::Assert(pi.base.bv);
+       Assert(pi.base.bv);
        cache(pi.base.bv);
 
        if (nodraw())
index 4940913e0f810a215d1b6ca8c9739236a3bff1c5..4e0e832f63b3c16c2f26453146f2b30b999cd1ad 100644 (file)
@@ -33,6 +33,7 @@
 #include "support/LAssert.h"
 #include "support/tostr.h"
 
+using namespace lyx::support;
 
 using std::ostream;
 using std::min;
index 7bd70495750288936a99b447316ffe6cb5b6a255..c6f7552cbd791e0d9df4a25e4eed5a31fca10c2b 100644 (file)
@@ -44,6 +44,8 @@
 #include <cstdio>
 #include <utility>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 
@@ -68,8 +70,8 @@ InsetExternal::Params::Params()
        : display(defaultDisplayType),
          lyxscale(defaultLyxScale)
 {
-       tempname = lyx::tempName(string(), "lyxext");
-       lyx::unlink(tempname);
+       tempname = tempName(string(), "lyxext");
+       unlink(tempname);
        // must have an extension for the converter code to work correctly.
        tempname += ".tmp";
 }
@@ -77,7 +79,7 @@ InsetExternal::Params::Params()
 
 InsetExternal::Params::~Params()
 {
-       lyx::unlink(tempname);
+       unlink(tempname);
 }
 
 
@@ -118,7 +120,7 @@ void InsetExternal::statusChanged()
        if (bv)
                bv->updateInset(this);
 }
-       
+
 
 InsetExternal::Params const & InsetExternal::params() const
 {
@@ -131,16 +133,16 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd)
        switch (cmd.action) {
 
        case LFUN_EXTERNAL_EDIT: {
-               lyx::Assert(cmd.view());
+               Assert(cmd.view());
 
                InsetExternal::Params p;
                InsetExternalMailer::string2params(cmd.argument, p);
                editExternal(p, cmd.view()->buffer());
                return DISPATCHED_NOUPDATE;
        }
-       
+
        case LFUN_INSET_MODIFY: {
-               lyx::Assert(cmd.view());
+               Assert(cmd.view());
 
                InsetExternal::Params p;
                InsetExternalMailer::string2params(cmd.argument, p);
@@ -184,7 +186,7 @@ grfx::Params get_grfx_params(InsetExternal::Params const & eparams,
        grfx::Params gparams;
 
        if (!eparams.filename.empty()) {
-               lyx::Assert(AbsolutePath(filepath));
+               Assert(AbsolutePath(filepath));
                gparams.filename = MakeAbsPath(eparams.filename, filepath);
        }
 
index cb84cd73863ca140e45accdfdb4f3f00c3954659..13145d64e22d955b62569926a09dfc657134a5e6 100644 (file)
@@ -36,6 +36,8 @@
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 
index 3a4aeee2e89dbc38d9f21ca958925ca2370fa552..578b057acf3940bf93e047d2625e9ff60a8f1477 100644 (file)
@@ -24,6 +24,8 @@
 
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 
index 23bc48e92e5e5e7e50e87da6f9723c6af16a76d5..9a60febe9f84df2efd84f9b5749bb2eecd4fe059 100644 (file)
@@ -85,6 +85,8 @@ TODO
 extern string system_tempdir;
 // set by Exporters
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 
@@ -169,7 +171,7 @@ void InsetGraphics::statusChanged()
        if (bv)
                bv->updateInset(this);
 }
-       
+
 
 dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
 {
@@ -284,8 +286,8 @@ string const InsetGraphics::createLatexOptions() const
            options << "  draft,\n";
        if (params().clip)
            options << "  clip,\n";
-       if (!lyx::float_equal(params().scale, 0.0, 0.05)) {
-               if (!lyx::float_equal(params().scale, 100.0, 0.05))
+       if (!float_equal(params().scale, 0.0, 0.05)) {
+               if (!float_equal(params().scale, 100.0, 0.05))
                        options << "  scale=" << params().scale / 100.0
                                << ",\n";
        } else {
@@ -299,7 +301,7 @@ string const InsetGraphics::createLatexOptions() const
 
        // Make sure rotation angle is not very close to zero;
        // a float can be effectively zero but not exactly zero.
-       if (!lyx::float_equal(params().rotateAngle, 0, 0.001)) {
+       if (!float_equal(params().rotateAngle, 0, 0.001)) {
            options << "  angle=" << params().rotateAngle << ",\n";
            if (!params().rotateOrigin.empty()) {
                options << "  origin=" << params().rotateOrigin[0];
@@ -361,8 +363,8 @@ string const InsetGraphics::prepareFile(Buffer const * buf,
                temp_file = MakeAbsPath(OnlyFilename(temp_file), buf->tmppath);
                lyxerr[Debug::GRAPHICS]
                        << "\ttemp_file: " << temp_file << endl;
-               if (graphic_->hasFileChanged() || !IsFileReadable(temp_file)) {
-                       bool const success = lyx::copy(orig_file, temp_file);
+               if (graphic_->hasFileChanged() || !IsFileReadable(temp_file)) {
+                       bool const success = copy(orig_file, temp_file);
                        lyxerr[Debug::GRAPHICS]
                                << "\tCopying zipped file from "
                                << orig_file << " to " << temp_file
@@ -405,14 +407,14 @@ string const InsetGraphics::prepareFile(Buffer const * buf,
                << "\tthe orig file is: " << orig_file << endl;
 
        if (lyxrc.use_tempdir) {
-               temp_file = copyFileToDir(buf->tmppath, orig_file);
+               temp_file = copyFileToDir(buf->tmppath, orig_file);
                if (temp_file.empty()) {
                        string str = bformat(_("Could not copy the file\n%1$s\n"
                                               "into the temporary directory."),
                                             orig_file);
                        Alert::error(_("Graphics display failed"), str);
                        return orig_file;
-               }
+               }
 
                if (from == to) {
                        // No conversion is needed. LaTeX can handle the
@@ -589,8 +591,8 @@ bool InsetGraphics::setParams(InsetGraphicsParams const & p)
        // Copy the new parameters.
        params_ = p;
 
-       // Update the display using the new parameters.
-       graphic_->update(params().as_grfxParams());
+       // Update the display using the new parameters.
+       graphic_->update(params().as_grfxParams());
 
        // We have changed data, report it.
        return true;
index 3f6a1b395ba4595c257dfddfbcce99565e96f5bf..53c5647d5a35a589782bc43ad4f54f9fb7a225c0 100644 (file)
@@ -26,6 +26,8 @@
 #include "lyxlex.h"
 #include "frontends/lyx_gui.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 
 
@@ -118,7 +120,7 @@ bool operator==(InsetGraphicsParams const & left,
            left.bb == right.bb &&
            left.clip == right.clip &&
 
-           lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001) &&
+           float_equal(left.rotateAngle, right.rotateAngle, 0.001) &&
            left.rotateOrigin == right.rotateOrigin &&
            left.subcaption == right.subcaption &&
            left.subcaptionText == right.subcaptionText &&
@@ -148,8 +150,8 @@ void InsetGraphicsParams::Write(ostream & os, string const & bufpath) const
                os << "\tlyxscale " << lyxscale << '\n';
        if (display != grfx::DefaultDisplay)
                os << "\tdisplay " << grfx::displayTranslator.find(display) << '\n';
-       if (!lyx::float_equal(scale, 0.0, 0.05)) {
-               if (!lyx::float_equal(scale, 100.0, 0.05))
+       if (!float_equal(scale, 0.0, 0.05)) {
+               if (!float_equal(scale, 100.0, 0.05))
                        os << "\tscale " << scale << '\n';
        } else {
                if (!width.zero())
index e3edbbab4d17103e50813fb7bc21c11364dc0c0e..ecc71f332c879956bfc98687618ad79e76278528 100644 (file)
@@ -43,6 +43,8 @@
 
 #include <cstdlib>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 using std::vector;
index 5f11669a593ed2034f2e7fbc278585b16568b0c1..cbe17213108b1b2b5c8d30cd5c437b149d00bcd7 100644 (file)
@@ -22,6 +22,8 @@
 #include "support/LOstream.h"
 #include "support/lstrings.h" //frontStrip, strip
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::vector;
 using std::pair;
index ef1f473f52d8bbf968ac1c187e00e5965f5b15ee..76223c833ddbc536a4a1bb7bcbd7e9b10034f691 100644 (file)
@@ -22,6 +22,8 @@
 #include "lyxlex.h"
 #include "metricsinfo.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 
index 22eafe7cb0aa51601210322f57d220e9ec20ee8e..14097c37de270fa80d734c262c0b1df246ddfa62 100644 (file)
@@ -29,6 +29,8 @@
 #include "support/LAssert.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 
@@ -243,7 +245,7 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os,
 {
        // How do we get the local language here??
        lyx::pos_type curr_pos = parOwner()->getPositionOfInset(this);
-       lyx::Assert(curr_pos != -1);
+       Assert(curr_pos != -1);
 
 #warning FIXME. We _must_ find another way to get the language. (Lgb)
 #if 0
index e85a1e8655c116641454bcf81e7c7e4427957def..8edc5ec140bdc678a43a80b9a5753f553d2d59cd 100644 (file)
@@ -21,6 +21,8 @@
 #include "BufferView.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 
 InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf)
index fcca099378f160cde7c9c6eea9f8985ff908f49c..5515a813311afc665a49fc57702ca2871d19a8df 100644 (file)
@@ -49,6 +49,8 @@
 //#include <signal.h>
 
 
+using namespace lyx::support;
+
 using std::vector;
 using std::ostream;
 using std::ifstream;
@@ -367,7 +369,7 @@ void InsetTabular::drawCellLines(Painter & pain, int x, int y,
 void InsetTabular::drawCellSelection(Painter & pain, int x, int y,
                                     int row, int column, int cell) const
 {
-       lyx::Assert(hasSelection());
+       Assert(hasSelection());
        int cs = tabular.column_of_cell(sel_cell_start);
        int ce = tabular.column_of_cell(sel_cell_end);
        if (cs > ce) {
@@ -2580,7 +2582,7 @@ InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
 WordLangTuple InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
 {
        // when entering this function the inset should be ALWAYS locked!
-       lyx::Assert(the_locking_inset);
+       Assert(the_locking_inset);
 
        WordLangTuple word(the_locking_inset->selectNextWordToSpellcheck(bv, value));
        if (!word.word().empty())
index 08ae69cbea35d220d1eeec89a2619d5ed727c3b6..6d67050e07ff347e9d626aa0f67267af2e75c47c 100644 (file)
@@ -71,6 +71,8 @@ using std::vector;
 using std::pair;
 using std::for_each;
 
+using namespace lyx::support;
+
 using lyx::pos_type;
 using lyx::textclass_type;
 
@@ -100,7 +102,7 @@ void InsetText::restoreLyXTextState(LyXText * t) const
                return;
 
        t->selection.set(true);
-       // at this point just to avoid the DEPM when setting the cursor 
+       // at this point just to avoid the DEPM when setting the cursor
        t->selection.mark(sstate.selection.mark());
        if (sstate.selection.set()) {
                t->setCursor(sstate.selection.start.par(),
@@ -2079,7 +2081,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
                if (recursive && the_locking_inset)
                        return the_locking_inset->getLyXText(lbv, true);
                LyXText * lt = cached_text.get();
-               lyx::Assert(lt && lt->rows().begin()->par() == const_cast<ParagraphList&>(paragraphs).begin());
+               Assert(lt && lt->rows().begin()->par() == const_cast<ParagraphList&>(paragraphs).begin());
                return lt;
        }
        // Super UGLY! (Lgb)
@@ -2095,7 +2097,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
                        resizeLyXText(do_resize);
                } else {
                        if (lt || !it->second.remove) {
-                               lyx::Assert(it->second.text.get());
+                               Assert(it->second.text.get());
                                cached_text = it->second.text;
                                if (recursive && the_locking_inset) {
                                        return the_locking_inset->getLyXText(bv, true);
@@ -2147,7 +2149,7 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
                return;
        }
 
-       lyx::Assert(it->second.text.get());
+       Assert(it->second.text.get());
 
        it->second.remove = true;
        if (recursive) {
@@ -2187,7 +2189,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
                return;
        }
 
-       lyx::Assert(it->second.text.get());
+       Assert(it->second.text.get());
 
        LyXText * t = it->second.text.get();
        saveLyXTextState(t);
@@ -2226,7 +2228,7 @@ void InsetText::reinitLyXText() const
        do_reinit = false;
        do_resize = 0;
        for (Cache::iterator it = cache.begin(); it != cache.end(); ++it) {
-               lyx::Assert(it->second.text.get());
+               Assert(it->second.text.get());
 
                LyXText * t = it->second.text.get();
                BufferView * bv = it->first;
index 16eaf04797d984fbd105cf369083590f0ec0a681..91290519d7cf8c0308d96b8765cacdbbf19d43cb 100644 (file)
@@ -21,6 +21,8 @@
 #include "support/lstrings.h"
 #include "gettext.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 
 
index 8eb06f9964eae877497711e7ff426156c50a3ddb..2a5107389f807967dbab4c03d2522f5a7c763e6c 100644 (file)
 #include "support/LAssert.h"
 #include "Lsstream.h"
 
+using namespace lyx::support;
 
 void MailInset::showDialog(BufferView * bv) const
 {
-       lyx::Assert(bv);
+       Assert(bv);
        bv->owner()->getDialogs().show(name(), inset2string(), &inset());
 }
 
 
 void MailInset::updateDialog(BufferView * bv) const
 {
-       lyx::Assert(bv);        
+       Assert(bv);
        if(bv->owner()->getDialogs().visible(name()))
                bv->owner()->getDialogs().update(name(), inset2string());
 }
index 656b7b07493bb2da0b508e4fbb2f40beedd2b981..3325cabe4ca7573788e9f85dfb8fbc13d90bbd28 100644 (file)
@@ -26,6 +26,8 @@
 #include "support/filetools.h"
 
 
+using namespace lyx::support;
+
 RenderInset::RenderInset()
 {}
 
@@ -73,7 +75,7 @@ void ButtonRenderer::update(string const & text, bool editable)
 
 void ButtonRenderer::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       lyx::Assert(mi.base.bv);
+       Assert(mi.base.bv);
 
        LyXFont font(LyXFont::ALL_SANE);
        font.decSize();
@@ -89,7 +91,7 @@ void ButtonRenderer::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void ButtonRenderer::draw(PainterInfo & pi, int x, int y) const
 {
-       lyx::Assert(pi.base.bv);
+       Assert(pi.base.bv);
        view_ = pi.base.bv->owner()->view();
 
        // Draw it as a box with the LaTeX text
@@ -129,7 +131,7 @@ void GraphicRenderer::update(grfx::Params const & params)
        params_ = params;
 
        if (!params_.filename.empty()) {
-               lyx::Assert(AbsolutePath(params_.filename));
+               Assert(AbsolutePath(params_.filename));
                loader_.reset(params_.filename, params_);
        }
 }
@@ -227,7 +229,7 @@ void GraphicRenderer::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void GraphicRenderer::draw(PainterInfo & pi, int x, int y) const
 {
-       lyx::Assert(pi.base.bv);
+       Assert(pi.base.bv);
        view_ = pi.base.bv->owner()->view();
 
 #if 0
index ec6fa2ba81464e6a406acbb7fabf416cd48bd908..b8489ad5f376a753af37713e255ad26b084a3e16 100644 (file)
@@ -22,6 +22,7 @@
 #include "lyxtext.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
 
 // some stuff for inset locking
 
index ee75bf507c6748e6eebaf4778136737e2ea4c785..b2426296e7e78d0d6db9dabaf7fec0b10e5765d5 100644 (file)
@@ -27,6 +27,8 @@
 #endif
 #include <sys/time.h>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::strcpy;
 using std::strlen;
@@ -39,14 +41,14 @@ using std::max;
 
 namespace {
 
-class LaunchIspell : public ForkedProcess {
+class LaunchIspell : public lyx::support::ForkedProcess {
 public:
        ///
        LaunchIspell(BufferParams const & p, string const & l,
                     int * in, int * out, int * err)
                : params(p), lang(l), pipein(in), pipeout(out), pipeerr(err) {}
        ///
-       virtual ForkedProcess * clone() const {
+       virtual lyx::support::ForkedProcess * clone() const {
                return new LaunchIspell(*this);
        }
        ///
index 23a75eb6ce4fe95d93acfe578524d26925b95bf4..d201945c711958cbe734f538dc5ad8cba67921ac 100644 (file)
 #include <cstdio>
 
 class BufferParams;
+namespace lyx {
+namespace support {
 class ForkedProcess;
+}
+}
 
 /// i/a spell process-based spellchecker
 class ISpell : public SpellBase {
@@ -67,7 +71,7 @@ private:
        /// spell error
        string error_;
 
-       boost::scoped_ptr<ForkedProcess> child_;
+       boost::scoped_ptr<lyx::support::ForkedProcess> child_;
 
        // vileness below ... please FIXME
        /// str ???
index 9c5449fb2d94f02fa700ad75fc32068ce1fa1ca1..effdbc6cb90874cc4ba772f2d49f5fa8983648ff 100644 (file)
@@ -20,6 +20,8 @@
 #include <iterator>
 
 
+using namespace lyx::support;
+
 using std::ifstream;
 using std::ofstream;
 using std::getline;
index 5348675679fefa664f161629588d7376afc34568..fed5d7093a2115989193359068db28c598ec6e16 100644 (file)
@@ -43,6 +43,8 @@
 #include <utility>
 #include <cerrno>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::ifstream;
 using std::copy;
@@ -238,16 +240,16 @@ int AutoSaveBuffer::generateChild()
                // anyway.
                bool failed = false;
 
-               string const tmp_ret = lyx::tempName(string(), "lyxauto");
+               string const tmp_ret = tempName(string(), "lyxauto");
                if (!tmp_ret.empty()) {
                        bv_.buffer()->writeFile(tmp_ret);
                        // assume successful write of tmp_ret
-                       if (!lyx::rename(tmp_ret, fname_)) {
+                       if (!rename(tmp_ret, fname_)) {
                                failed = true;
                                // most likely couldn't move between filesystems
                                // unless write of tmp_ret failed
                                // so remove tmp file (if it exists)
-                               lyx::unlink(tmp_ret);
+                               unlink(tmp_ret);
                        }
                } else {
                        failed = true;
index 44cd30ab063718c557bd2149a5fcb953f30f5a0d..436ec5d8087cc51ff47df46513aae1ee7e6ccace 100644 (file)
@@ -48,6 +48,8 @@
 #include <csignal>
 #include <iostream>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::endl;
 
@@ -147,7 +149,7 @@ LyX::LyX(int & argc, char * argv[])
                vector<string>::const_iterator end = files.end();
 
                for (; it != end; ++it) {
-                       // get absolute path of file and add ".lyx" to 
+                       // get absolute path of file and add ".lyx" to
                        // the filename if necessary
                        string s = FileSearch(string(), *it, "lyx");
                        if (s.empty()) {
@@ -215,7 +217,7 @@ static void error_handler(int err_sig)
        lyxerr << "Bye." << endl;
        if (err_sig!= SIGHUP &&
           (!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV))
-               lyx::abort();
+               lyx::support::abort();
        exit(0);
 }
 
@@ -224,7 +226,7 @@ static void error_handler(int err_sig)
 
 void LyX::printError(ErrorItem const & ei)
 {
-       std::cerr << _("LyX: ") << ei.error 
+       std::cerr << _("LyX: ") << ei.error
                  << ':' << ei.description << std::endl;
 
 }
@@ -454,7 +456,7 @@ void LyX::init(bool gui)
        system_lcolor = lcolor;
 
        string prefsfile = "preferences";
-       // back compatibility to lyxs < 1.1.6 
+       // back compatibility to lyxs < 1.1.6
        if (LibFileSearch(string(), prefsfile).empty())
                prefsfile = "lyxrc";
        if (!LibFileSearch(string(), prefsfile).empty())
index 91c00f72e4e80c9cb9510aee39c717373d8813d1..a28129f97e8ee43613d9779064d97f21586d32d0 100644 (file)
@@ -14,6 +14,8 @@
 #include "insets/insettext.h"
 #include "changes.h"
 
+using namespace lyx::support;
+
 using lyx::pos_type;
 using std::endl;
 
index f3247513e27c2bb409622d7af27068da3ad65629..8708fb831947c10e04464f56607ba469341fe795 100644 (file)
@@ -22,6 +22,8 @@
 #include "support/lstrings.h"
 #include "bufferparams.h" // stateText
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 
index 7a2d17d98de0e28f578f3e0f390066c188c89560..9036b814eef0d7f0879bb5a2b4a4902832c22764 100644 (file)
@@ -78,6 +78,8 @@
 #include <utility>
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::pair;
 using std::make_pair;
 using std::endl;
@@ -537,7 +539,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
                disable = !mathcursor;
                break;
 
-       case LFUN_DIALOG_SHOW: {
+       case LFUN_DIALOG_SHOW: {
                string const name = ev.getArg(0);
                if (!buf) {
                        disable = !(name == "aboutlyx" ||
@@ -1937,6 +1939,6 @@ string const LyXFunc::view_status_message()
 
 BufferView * LyXFunc::view() const
 {
-       lyx::Assert(owner);
+       Assert(owner);
        return owner->view().get();
 }
index 6f20fc49e899c015caea26e456a4817473aa7eee..fc691697f7c0abb7a19f9e020024aa32fa337f53 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::endl;
 
 //  The order of the LayoutTags enum is no more important. [asierra300396]
index c590c74c534c5a568fda0d2a23785e945ccd4bd3..e77c893b082d84d0765b039a254fcf04db86ae5b 100644 (file)
@@ -18,6 +18,8 @@
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::istream;
 using std::endl;
index 90e68b8ecdc75e8b8343293687f24263b4273646..2962302d062b789ef82297bf0839133851f5d577 100644 (file)
@@ -9,6 +9,8 @@
 
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::sort;
 using std::ostream;
 using std::ios;
index f9ec51b0dd155ede370425e5a8f6b6ea4d3a06ee..edea4b9dda5e2e924b1581f1ef59a33be80db743 100644 (file)
@@ -31,6 +31,8 @@
 #include "support/lstrings.h"
 #include "support/userinfo.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::ofstream;
 using std::cout;
@@ -260,9 +262,9 @@ void LyXRC::setDefaults() {
        preview_hashed_labels  = false;
        preview_scale_factor = 0.9;
 
-       user_name = lyx::user_name();
+       user_name = lyx::support::user_name();
 
-       user_email = lyx::user_email();
+       user_email = lyx::support::user_email();
 
        if (user_email.empty())
                user_email = _("email address unknown");
index d7044b146ff524976a148014c40cc83271d52fb3..60dcf4085aecaef148bf4c0ebfb114718b8f1fe6 100644 (file)
@@ -60,6 +60,9 @@
 #include "support/os2_errortable.h"
 #endif
 
+
+using namespace lyx::support;
+
 using std::endl;
 
 // provide an empty mkfifo() if we do not have one. This disables the
@@ -190,7 +193,7 @@ int LyXComm::startPipe(string const & filename, bool write)
        if (fd < 0) {
                lyxerr << "LyXComm: Could not open pipe " << filename << '\n'
                       << strerror(errno) << endl;
-               lyx::unlink(filename);
+               unlink(filename);
                return -1;
        }
 
@@ -231,7 +234,7 @@ void LyXComm::endPipe(int & fd, string const & filename, bool write)
 
 // OS/2 pipes are deleted automatically
 #ifndef __EMX__
-       if (lyx::unlink(filename) < 0) {
+       if (unlink(filename) < 0) {
                lyxerr << "LyXComm: Could not remove pipe " << filename
                       << '\n' << strerror(errno) << endl;
        };
index 74be61056f6621a49e60d71f612270913cabebb6..3df1271e40147b24f52fe9389a143c5a5d2380cb 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::find_if;
 using std::remove_if;
@@ -755,7 +757,7 @@ bool LyXTextClass::hasLayout(string const & n) const
 
 LyXLayout_ptr const & LyXTextClass::operator[](string const & name) const
 {
-       lyx::Assert(!name.empty());
+       Assert(!name.empty());
 
        LayoutList::const_iterator cit =
                find_if(layoutlist_.begin(),
@@ -771,7 +773,7 @@ LyXLayout_ptr const & LyXTextClass::operator[](string const & name) const
                        lyxerr  << " " << it->get()->name() << endl;
 
                // we require the name to exist
-               lyx::Assert(false);
+               Assert(false);
        }
 
        return (*cit);
index 71e7d1b23ee8609d37ada39ee83f2e60c7bc6f4e..c17bca534d3785d14a13097b593976f845323b74 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <utility>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::exit;
 #endif
index 206250061bafd120c6c8ecd965978ae3b04483cb..9f6ce7e2bb873e999c83059cde3616bd456916e7 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <unistd.h>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::pair;
 
@@ -248,7 +250,7 @@ string const LyXVC::getLogFile() const
        if (!vcs)
                return string();
 
-       string tmpf = lyx::tempName(string(), "lyxvclog");
+       string tmpf = tempName(string(), "lyxvclog");
        lyxerr[Debug::LYXVC] << "Generating logfile " << tmpf << endl;
        vcs->getLog(tmpf);
        return tmpf;
index 1b21c24b6fa5868ebe24a6d7dedaaeb00cec5971..18413bf4f7ea7bf05d60e64e8219793782faa8e7 100644 (file)
@@ -17,6 +17,8 @@
 #include <ios>
 #endif
 
+using namespace lyx::support;
+
 int main(int argc, char * argv[])
 {
 #ifdef HAVE_IOS
index d812b9cb6aab374308b3e6cd7cd592072c91d238..19b01aea3576ac15ada1ef3406e5a932999d1f93 100644 (file)
@@ -1,3 +1,7 @@
+2003-07-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * introduce namespace lyx::support
+
 2003-06-28  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * math_symbolinset.C (MathSymbolInset): fix type const order
index 9078c9ffce2552c55ea57801841d9cffd3098d44..1ad521a45eee05030e08c48d50e197fc0ce9ec2e 100644 (file)
@@ -29,6 +29,7 @@
 #include "metricsinfo.h"
 #include "math_data.h"
 #include "support/lstrings.h"
+#include "support/lyxlib.h"
 #include "frontends/LyXView.h"
 #include "frontends/font_metrics.h"
 #include "frontends/mouse_state.h"
@@ -52,6 +53,8 @@
 
 #include <fstream>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::ostream;
 using std::vector;
@@ -664,7 +667,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
                        bv->lockedInsetStoreUndo(Undo::EDIT);
                        if (argument.size() == 1)
                                result = mathcursor->interpret(argument[0]) ? DISPATCHED : FINISHED_RIGHT;
-                       else 
+                       else
                                mathcursor->insert(argument);
                }
                break;
@@ -731,7 +734,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
        mathcursor->normalize();
        mathcursor->touch();
 
-       lyx::Assert(mathcursor);
+       Assert(mathcursor);
 
        if (mathcursor->selection() || was_selection)
                toggleInsetSelection(bv);
@@ -954,7 +957,7 @@ void mathDispatch(FuncRequest const & cmd)
                        else {
                                string s = cmd.argument;
                                string const s1 = token(s, ' ', 1);
-                               int const na = s1.empty() ? 0 : lyx::atoi(s1);
+                               int const na = s1.empty() ? 0 : atoi(s1);
                                openNewInset(bv, new InsetFormulaMacro(token(s, ' ', 0), na));
                        }
                        break;
index cd27204f09f6ab50a007b1c1312baf502a92c796..da8943bacf13f298adc8d319b81fd0868df95099 100644 (file)
@@ -36,6 +36,8 @@
 #include "lyxtext.h"
 #include "Lsstream.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 
 extern MathCursor * mathcursor;
index f5250436f80c5188fb8c7ebdc6167ba6abd7131d..6d6b1f3b1424e63828a2729af40b5fa009d66752 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <config.h>
 
 #include "LString.h"
@@ -13,6 +12,8 @@
 #include <fstream>
 #include <vector>
 
+using namespace lyx::support;
+
 using std::ifstream;
 using std::istream;
 using std::ostream;
index 450d16614f6cbe7e9f3cee0d6463b72f36bdcf43..a8c143af4c74daf3b0c4e407b165a4fac2c4d188 100644 (file)
@@ -49,6 +49,8 @@
 
 //#define FILEDEBUG 1
 
+using namespace lyx::support;
+
 using std::endl;
 using std::min;
 using std::max;
@@ -836,28 +838,28 @@ bool MathCursor::hasNextAtom() const
 
 MathAtom const & MathCursor::prevAtom() const
 {
-       lyx::Assert(pos() > 0);
+       Assert(pos() > 0);
        return array()[pos() - 1];
 }
 
 
 MathAtom & MathCursor::prevAtom()
 {
-       lyx::Assert(pos() > 0);
+       Assert(pos() > 0);
        return array()[pos() - 1];
 }
 
 
 MathAtom const & MathCursor::nextAtom() const
 {
-       lyx::Assert(pos() < size());
+       Assert(pos() < size());
        return array()[pos()];
 }
 
 
 MathAtom & MathCursor::nextAtom()
 {
-       lyx::Assert(pos() < size());
+       Assert(pos() < size());
        return array()[pos()];
 }
 
@@ -923,14 +925,14 @@ void MathCursor::getSelection(CursorPos & i1, CursorPos & i2) const
 
 CursorPos & MathCursor::cursor()
 {
-       lyx::Assert(depth());
+       Assert(depth());
        return Cursor_.back();
 }
 
 
 CursorPos const & MathCursor::cursor() const
 {
-       lyx::Assert(depth());
+       Assert(depth());
        return Cursor_.back();
 }
 
index 457a2ee918c4702d5cfa4fc21f552a6c2f8759de..5857e9d4c78743a171a6b59f4e9899e7e478d88d 100644 (file)
@@ -16,6 +16,7 @@
 #include "frontends/Painter.h"
 #include "textpainter.h"
 
+using namespace lyx::support;
 
 using std::max;
 using std::min;
@@ -41,14 +42,14 @@ void MathArray::substitute(MathMacro const & m)
 
 MathAtom & MathArray::operator[](pos_type pos)
 {
-       lyx::Assert(pos < size());
+       Assert(pos < size());
        return base_type::operator[](pos);
 }
 
 
 MathAtom const & MathArray::operator[](pos_type pos) const
 {
-       lyx::Assert(pos < size());
+       Assert(pos < size());
        return base_type::operator[](pos);
 }
 
@@ -61,7 +62,7 @@ void MathArray::insert(size_type pos, MathAtom const & t)
 
 void MathArray::insert(size_type pos, MathArray const & ar)
 {
-       lyx::Assert(pos <= size());
+       Assert(pos <= size());
        base_type::insert(begin() + pos, ar.begin(), ar.end());
 }
 
index 6033db4a6c03199cbb52aab286928481c81f3015..f19f96041ac84914fd9138d772054ccfa57afcfb 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <config.h>
 
 #include "math_exfuncinset.h"
@@ -25,7 +24,7 @@ InsetBase * MathExFuncInset::clone() const
 }
 
 
-void MathExFuncInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void MathExFuncInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
 {
        mathed_string_dim(mi.base.font, name_, dim_);
 }
index 899521bdb55b2de7a98ea692e78db7f74347736f..a296dd1867311acd8b881f3d4ba111feac22e3b7 100644 (file)
@@ -30,6 +30,8 @@
 
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::istringstream;
 using std::find_if;
index c9e8312a6dca40cbdcad8c9880fc4e45670f9e47..b2a1681e9440c5213b689c4a46405aabb2305672 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <config.h>
 
 #include "math_parser.h"
 #include <map>
 #include <fstream>
 
-bool has_math_fonts;
+using namespace lyx::support;
 
 using std::endl;
 
+bool has_math_fonts;
+
 
 namespace {
 
@@ -324,4 +325,3 @@ bool createMathInset_fromDialogStr(string const & str, MathArray & ar)
 
        return ar[0].nucleus();
 }
-
index c8669f4f5013b9d5b3efdfbf86e12c62a923631c..2982a9d2682aa55b4019ed917a0da76aee8dd0aa 100644 (file)
@@ -49,7 +49,7 @@ void MathFontInset::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-void MathFontInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
+void MathFontInset::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
 {
        cell(0).metricsT(mi, dim_);
 }
index 77927933372228dfc863c0539c2149178ee3e989..7317155b6c08f39083278c6717016267eff5c6a1 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <vector>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::max;
 using std::endl;
@@ -251,7 +253,7 @@ void MathHullInset::drawT(TextPainter & pain, int x, int y) const
 string MathHullInset::label(row_type row) const
 {
        row_type n = nrows();
-       lyx::Assert(row < n);
+       Assert(row < n);
        return label_[row];
 }
 
@@ -660,8 +662,8 @@ void MathHullInset::infoize(std::ostream & os) const
 
 void MathHullInset::check() const
 {
-       lyx::Assert(nonum_.size() == nrows());
-       lyx::Assert(label_.size() == nrows());
+       Assert(nonum_.size() == nrows());
+       Assert(label_.size() == nrows());
 }
 
 
index bf207171816772bd13d4ac4560b5f2f43374269e..0ee78e844e46f0d528f7bcd94d601cff4110bf59 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <config.h>
 
 #include "math_iterator.h"
@@ -6,6 +5,7 @@
 #include "debug.h"
 #include "support/LAssert.h"
 
+using namespace lyx::support;
 
 MathIterator::MathIterator()
 {}
@@ -47,7 +47,7 @@ void MathIterator::push(MathInset * p)
 void MathIterator::pop()
 {
        //lyxerr << "pop: " << endl;
-       lyx::Assert(size());
+       Assert(size());
        pop_back();
 }
 
@@ -115,8 +115,8 @@ void MathIterator::operator++()
 void MathIterator::jump(difference_type i)
 {
        back().pos_ += i;
-       //lyx::Assert(back().pos_ >= 0);
-       lyx::Assert(back().pos_ <= cell().size());
+       //Assert(back().pos_ >= 0);
+       Assert(back().pos_ <= cell().size());
 }
 
 
index a49bfa1a248153a069c6ed92deafddb32468622b..3caa88fd68ad697a3b9f9b43baae4189e37ea3e7 100644 (file)
@@ -1,4 +1,3 @@
-
 #include "config.h"
 #include "math_pos.h"
 #include "math_inset.h"
@@ -6,6 +5,7 @@
 #include "support/LAssert.h"
 #include "support/LOstream.h"
 
+using namespace lyx::support;
 
 CursorPos::CursorPos()
        : inset_(0), idx_(0), pos_(0)
@@ -15,21 +15,21 @@ CursorPos::CursorPos()
 CursorPos::CursorPos(MathInset * p)
        : inset_(p), idx_(0), pos_(0)
 {
-       lyx::Assert(inset_);
+       Assert(inset_);
 }
 
 
 
 MathArray & CursorPos::cell(MathArray::idx_type idx) const
 {
-       lyx::Assert(inset_);
+       Assert(inset_);
        return inset_->cell(idx);
 }
 
 
 MathArray & CursorPos::cell() const
 {
-       lyx::Assert(inset_);
+       Assert(inset_);
        return inset_->cell(idx_);
 }
 
index 83d7c79896f66c722ea934fb435ffd9d781cfbef..4e4d9bfad2576b164da5ad12d25eb022f6e6788f 100644 (file)
@@ -1,4 +1,3 @@
-
 #include "math_scriptinset.h"
 #include "math_support.h"
 #include "math_symbolinset.h"
@@ -7,6 +6,7 @@
 #include "support/LAssert.h"
 #include "debug.h"
 
+using namespace lyx::support;
 
 using std::max;
 
@@ -144,14 +144,14 @@ int MathScriptInset::dy1() const
 
 int MathScriptInset::dx0() const
 {
-       lyx::Assert(hasDown());
+       Assert(hasDown());
        return hasLimits() ? (dim_.wid - down().width()) / 2 : nwid();
 }
 
 
 int MathScriptInset::dx1() const
 {
-       lyx::Assert(hasUp());
+       Assert(hasUp());
        return hasLimits() ? (dim_.wid - up().width()) / 2 : nwid();
 }
 
index 31d24f176fafcfd74584edab771701ac82bddfd8..f32053f81f61834aa5e87c1ec802a2034a811008 100644 (file)
@@ -39,7 +39,7 @@ InsetBase * MathTabularInset::clone() const
 }
 
 
-void MathTabularInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void MathTabularInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
 {
        FontSetChanger dummy(mi.base, "textnormal");
        return MathGridInset::metrics(mi);
index 18b30d06058780727e90aadb445705c1e09cb250..4302f41e658e3a24c7095d0612ff4ed3238b2a35 100644 (file)
@@ -13,6 +13,8 @@
 #include "debug.h"
 #include "support/filetools.h"
 
+using namespace lyx::support;
+
 
 #ifdef ENABLE_NLS
 
index fbedfeedc9ebcf65a828d1212cc7926d429e9d2a..b766c4fb486e0a1908198d3c931626d059676680 100644 (file)
@@ -46,6 +46,8 @@
 #include <csignal>
 #include <ctime>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
 using std::fstream;
@@ -373,14 +375,14 @@ bool Paragraph::insetAllowed(Inset::Code code)
 
 Inset * Paragraph::getInset(pos_type pos)
 {
-       lyx::Assert(pos < size());
+       Assert(pos < size());
        return insetlist.get(pos);
 }
 
 
 Inset const * Paragraph::getInset(pos_type pos) const
 {
-       lyx::Assert(pos < size());
+       Assert(pos < size());
        return insetlist.get(pos);
 }
 
@@ -389,7 +391,7 @@ Inset const * Paragraph::getInset(pos_type pos) const
 LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
                                         pos_type pos) const
 {
-       lyx::Assert(pos <= size());
+       Assert(pos <= size());
 
        Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
        Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
@@ -428,7 +430,7 @@ LyXFont const Paragraph::getFirstFontSettings() const
 LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
                                 LyXFont const & outerfont) const
 {
-       lyx::Assert(pos >= 0);
+       Assert(pos >= 0);
 
        LyXLayout_ptr const & lout = layout();
 
@@ -553,7 +555,7 @@ Paragraph::getUChar(BufferParams const & bparams, pos_type pos) const
 
 void Paragraph::setFont(pos_type pos, LyXFont const & font)
 {
-       lyx::Assert(pos <= size());
+       Assert(pos <= size());
 
        // First, reduce font against layout/label font
        // Update: The SetCharFont() routine in text2.C already
@@ -1289,14 +1291,14 @@ void Paragraph::cleanChanges()
 
 Change::Type Paragraph::lookupChange(lyx::pos_type pos) const
 {
-       lyx::Assert(!size() || pos < size());
+       Assert(!size() || pos < size());
        return pimpl_->lookupChange(pos);
 }
 
 
 Change const Paragraph::lookupChangeFull(lyx::pos_type pos) const
 {
-       lyx::Assert(!size() || pos < size());
+       Assert(!size() || pos < size());
        return pimpl_->lookupChangeFull(pos);
 }
 
index 73de67f9c20e019bf250d0e2db69204f066a607c..8c137d68688e3a76e9d89f2847cd0cd5374b1f8b 100644 (file)
@@ -36,6 +36,8 @@
 
 extern string bibitemWidest(Buffer const *);
 
+using namespace lyx::support;
+
 using lyx::pos_type;
 //using lyx::layout_type;
 using std::endl;
@@ -1007,7 +1009,7 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
                string const s = bformat(_("Unknown token: %1$s %2$s\n"),
                        token, lex.getString());
 
-               buf.parseError(ErrorItem(_("Unknown token"), s, 
+               buf.parseError(ErrorItem(_("Unknown token"), s,
                                         par.id(), 0, par.size()));
                return 1;
        }
index 75eb764983061a905a2c1af73cdc580608f7e0ae..1a253924afd2435f632cde9ea71cc2f6abb72b19 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "support/LAssert.h"
 
+using namespace lyx::support;
 using lyx::pos_type;
 using std::endl;
 using std::ostream;
@@ -170,7 +171,7 @@ Change const Paragraph::Pimpl::lookupChangeFull(pos_type pos) const
 
 void Paragraph::Pimpl::markErased()
 {
-       lyx::Assert(tracking());
+       Assert(tracking());
 
        // FIXME: we should actually remove INSERTED chars.
        // difficult because owning insettexts/tabulars need
@@ -255,7 +256,7 @@ Paragraph::value_type Paragraph::Pimpl::getChar(pos_type pos) const
        // This is in the critical path for loading!
        pos_type const siz = size();
 
-       lyx::Assert(pos <= siz);
+       Assert(pos <= siz);
 
        if (pos == siz) {
                lyxerr << "getChar() on pos " << pos << " in par id "
@@ -266,7 +267,7 @@ Paragraph::value_type Paragraph::Pimpl::getChar(pos_type pos) const
 
        return text[pos];
 #else
-       lyx::Assert(pos < size());
+       Assert(pos < size());
        return text[pos];
 #endif
 }
@@ -282,7 +283,7 @@ void Paragraph::Pimpl::setChar(pos_type pos, value_type c)
 void Paragraph::Pimpl::insertChar(pos_type pos, value_type c,
                                  LyXFont const & font, Change change)
 {
-       lyx::Assert(pos <= size());
+       Assert(pos <= size());
 
        if (tracking()) {
                changes_->record(change, pos);
@@ -319,11 +320,11 @@ void Paragraph::Pimpl::insertChar(pos_type pos, value_type c,
 void Paragraph::Pimpl::insertInset(pos_type pos,
                                   Inset * inset, LyXFont const & font, Change change)
 {
-       lyx::Assert(inset);
-       lyx::Assert(pos <= size());
+       Assert(inset);
+       Assert(pos <= size());
 
        insertChar(pos, META_INSET, font, change);
-       lyx::Assert(text[pos] == META_INSET);
+       Assert(text[pos] == META_INSET);
 
        // Add a new entry in the insetlist.
        owner_->insetlist.insert(inset, pos);
@@ -380,7 +381,7 @@ void Paragraph::Pimpl::eraseIntern(pos_type pos)
 
 bool Paragraph::Pimpl::erase(pos_type pos)
 {
-       lyx::Assert(pos < size());
+       Assert(pos < size());
 
        if (tracking()) {
                Change::Type changetype(changes_->lookup(pos));
index 832b3c1b51effd617a6b9c0978e032558bc70023..db0e3924eb7d3e9b7851d64286b5f4689fc5e346 100644 (file)
@@ -23,6 +23,8 @@ extern "C" {
 #include "pspell.h"
 #include "WordLangTuple.h"
 
+using namespace lyx::support;
+
 using std::endl;
 
 PSpell::PSpell(BufferParams const &, string const & lang)
@@ -92,14 +94,14 @@ enum PSpell::Result PSpell::check(WordLangTuple const & word)
        PspellManager * m = it->second.manager;
 
        int word_ok = pspell_manager_check(m, word.word().c_str());
-       lyx::Assert(word_ok != -1);
+       Assert(word_ok != -1);
 
        if (word_ok) {
                res = OK;
        } else {
                PspellWordList const * sugs =
                        pspell_manager_suggest(m, word.word().c_str());
-               lyx::Assert(sugs != 0);
+               Assert(sugs != 0);
                els = pspell_word_list_elements(sugs);
                if (pspell_word_list_empty(sugs))
                        res = UNKNOWN;
index 500c2293fc747793eb87fde2a73947670317a266..b43895acc15818ebd78305c8cb34ff5633711f12 100644 (file)
@@ -11,8 +11,6 @@
 
 #include <config.h>
 
-#include <algorithm>
-
 #include "frontends/Painter.h"
 #include "frontends/screen.h"
 #include "frontends/font_metrics.h"
 #include "lyxrow_funcs.h"
 #include "metricsinfo.h"
 
+#include <algorithm>
+
+using namespace lyx::support;
+
 using std::max;
 using lyx::pos_type;
 
@@ -102,7 +104,7 @@ void RowPainter::paintInset(pos_type const pos)
 {
        Inset * inset = const_cast<Inset*>(pit_->getInset(pos));
 
-       lyx::Assert(inset);
+       Assert(inset);
 
 #warning inset->update FIXME
        inset->update(perv(bv_), false);
index d279c8d563698458eb9bfb9a3b4d5d69b62063fd..b45780154b3317d934195c1b998f841b415fa401 100644 (file)
@@ -1,3 +1,6 @@
+2003-07-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * introduce namespace lyx::support
 
 2003-06-30  André Pönitz  <poenitz@gmx.net>
 
index b367db42b7bbc28a91d86f929e8083f3832bea1b..1919c9c7025ed916c7d9e29f16062a0c3833c3c1 100644 (file)
@@ -139,6 +139,9 @@ char typeLetter(mode_t i)
 } // namespace anon
 
 
+namespace lyx {
+namespace support {
+
 FileInfo::FileInfo()
 {
        init();
@@ -204,7 +207,7 @@ FileInfo & FileInfo::newFile(int fildes)
 // should not be in FileInfo
 char FileInfo::typeIndicator() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        if (S_ISDIR(buf_.st_mode))
                return '/';
 #ifdef S_ISLNK
@@ -227,7 +230,7 @@ char FileInfo::typeIndicator() const
 
 mode_t FileInfo::getMode() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return buf_.st_mode;
 }
 
@@ -235,7 +238,7 @@ mode_t FileInfo::getMode() const
 // should not be in FileInfo
 string FileInfo::modeString() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        char str[11];
        str[0] = typeLetter(buf_.st_mode);
        flagRWX((buf_.st_mode & 0700) << 0, &str[1]);
@@ -250,49 +253,49 @@ string FileInfo::modeString() const
 
 time_t FileInfo::getModificationTime() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return buf_.st_mtime;
 }
 
 
 time_t FileInfo::getAccessTime() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return buf_.st_atime;
 }
 
 
 time_t FileInfo::getStatusChangeTime() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return buf_.st_ctime;
 }
 
 
 nlink_t FileInfo::getNumberOfLinks() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return buf_.st_nlink;
 }
 
 
 uid_t FileInfo::getUid() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return buf_.st_uid;
 }
 
 
 gid_t FileInfo::getGid() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return buf_.st_gid;
 }
 
 
 off_t FileInfo::getSize() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return buf_.st_size;
 }
 
@@ -311,49 +314,49 @@ bool FileInfo::isOK() const
 
 bool FileInfo::isLink() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return S_ISLNK(buf_.st_mode);
 }
 
 
 bool FileInfo::isRegular() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return S_ISREG(buf_.st_mode);
 }
 
 
 bool FileInfo::isDir() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return S_ISDIR(buf_.st_mode);
 }
 
 
 bool FileInfo::isChar() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return S_ISCHR(buf_.st_mode);
 }
 
 
 bool FileInfo::isBlock() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return S_ISBLK(buf_.st_mode);
 }
 
 
 bool FileInfo::isFifo() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
        return S_ISFIFO(buf_.st_mode);
 }
 
 
 bool FileInfo::isSocket() const
 {
-       lyx::Assert(isOK());
+       Assert(isOK());
 #ifdef S_ISSOCK
        return S_ISSOCK(buf_.st_mode);
 #else
@@ -373,3 +376,6 @@ bool FileInfo::access(int p) const
        // the file access failed.
        return ::access(fname_.c_str(), p) == 0;
 }
+
+} // namespace support
+} // namespace lyx
index 9babae989f821b56311741d97c62059ac94b4462..39551567a56773d2d796d9475c556ccbaad6b87f 100644 (file)
@@ -20,6 +20,9 @@
 #include <boost/utility.hpp>
 #include "LString.h"
 
+namespace lyx {
+namespace support {
+
 /** Use objects of this class to get information about files.
  *
  * Users must make sure to check fi.isOK() before any operations
@@ -135,4 +138,7 @@ private:
        string fname_;
 };
 
+} // namespace support
+} // namespace lyx
+
 #endif
index 6ab2a18e2aade01a930bff4b45971fa2b89d64f2..c96b4e6233dfe8c4f6675b295749d5ef67b8de6c 100644 (file)
@@ -20,6 +20,9 @@
 #include <boost/bind.hpp>
 #include <boost/signals/trackable.hpp>
 
+namespace lyx {
+namespace support {
+
 struct FileMonitor::Impl : public boost::signals::trackable {
 
        ///
@@ -87,7 +90,7 @@ void FileMonitor::start() const
                return;
 
        pimpl_->timestamp_ = finfo.getModificationTime();
-       pimpl_->checksum_ = lyx::sum(pimpl_->filename_);
+       pimpl_->checksum_ = sum(pimpl_->filename_);
 
        if (pimpl_->timestamp_ && pimpl_->checksum_) {
                pimpl_->timer_.start();
@@ -117,7 +120,7 @@ unsigned long FileMonitor::checksum() const
        // If we aren't actively monitoring the file, then recompute the
        // checksum explicitly.
        if (!pimpl_->timer_.running() && !pimpl_->filename_.empty())
-               return lyx::sum(pimpl_->filename_);
+               return sum(pimpl_->filename_);
 
        return pimpl_->checksum_;
 }
@@ -160,7 +163,7 @@ void FileMonitor::Impl::monitorFile()
                if (new_timestamp != timestamp_) {
                        timestamp_ = new_timestamp;
 
-                       unsigned long const new_checksum = lyx::sum(filename_);
+                       unsigned long const new_checksum = sum(filename_);
                        if (new_checksum != checksum_) {
                                checksum_ = new_checksum;
                                changed = true;
@@ -172,3 +175,6 @@ void FileMonitor::Impl::monitorFile()
        if (changed)
                fileChanged_();
 }
+
+} // namespace support
+} // namespace lyx
index de9e9068e1febee240a000f6c376f21f09055ea4..809403ad88c529d02c11a08179257ee5adcceced 100644 (file)
@@ -21,6 +21,9 @@
 #include <boost/scoped_ptr.hpp>
 #include <boost/signals/signal0.hpp>
 
+namespace lyx {
+namespace support {
+
 class FileMonitor : boost::noncopyable {
 public:
        /** Once monitoring begins, the file will be monitored every
@@ -63,4 +66,7 @@ private:
        boost::scoped_ptr<Impl> const pimpl_;
 };
 
+} // namespace support
+} // namespace lyx
+
 #endif // FILEMONITOR_H
index 980a1aa6101c3451bec3919b2f0be87b19623ffa..30248b0807156ce76bd575eee5c95cd481a0961f 100644 (file)
 #include <config.h>
 
 #include "LAssert.h"
+#include "support/lyxlib.h"
 
 #ifdef ENABLE_ASSERTIONS
 #include "lyx_main.h"
 
-void emergencyCleanup() {
+namespace lyx {
+namespace support {
+
+namespace {
+
+void emergencyCleanup()
+{
        static bool didCleanup;
        if (didCleanup)
                return;
@@ -25,4 +32,17 @@ void emergencyCleanup() {
        LyX::emergencyCleanup();
 }
 
+} // namespace anon
+
+void Assert(bool assertion)
+{
+       if (!assertion) {
+               emergencyCleanup();
+               lyx::support::abort();
+       }
+}
+
+} // namespace support
+} // namespace lyx
+
 #endif
index 73ad96b7cf3ed7ac7c2ae8db5f14f02814d17b9b..e791820285f738463b14b693caa78cf12e6094c2 100644 (file)
@@ -4,7 +4,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS
  */
 #ifndef LASSERT_H
 #define LASSERT_H
 
-#include "support/lyxlib.h"
-
-extern void emergencyCleanup();
-
 namespace lyx {
+namespace support {
 
 #ifdef ENABLE_ASSERTIONS
 
@@ -25,27 +22,19 @@ namespace lyx {
     we run #emergencyCleanup()# and then #lyx::abort".
     @param assertion this should evaluate to true unless you want an abort.
 */
-template<class A>
-inline
-void Assert(A assertion)
-{
-       if (!assertion) {
-               ::emergencyCleanup();
-               lyx::abort();
-       }
-}
+void Assert(bool assertion);
 
 #else
 
 /** Dummy assertion.
     When compiling without assertions we use this no-op function.
 */
-template<class A>
 inline
-void Assert(A /*assertion*/) {}
+void Assert(bool /*assertion*/) {}
 
 #endif /* ENABLE_ASSERTIONS */
 
-} // end of namespace LyX
+} // namespace support
+} // namespace lyx
 
 #endif /* LASSERT_H */
index 13623091851a92a8dca448bcf27e0892480ed46c..588107e20254515157dd6ef4d9cc5274ed79945a 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "support/lyxlib.h"
 
-void lyx::abort()
+void lyx::support::abort()
 {
        ::abort();
 }
index 69d759d8e0ca75d84cb05044f9b0039c4b038078..be53d9afda69220476a894f55cd3d8b61a26ca2b 100644 (file)
@@ -19,7 +19,7 @@
 using std::atoi;
 #endif
 
-int lyx::atoi(string const & nstr)
+int lyx::support::atoi(string const & nstr)
 {
        return ::atoi(nstr.c_str());
 }
index e87552c12caf6a50d2968584554e38d008e73075..7005ef1b66ef8a28a16821456ced5def3dc68c01 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "support/lyxlib.h"
 
-int lyx::chdir(string const & name)
+int lyx::support::chdir(string const & name)
 {
 #ifndef __EMX__
        return ::chdir(name.c_str());
index 98ddc399a3177e04f500f06bcc73fbdea392176d..f1b32f8c2363327dc79a56bde878475a73b3bc09 100644 (file)
@@ -19,7 +19,7 @@ using std::ifstream;
 using std::ofstream;
 using std::ios;
 
-bool lyx::copy(string const & from, string const & to)
+bool lyx::support::copy(string const & from, string const & to)
 {
        ifstream ifs(from.c_str());
        if (!ifs)
index e27ef022bf57d797b2e52392148eb20d4cc49f34..ed1875f482a9ce08eb15ac3d81e22ee2047e54cf 100644 (file)
@@ -83,6 +83,8 @@ extern string system_lyxdir;
 extern string build_lyxdir;
 extern string user_lyxdir;
 
+namespace lyx {
+namespace support {
 
 bool IsLyXFilename(string const & filename)
 {
@@ -158,12 +160,12 @@ bool IsDirWriteable(string const & path)
 {
        lyxerr[Debug::FILES] << "IsDirWriteable: " << path << endl;
 
-       string const tmpfl(lyx::tempName(path, "lyxwritetest"));
+       string const tmpfl(tempName(path, "lyxwritetest"));
 
        if (tmpfl.empty())
                return false;
 
-       lyx::unlink(tmpfl);
+       unlink(tmpfl);
        return true;
 }
 
@@ -430,7 +432,7 @@ int DeleteAllFilesInDir(string const & path)
                FileInfo fi(unlinkpath);
                if (fi.isOK() && fi.isDir())
                        deleted = (DeleteAllFilesInDir(unlinkpath) == 0);
-               deleted &= (lyx::unlink(unlinkpath) == 0);
+               deleted &= (unlink(unlinkpath) == 0);
                if (!deleted)
                        return_value = -1;
        }
@@ -445,14 +447,14 @@ string const CreateTmpDir(string const & tempdir, string const & mask)
                << "CreateTmpDir: tempdir=`" << tempdir << "'\n"
                << "CreateTmpDir:    mask=`" << mask << '\'' << endl;
 
-       string const tmpfl(lyx::tempName(tempdir, mask));
+       string const tmpfl(tempName(tempdir, mask));
        // lyx::tempName actually creates a file to make sure that it
        // stays unique. So we have to delete it before we can create
        // a dir with the same name. Note also that we are not thread
        // safe because of the gap between unlink and mkdir. (Lgb)
-       lyx::unlink(tmpfl.c_str());
+       unlink(tmpfl);
 
-       if (tmpfl.empty() || lyx::mkdir(tmpfl, 0700))
+       if (tmpfl.empty() || mkdir(tmpfl, 0700))
                return string();
 
        return MakeAbsPath(tmpfl);
@@ -469,7 +471,7 @@ int destroyDir(string const & tmpdir)
        if (DeleteAllFilesInDir(tmpdir))
                return -1;
 
-       if (lyx::rmdir(tmpdir))
+       if (rmdir(tmpdir))
                return -1;
 
        return 0;
@@ -484,7 +486,7 @@ string const CreateBufferTmpDir(string const & pathfor)
        // In fact I wrote this code to circumvent a problematic behaviour (bug?)
        // of EMX mkstemp().
        string const tmpfl = tmpdir + "/lyx_tmpbuf" + tostr(count++);
-       if (lyx::mkdir(tmpfl, 0777)) {
+       if (mkdir(tmpfl, 0777)) {
                return string();
        }
        return tmpfl;
@@ -494,7 +496,7 @@ string const CreateBufferTmpDir(string const & pathfor)
 string const CreateLyXTmpDir(string const & deflt)
 {
        if ((!deflt.empty()) && (deflt  != "/tmp")) {
-               if (lyx::mkdir(deflt, 0777)) {
+               if (mkdir(deflt, 0777)) {
 #ifdef __EMX__
                Path p(user_lyxdir);
 #endif
@@ -514,9 +516,9 @@ bool createDirectory(string const & path, int permission)
 {
        string temp(rtrim(os::slashify_path(path), "/"));
 
-       lyx::Assert(!temp.empty());
+       Assert(!temp.empty());
 
-       if (lyx::mkdir(temp, permission))
+       if (mkdir(temp, permission))
                return false;
 
        return true;
@@ -556,7 +558,7 @@ string const MakeAbsPath(string const & RelPath, string const & BasePath)
        if (os::is_absolute_path(BasePath))
                TempBase = BasePath;
        else
-               TempBase = AddPath(lyx::getcwd(), BasePath);
+               TempBase = AddPath(getcwd(), BasePath);
 
        // Handle /./ at the end of the path
        while (suffixIs(TempBase, "/./"))
@@ -661,7 +663,7 @@ string const ExpandPath(string const & path)
        RTemp = split(RTemp, Temp, '/');
 
        if (Temp == ".") {
-               return lyx::getcwd() /*GetCWD()*/ + '/' + RTemp;
+               return getcwd() + '/' + RTemp;
        }
        if (Temp == "~") {
                return GetEnvPath("HOME") + '/' + RTemp;
@@ -1137,7 +1139,7 @@ bool zippedFile(string const & name)
 string const unzipFile(string const & zipped_file)
 {
        string const file = ChangeExtension(zipped_file, string());
-       string  const tempfile = lyx::tempName(string(), file);
+       string  const tempfile = tempName(string(), file);
        // Run gunzip
        string const command = "gunzip -c " + zipped_file + " > " + tempfile;
        Systemcall one;
@@ -1284,7 +1286,7 @@ void removeAutosaveFile(string const & filename)
        a += '#';
        FileInfo const fileinfo(a);
        if (fileinfo.exist())
-               lyx::unlink(a);
+               unlink(a);
 }
 
 
@@ -1293,8 +1295,9 @@ void readBB_lyxerrMessage(string const & file, bool & zipped,
 {
        lyxerr[Debug::GRAPHICS] << "[readBB_from_PSFile] "
                << message << std::endl;
+#warning Why is this func deleting a file? (Lgb)
        if (zipped)
-               lyx::unlink(file);
+               unlink(file);
 }
 
 
@@ -1334,7 +1337,7 @@ string const readBB_from_PSFile(string const & file)
 
 string const copyFileToDir(string const & path, string const & file_in)
 {
-       lyx::Assert(AbsolutePath(path));
+       Assert(AbsolutePath(path));
 
        // First, make the file path relative to path.
        string file_out = MakeRelPath(path, NormalizePath(file_in));
@@ -1365,8 +1368,11 @@ string const copyFileToDir(string const & path, string const & file_in)
                if (!fi2.exist() ||
                    difftime(fi.getModificationTime(),
                             fi2.getModificationTime()) >= 0)
-                       success = lyx::copy(file_in, file_out);
+                       success = copy(file_in, file_out);
        }
 
        return success ? file_out : string();
 }
+
+} //namespace support
+} // namespace lyx
index 6dd1530ebf2c1bdfead9ed9064692a106a60023f..709d5e256f0ec33483da098fcad58e12902a75f3 100644 (file)
@@ -18,6 +18,9 @@
 #include "os.h"
 
 
+namespace lyx {
+namespace support {
+
 /// remove directory and all contents, returns 0 on success
 int destroyDir(string const & tmpdir);
 
@@ -220,4 +223,7 @@ typedef std::pair<int, string> cmd_ret;
 
 cmd_ret const RunCommand(string const & cmd);
 
+} // namespace support
+} // namespace lyx
+
 #endif
index a5e281cd9760f87dba1b5c47c8147c82582edf84..4853e4c21a2f4f589e09d6903396e0347f46c3a4 100644 (file)
@@ -48,6 +48,9 @@ using std::endl;
 using std::strerror;
 #endif
 
+namespace lyx {
+namespace support {
+
 
 namespace {
 
@@ -59,7 +62,7 @@ public:
                if (secs > 0) {
                        new Murder(secs, pid);
                } else if (pid != 0) {
-                       lyx::kill(pid, SIGKILL);
+                       lyx::support::kill(pid, SIGKILL);
                }
        }
 
@@ -67,7 +70,7 @@ public:
        void kill()
        {
                if (pid_ != 0) {
-                       lyx::kill(pid_, SIGKILL);
+                       lyx::support::kill(pid_, SIGKILL);
                }
                lyxerr << "Killed " << pid_ << std::endl;
                delete this;
@@ -175,7 +178,7 @@ void ForkedProcess::kill(int tol)
                Murder::killItDead(0, pid());
 
        } else {
-               int ret = lyx::kill(pid(), SIGHUP);
+               int ret = lyx::support::kill(pid(), SIGHUP);
 
                // The process is already dead if wait_for_death is false
                bool const wait_for_death = (ret == 0 && errno != ESRCH);
@@ -299,3 +302,6 @@ int Forkedcall::generateChild()
 
        return cpid;
 }
+
+} // namespace support
+} // namespace lyx
index d053af31168392dca72ba032781d9343207ebd9a..8da1a40cf838e1e5efa279901fcd73308b83616a 100644 (file)
@@ -34,6 +34,9 @@
 
 #include <sys/types.h>
 
+namespace lyx {
+namespace support {
+
 class ForkedProcess {
 public:
        ///
@@ -164,4 +167,7 @@ private:
        virtual int generateChild();
 };
 
+} // namespace support
+} // namespace lyx
+
 #endif // FORKEDCALL_H
index fe9606772a399844786a079b283fbece8e462663..0e49713da4a627354b0e02a5e161bde3db191921 100644 (file)
@@ -20,6 +20,9 @@
 using std::endl;
 using std::queue;
 
+namespace lyx {
+namespace support {
+
 ForkedCallQueue & ForkedCallQueue::get()
 {
        static ForkedCallQueue singleton;
@@ -90,3 +93,6 @@ bool ForkedCallQueue::running() const
 {
        return running_ ;
 }
+
+} // namespace support
+} // namespace lyx
index 817d7bb8731e963fdb3f91e2a87cf5e19ed64d99..87a609f043d7761337955446aa08ace994e6bbd2 100644 (file)
@@ -5,14 +5,14 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Alfredo Braunstein (based on an idea from Angus Leeming)
- * 
+ *
  * Full author contact details are available in file CREDITS
- * 
- * This class implements a queue of forked processes. In order not to 
- * hose the system with multiple processes running simultaneously, you can 
- * request the addition of your process to this queue and it will be  
+ *
+ * This class implements a queue of forked processes. In order not to
+ * hose the system with multiple processes running simultaneously, you can
+ * request the addition of your process to this queue and it will be
  * executed when its turn comes.
- * 
+ *
  */
 
 #ifndef FORKEDCALLQUEUE_H
@@ -24,6 +24,9 @@
 #include <utility>
 #include "LString.h"
 
+namespace lyx {
+namespace support {
+
 class ForkedCallQueue {
 public:
        /// A process in the queue
@@ -41,11 +44,11 @@ public:
 
 private:
 
-       /** this class is a singleton class... use 
+       /** this class is a singleton class... use
         *  ForkedCallQueue::get() instead
         */
        ForkedCallQueue();
-       /// in-progress queue 
+       /// in-progress queue
        std::queue<Process> callQueue_;
        ///
        bool running_;
@@ -59,4 +62,7 @@ private:
        void callback(pid_t, int);
 };
 
+} // namespace support
+} // namespace lyx
+
 #endif // FORKEDCALLQUEUE_H
index 8ed0035d9eaa9558325c43338aa62cfe459224e4..c11daa5669c24d82cee2ab9d88c22f8ef7f596d9 100644 (file)
@@ -36,6 +36,9 @@ using std::find_if;
 using std::strerror;
 #endif
 
+namespace lyx {
+namespace support {
+
 // Ensure, that only one controller exists inside process
 ForkedcallsController & ForkedcallsController::get()
 {
@@ -206,3 +209,6 @@ void ForkedcallsController::kill(pid_t pid, int tolerance)
                timeout_->stop();
        }
 }
+
+} // namespace support
+} // namespace lyx
index 88ac92a2d129029ff9d09607af38f11b8a754114..bc98f0605a3aea0ef800e15ffa73181309d4ddcc 100644 (file)
 #include <list>
 #include <vector>
 
-class ForkedProcess;
 class Timeout;
 
+namespace lyx {
+namespace support {
+
+class ForkedProcess;
+
 class ForkedcallsController : public boost::signals::trackable {
 public:
        /// We need this to avoid warnings.
@@ -81,4 +85,7 @@ private:
        Timeout * timeout_;
 };
 
+} // namespace support
+} // namespace lyx
+
 #endif // FORKEDCONTR_H
index 305c8107b9bd5ad74ede6259549c92dc9457879b..02146930051f14fb1e8fa53f70bfc25092e0478c 100644 (file)
@@ -31,7 +31,7 @@ char * l_getcwd(char * buffer, size_t size)
 
 
 // Returns current working directory
-string const lyx::getcwd()
+string const lyx::support::getcwd()
 {
        int n = 256;    // Assume path is less than 256 chars
        char * err;
index b307d28d536d7899f8793557659fe621ac3bf574..d1b23767116111c188dffb471d8c0aeff2d8e2a4 100644 (file)
@@ -15,7 +15,7 @@
 #include <sys/types.h>
 #include <csignal>
 
-int lyx::kill(int pid, int sig)
+int lyx::support::kill(int pid, int sig)
 {
        return ::kill(pid, sig);
 }
index fbb5b0001360e4d5d59a74ae59f692ced31426cd..e464daf2ac5598fc6f1c74a5781b1069105c97a3 100644 (file)
@@ -17,6 +17,7 @@
 #include "Lsstream.h"
 #include "debug.h"
 #include "BoostFormat.h"
+#include "lyxlib.h"
 
 #include <boost/regex.hpp>
 #include <boost/tokenizer.hpp>
@@ -38,6 +39,8 @@ using std::tolower;
 using std::toupper;
 #endif
 
+namespace lyx {
+namespace support {
 
 int compare_no_case(string const & s, string const & s2)
 {
@@ -156,7 +159,7 @@ int strToInt(string const & str)
                // Remove leading and trailing white space chars.
                string const tmpstr = trim(str);
                // Do the conversion proper.
-               return lyx::atoi(tmpstr);
+               return atoi(tmpstr);
        } else {
                return 0;
        }
@@ -169,7 +172,7 @@ unsigned int strToUnsignedInt(string const & str)
                // Remove leading and trailing white space chars.
                string const tmpstr = trim(str);
                // Do the conversion proper.
-               return lyx::atoi(tmpstr);
+               return atoi(tmpstr);
        } else {
                return 0;
        }
@@ -430,7 +433,7 @@ string const subst(string const & a,
 
 string const trim(string const & a, char const * p)
 {
-       lyx::Assert(p);
+       Assert(p);
 
        if (a.empty() || !*p)
                return a;
@@ -448,7 +451,7 @@ string const trim(string const & a, char const * p)
 
 string const rtrim(string const & a, char const * p)
 {
-       lyx::Assert(p);
+       Assert(p);
 
        if (a.empty() || !*p)
                return a;
@@ -465,7 +468,7 @@ string const rtrim(string const & a, char const * p)
 
 string const ltrim(string const & a, char const * p)
 {
-       lyx::Assert(p);
+       Assert(p);
 
        if (a.empty() || !*p)
                return a;
@@ -652,7 +655,7 @@ string bformat(string const & fmt, string const & arg1, string const & arg2,
 
 string bformat(string const & fmt, string const & arg1)
 {
-       lyx::Assert(contains(fmt, "%1$s"));
+       Assert(contains(fmt, "%1$s"));
        string const str = subst(fmt, "%1$s", arg1);
        return subst(str, "%%", "%");
 }
@@ -660,8 +663,8 @@ string bformat(string const & fmt, string const & arg1)
 
 string bformat(string const & fmt, string const & arg1, string const & arg2)
 {
-       lyx::Assert(contains(fmt, "%1$s"));
-       lyx::Assert(contains(fmt, "%2$s"));
+       Assert(contains(fmt, "%1$s"));
+       Assert(contains(fmt, "%2$s"));
        string str = subst(fmt, "%1$s", arg1);
        str = subst(str, "%2$s", arg2);
        return subst(str, "%%", "%");
@@ -671,9 +674,9 @@ string bformat(string const & fmt, string const & arg1, string const & arg2)
 string bformat(string const & fmt, string const & arg1, string const & arg2,
        string const & arg3)
 {
-       lyx::Assert(contains(fmt, "%1$s"));
-       lyx::Assert(contains(fmt, "%2$s"));
-       lyx::Assert(contains(fmt, "%3$s"));
+       Assert(contains(fmt, "%1$s"));
+       Assert(contains(fmt, "%2$s"));
+       Assert(contains(fmt, "%3$s"));
        string str = subst(fmt, "%1$s", arg1);
        str = subst(str, "%2$s", arg2);
        str = subst(str, "%3$s", arg3);
@@ -684,10 +687,10 @@ string bformat(string const & fmt, string const & arg1, string const & arg2,
 string bformat(string const & fmt, string const & arg1, string const & arg2,
        string const & arg3, string const & arg4)
 {
-       lyx::Assert(contains(fmt, "%1$s"));
-       lyx::Assert(contains(fmt, "%2$s"));
-       lyx::Assert(contains(fmt, "%3$s"));
-       lyx::Assert(contains(fmt, "%4$s"));
+       Assert(contains(fmt, "%1$s"));
+       Assert(contains(fmt, "%2$s"));
+       Assert(contains(fmt, "%3$s"));
+       Assert(contains(fmt, "%4$s"));
        string str = subst(fmt, "%1$s", arg1);
        str = subst(str, "%2$s", arg2);
        str = subst(str, "%3$s", arg3);
@@ -713,3 +716,6 @@ string bformat(string const & fmt, string const & arg1, string const & arg2,
 }
 
 #endif
+
+} // namespace support
+} // namespace lyx
index 771cba3d6fb3307f29eb412a983330ce9a3b3ac3..254337d37672a881a350770fec34fa963e2f9315 100644 (file)
@@ -20,6 +20,9 @@
 
 #include "LString.h"
 
+namespace lyx {
+namespace support {
+
 ///
 int compare_no_case(string const & s, string const & s2);
 
@@ -210,4 +213,7 @@ string bformat(string const & fmt, string const & arg1, string const & arg2,
 string bformat(string const & fmt, string const & arg1, string const & arg2,
                string const & arg3, string const & arg4);
 
+} // namespace support
+} // namespace lyx
+
 #endif
index b515f55670253a4a0525b82b559425610f26f13c..ed702d357ba2ef97ebece9b24693ecd14f418413 100644 (file)
@@ -18,6 +18,7 @@
 #include "LString.h"
 
 namespace lyx {
+namespace support {
 
 /// get the current working directory
 string const getcwd();
@@ -64,6 +65,7 @@ inline bool float_equal(float var, float number, float error)
        return (number - error <= var && var <= number + error);
 }
 
+} // namespace support
 } // namespace lyx
 
 #endif /* LYX_LIB_H */
index 2b3db8007575595ed08b0b6584321c557b232cda..322cb39032c0e1d5435d821cf0a7e2a2698292f6 100644 (file)
 #endif
 
 #include "lyxstring.h"
-#include <cstdlib>
-#include <cctype>
-#include <algorithm>
 
 #include "LAssert.h"
 
 #include "debug.h"
 
+#include <iostream>
+#include <cstdlib>
+#include <cctype>
+#include <algorithm>
+
 using std::min;
 using std::istream;
 using std::ostream;
@@ -59,12 +61,15 @@ using std::ostream;
 
 // Lgb.
 
+namespace lyx {
+
+using support::Assert;
 
 ///////////////////////////////////////
 // The internal string representation
 ///////////////////////////////////////
 
-struct lyxstring::Srep {
+struct string::Srep {
        /// size
        size_t sz;
        /// Reference count
@@ -72,12 +77,12 @@ struct lyxstring::Srep {
        /// The total amount of data reserved for this representaion
        size_t res;
        /// Data. At least 1 char for trailing null.
-       lyxstring::value_type * s;
+       string::value_type * s;
 
        ///
-       Srep(lyxstring::size_type nsz, const lyxstring::value_type * p);
+       Srep(string::size_type nsz, const string::value_type * p);
        ///
-       Srep(lyxstring::size_type nsz, lyxstring::value_type ch);
+       Srep(string::size_type nsz, string::value_type ch);
        ///
        ~Srep() { delete[] s; }
        ///
@@ -88,34 +93,34 @@ struct lyxstring::Srep {
        }
 
        ///
-       void assign(lyxstring::size_type nsz, const lyxstring::value_type * p);
+       void assign(string::size_type nsz, const string::value_type * p);
        ///
-       void assign(lyxstring::size_type nsz, lyxstring::value_type ch);
+       void assign(string::size_type nsz, string::value_type ch);
        ///
-       void append(lyxstring::size_type asz, const lyxstring::value_type * p);
+       void append(string::size_type asz, const string::value_type * p);
        ///
-       void push_back(lyxstring::value_type c);
+       void push_back(string::value_type c);
        ///
-       void insert(lyxstring::size_type pos,
-                   const lyxstring::value_type * p,
-                   lyxstring::size_type n);
+       void insert(string::size_type pos,
+                   const string::value_type * p,
+                   string::size_type n);
        ///
-       void resize(lyxstring::size_type n, lyxstring::value_type c);
+       void resize(string::size_type n, string::value_type c);
        ///
-       void reserve(lyxstring::size_type res_arg);
+       void reserve(string::size_type res_arg);
        ///
-       void replace(lyxstring::size_type i, lyxstring::size_type n,
-                    lyxstring::value_type const * p, lyxstring::size_type n2);
+       void replace(string::size_type i, string::size_type n,
+                    string::value_type const * p, string::size_type n2);
 private:
        Srep(const Srep &);
        Srep & operator=(const Srep &);
 };
 
 
-lyxstring::Srep::Srep(lyxstring::size_type nsz, const value_type * p)
+string::Srep::Srep(string::size_type nsz, const value_type * p)
 {
        // can be called with p == 0 by
-       // lyxstring::assign(const value_type *, size_type)
+       // string::assign(const value_type *, size_type)
 
        sz = nsz;
        ref = 1;
@@ -132,7 +137,7 @@ lyxstring::Srep::Srep(lyxstring::size_type nsz, const value_type * p)
 }
 
 
-lyxstring::Srep::Srep(lyxstring::size_type nsz, value_type ch)
+string::Srep::Srep(string::size_type nsz, value_type ch)
 {
        sz = nsz;
        ref = 1;
@@ -140,17 +145,17 @@ lyxstring::Srep::Srep(lyxstring::size_type nsz, value_type ch)
        s = new value_type[res + 1]; // add space for terminator
        memset(s, ch, sz);
        if (!ch) {
-               // if ch == '\0' strlen(lyxstring.c_str()) == 0 so sz = 0
+               // if ch == '\0' strlen(string.c_str()) == 0 so sz = 0
                // allows for large but empty string
                sz = 0;
        }
 }
 
 
-void lyxstring::Srep::assign(lyxstring::size_type nsz, const value_type * p)
+void string::Srep::assign(string::size_type nsz, const value_type * p)
 {
        // can be called with p == 0
-       // by lyxstring::assign(const value_type *, size_type)
+       // by string::assign(const value_type *, size_type)
 
        if (res < nsz) {
                delete[] s;
@@ -171,7 +176,7 @@ void lyxstring::Srep::assign(lyxstring::size_type nsz, const value_type * p)
 }
 
 
-void lyxstring::Srep::assign(lyxstring::size_type nsz, value_type ch)
+void string::Srep::assign(string::size_type nsz, value_type ch)
 {
        sz = nsz;
        if (res < nsz) {
@@ -181,14 +186,14 @@ void lyxstring::Srep::assign(lyxstring::size_type nsz, value_type ch)
        }
        memset(s, ch, sz);
        if (!ch) {
-               // if ch == '\0' strlen(lyxstring.c_str()) == 0 so sz = 0
+               // if ch == '\0' strlen(string.c_str()) == 0 so sz = 0
                // allows for a large empty string
                sz = 0;
        }
 }
 
 
-void lyxstring::Srep::append(lyxstring::size_type asz, const value_type * p)
+void string::Srep::append(string::size_type asz, const value_type * p)
 {
        register unsigned int const len = sz + asz;
        if (res < len) {
@@ -208,7 +213,7 @@ void lyxstring::Srep::append(lyxstring::size_type asz, const value_type * p)
 }
 
 
-void lyxstring::Srep::push_back(value_type c)
+void string::Srep::push_back(value_type c)
 {
        s[sz] = c; // it is always room to put a value_type at the end
        ++sz;
@@ -224,8 +229,8 @@ void lyxstring::Srep::push_back(value_type c)
 }
 
 
-void lyxstring::Srep::insert(lyxstring::size_type pos, const value_type * p,
-                            lyxstring::size_type n)
+void string::Srep::insert(string::size_type pos, const value_type * p,
+                            string::size_type n)
 {
        if (res < n + sz) {
                do {
@@ -246,7 +251,7 @@ void lyxstring::Srep::insert(lyxstring::size_type pos, const value_type * p,
 }
 
 
-void lyxstring::Srep::resize(size_type n, value_type c)
+void string::Srep::resize(size_type n, value_type c)
 {
        // This resets sz to res_arg
        res = min(n, npos - 2); // We keep no xtra when we resize
@@ -260,7 +265,7 @@ void lyxstring::Srep::resize(size_type n, value_type c)
 }
 
 
-void lyxstring::Srep::reserve(lyxstring::size_type res_arg)
+void string::Srep::reserve(string::size_type res_arg)
 {
        // This keeps the old sz, but
        // increases res with res_arg
@@ -272,7 +277,7 @@ void lyxstring::Srep::reserve(lyxstring::size_type res_arg)
 }
 
 
-void lyxstring::Srep::replace(lyxstring::size_type i, lyxstring::size_type n,
+void string::Srep::replace(string::size_type i, string::size_type n,
                              value_type const * p, size_type n2)
 {
 // can be called with p= 0 and n2= 0
@@ -298,24 +303,24 @@ void lyxstring::Srep::replace(lyxstring::size_type i, lyxstring::size_type n,
 
 
 ///////////////////////////////////////
-// The lyxstring Invariant tester
+// The string Invariant tester
 ///////////////////////////////////////
 
-// There are no know bugs in lyxstring now, and it have been
+// There are no know bugs in string now, and it have been
 // tested for a long time. so we disable the invariant checker. (Lgb)
 #undef ENABLE_ASSERTIONS
 #ifdef ENABLE_ASSERTIONS
 
-/** Testing of the lyxstring invariant
- * By creating an object that tests the lyxstring invariant during its
+/** Testing of the string invariant
+ * By creating an object that tests the string invariant during its
  * construction *and* its deconstruction we greatly simplify our code.
- * Calling TestlyxstringInvariant() upon entry to an lyxstring method
+ * Calling TeststringInvariant() upon entry to an string method
  * will test the invariant upon entry to the code.  If the Asserts fail
  * then we know from the stack trace that the corruption occurred *before*
  * entry to this method.  We can also be sure it didn't happen in any of
- * the tested lyxstring methods.  It is therefore likely to be due to some
+ * the tested string methods.  It is therefore likely to be due to some
  * other external force.
- * Several lyxstring methods have multiple exit points which would otherwise
+ * Several string methods have multiple exit points which would otherwise
  * require us to insert a separate test before each return.  But since we
  * created an object its destructor will be called upon exit (any exit!).
  * We thus get testing at both start and end of a method with one line of
@@ -323,46 +328,46 @@ void lyxstring::Srep::replace(lyxstring::size_type i, lyxstring::size_type n,
  * everytime we run the code.
  * NOTE:  just because we test the invariant doesn't mean we can forget
  * about testing pre and post conditions specific to any given method.
- * This test simply proves that the lyxstring/Srep is in a valid state it
+ * This test simply proves that the string/Srep is in a valid state it
  * does *not* prove that the method did what it was supposed to.
  */
-class lyxstringInvariant {
+class stringInvariant {
 public:
-       lyxstringInvariant(lyxstring const *);
-       ~lyxstringInvariant();
+       stringInvariant(string const *);
+       ~stringInvariant();
 private:
        void helper() const;
-       lyxstring const * object;
+       string const * object;
 };
 
 
 // To test if this scheme works "as advertised" uncomment the printf's in
 // the constructor and destructor below and then uncomment the printf and the
-// call to TestlyxstringInvariant() in lyxstring::operator=(char const *).
+// call to TestlyxstringInvariant() in string::operator=(char const *).
 // The correct output when LyX has been recompiled and run is:
 //     lyxstringInvariant constructor
-//     lyxstring::operator=(char const *)
+//     string::operator=(char const *)
 //     lyxstringInvariant constructor
 //     lyxstringInvariant destructor completed
 //     lyxstringInvariant destructor completed
 // NOTE: The easiest way to catch this snippet of the output is to wait for
 //       the splash screen to disappear and then open and close Help->Credits
 //
-lyxstringInvariant::lyxstringInvariant(lyxstring const * ls) : object(ls)
+stringInvariant::stringInvariant(string const * ls) : object(ls)
 {
-       // printf("lyxstringInvariant constructor\n");
+       // printf("stringInvariant constructor\n");
        helper();
 }
 
 
-lyxstringInvariant::~lyxstringInvariant()
+stringInvariant::~stringInvariant()
 {
        helper();
-       // printf("lyxstringInvariant destructor completed\n");
+       // printf("stringInvariant destructor completed\n");
 }
 
 
-void lyxstringInvariant::helper() const
+void stringInvariant::helper() const
 {
        // Some of these tests might look pointless but they are
        // all part of the invariant and if we want to make sure
@@ -370,7 +375,6 @@ void lyxstringInvariant::helper() const
        // test every last little thing we *know* should be true.
        // I may have missed a test or two, so feel free to fill
        // in the gaps.  ARRae.
-       using lyx::Assert;
        Assert(object);
        Assert(object->rep);
        Assert(object->rep->s);    // s is never 0
@@ -381,9 +385,9 @@ void lyxstringInvariant::helper() const
        // if it does ever == then we should be generating a new copy
        // and starting again.  (Is char always 8-bits?)
 }
-#define TestlyxstringInvariant(s) lyxstringInvariant lyxstring_invariant(s);
+#define TeststringInvariant(s) stringInvariant string_invariant(s);
 #else
-#define TestlyxstringInvariant(s)
+#define TeststringInvariant(s)
 #endif /* ENABLE_ASSERTIONS */
 
 
@@ -391,11 +395,11 @@ void lyxstringInvariant::helper() const
 // Constructors and Deconstructors.
 ///////////////////////////////////////
 
-lyxstring::size_type const lyxstring::npos =
-static_cast<lyxstring::size_type>(-1);
+string::size_type const string::npos =
+static_cast<string::size_type>(-1);
 
 
-lyxstring::lyxstring()
+string::string()
 {
        static Srep empty_rep(0, "");
        ++empty_rep.ref;
@@ -403,9 +407,9 @@ lyxstring::lyxstring()
 }
 
 
-lyxstring::lyxstring(lyxstring const & x, size_type pos, size_type n)
+string::string(string const & x, size_type pos, size_type n)
 {
-       lyx::Assert(pos <= x.rep->sz); // STD!
+       Assert(pos <= x.rep->sz); // STD!
        if (pos == 0 && n >= x.length()) { // this is the default
                x.rep->ref++;
                rep = x.rep;
@@ -415,9 +419,9 @@ lyxstring::lyxstring(lyxstring const & x, size_type pos, size_type n)
 }
 
 
-lyxstring::lyxstring(value_type const * s, size_type n)
+string::string(value_type const * s, size_type n)
 {
-       lyx::Assert(s && n < npos); // STD!
+       Assert(s && n < npos); // STD!
        static Srep empty_rep(0, "");
        if (n) { // n > 0
                rep = new Srep(n, s);
@@ -428,9 +432,9 @@ lyxstring::lyxstring(value_type const * s, size_type n)
 }
 
 
-lyxstring::lyxstring(value_type const * s)
+string::string(value_type const * s)
 {
-       lyx::Assert(s); // STD!
+       Assert(s); // STD!
        static Srep empty_rep(0, "");
        if (*s) { // s is not empty string
                rep = new Srep(strlen(s), s);
@@ -441,24 +445,24 @@ lyxstring::lyxstring(value_type const * s)
 }
 
 
-lyxstring::lyxstring(size_type n, value_type c)
+string::string(size_type n, value_type c)
 {
-       lyx::Assert(n < npos); // STD!
+       Assert(n < npos); // STD!
        rep = new Srep(n, c);
 }
 
 
-#warning lyxstring user, have a look here. (Lgb)
+#warning string user, have a look here. (Lgb)
 #if 0
 // Commented out to avoid warnings from doxygen. (Lgb)
-lyxstring::lyxstring(const_iterator first, const_iterator last)
+string::string(const_iterator first, const_iterator last)
 {
        rep = new Srep(last - first, first);
 }
 #endif
 
 
-lyxstring::~lyxstring()
+string::~string()
 {
        if (--rep->ref == 0) delete rep;
 }
@@ -467,51 +471,51 @@ lyxstring::~lyxstring()
 // Iterators
 ///////////////////////
 
-lyxstring::iterator lyxstring::begin()
+string::iterator string::begin()
 {
        rep = rep->get_own_copy();
        return rep->s;
 }
 
 
-lyxstring::const_iterator lyxstring::begin() const
+string::const_iterator string::begin() const
 {
        return rep->s;
 }
 
 
-lyxstring::iterator lyxstring::end()
+string::iterator string::end()
 {
        rep = rep->get_own_copy();
        return rep->s + rep->sz;
 }
 
 
-lyxstring::const_iterator lyxstring::end() const
+string::const_iterator string::end() const
 {
        return rep->s + rep->sz;
 }
 
 #if 0
-reverse_iterator lyxstring::rbegin()
+reverse_iterator string::rbegin()
 {
        return reverse_iterator( end() );
 }
 
 
-const_reverse_iterator lyxstring::rbegin() const
+const_reverse_iterator string::rbegin() const
 {
        return const_reverse_iterator( end() );
 }
 
 
-reverse_iterator lyxstring::rend()
+reverse_iterator string::rend()
 {
        return reverse_iterator( begin() );
 }
 
 
-const_reverse_iterator lyxstring::rend() const
+const_reverse_iterator string::rend() const
 {
        return const_reverse_iterator( begin() );
 }
@@ -522,16 +526,16 @@ const_reverse_iterator lyxstring::rend() const
 // Size and Capacity
 ///////////////////////
 
-lyxstring::size_type lyxstring::size() const
+string::size_type string::size() const
 {
        return rep->sz;
 }
 
 
-void lyxstring::resize(size_type n, value_type c)
+void string::resize(size_type n, value_type c)
 {
-       lyx::Assert(n <= npos); // STD!
-       TestlyxstringInvariant(this);
+       Assert(n <= npos); // STD!
+       TeststringInvariant(this);
 
        // This resets sz to res_arg
        rep = rep->get_own_copy();
@@ -539,15 +543,15 @@ void lyxstring::resize(size_type n, value_type c)
 }
 
 
-lyxstring::size_type lyxstring::capacity() const
+string::size_type string::capacity() const
 {
        return rep->res;
 }
 
 
-void lyxstring::reserve(size_type res_arg)
+void string::reserve(size_type res_arg)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        rep->reserve(res_arg);
@@ -558,27 +562,27 @@ void lyxstring::reserve(size_type res_arg)
 // Assignment
 ////////////////
 
-lyxstring & lyxstring::operator=(lyxstring const & x)
+string & string::operator=(string const & x)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        return assign(x);
 }
 
 
-lyxstring & lyxstring::operator=(value_type const * s)
+string & string::operator=(value_type const * s)
 {
-       lyx::Assert(s); // OURS!
-       TestlyxstringInvariant(this);
-//     printf("lyxstring::operator= (value_type const *)\n");
+       Assert(s); // OURS!
+       TeststringInvariant(this);
+//     printf("string::operator= (value_type const *)\n");
 
        return assign(s);
 }
 
 
-lyxstring & lyxstring::operator=(value_type c)
+string & string::operator=(value_type c)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        value_type s[1];
        s[0] = c;
@@ -592,9 +596,9 @@ lyxstring & lyxstring::operator=(value_type c)
 }
 
 
-lyxstring & lyxstring::assign(lyxstring const & x)
+string & string::assign(string const & x)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        x.rep->ref++; // protect against ``st = st''
        if (--rep->ref == 0) delete rep;
@@ -603,19 +607,19 @@ lyxstring & lyxstring::assign(lyxstring const & x)
 }
 
 
-lyxstring & lyxstring::assign(lyxstring const & x, size_type pos, size_type n)
+string & string::assign(string const & x, size_type pos, size_type n)
 {
-       lyx::Assert(pos <= x.rep->sz); // STD!
-       TestlyxstringInvariant(this);
+       Assert(pos <= x.rep->sz); // STD!
+       TeststringInvariant(this);
 
        return assign(x.substr(pos, n));
 }
 
 
-lyxstring & lyxstring::assign(value_type const * s, size_type n)
+string & string::assign(value_type const * s, size_type n)
 {
-       lyx::Assert(s && n < npos); // STD!
-       TestlyxstringInvariant(this);
+       Assert(s && n < npos); // STD!
+       TeststringInvariant(this);
 
        if (rep->ref == 1) // recycle rep
                rep->assign(n, s);
@@ -627,18 +631,18 @@ lyxstring & lyxstring::assign(value_type const * s, size_type n)
 }
 
 
-lyxstring & lyxstring::assign(value_type const * s)
+string & string::assign(value_type const * s)
 {
-       lyx::Assert(s); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(s); // OURS!
+       TeststringInvariant(this);
 
        return assign(s, strlen(s));
 }
 
 
-lyxstring & lyxstring::assign(size_type n, value_type ch)
+string & string::assign(size_type n, value_type ch)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        rep->assign(n, ch);
@@ -646,9 +650,9 @@ lyxstring & lyxstring::assign(size_type n, value_type ch)
 }
 
 
-lyxstring & lyxstring::assign(const_iterator first, const_iterator last)
+string & string::assign(const_iterator first, const_iterator last)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        rep->assign(last - first, first);
@@ -660,43 +664,43 @@ lyxstring & lyxstring::assign(const_iterator first, const_iterator last)
 // Element Access
 ////////////////////
 
-lyxstring::const_reference lyxstring::operator[](size_type pos) const
+string::const_reference string::operator[](size_type pos) const
 {
 #if 0
        // This is actually what the standard requires,
-       lyx::Assert(pos <= rep->sz); // OURS!
+       Assert(pos <= rep->sz); // OURS!
        static char const helper = '\0';
        return pos == rep->sz ? helper : rep->s[pos];
 #else
        // but we use this one since it is stricter
        // and more according to the real intent of std::string.
-       lyx::Assert(pos < rep->sz); // OURS!
+       Assert(pos < rep->sz); // OURS!
        return rep->s[pos];
 #endif
 }
 
 
-lyxstring::reference lyxstring::operator[](size_type pos)
+string::reference string::operator[](size_type pos)
 {
-       lyx::Assert(pos < rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(pos < rep->sz); // OURS!
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        return rep->s[pos];
 }
 
 
-lyxstring::const_reference lyxstring::at(size_type n) const
+string::const_reference string::at(size_type n) const
 {
-       lyx::Assert(n < rep->sz); // STD!
+       Assert(n < rep->sz); // STD!
        return rep->s[n];
 }
 
 
-lyxstring::reference lyxstring::at(size_type n)
+string::reference string::at(size_type n)
 {
-       lyx::Assert(n < rep->sz); // STD!
-       TestlyxstringInvariant(this);
+       Assert(n < rep->sz); // STD!
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        return rep->s[n];
@@ -707,44 +711,44 @@ lyxstring::reference lyxstring::at(size_type n)
 // Insert
 /////////////
 
-lyxstring & lyxstring::operator+=(lyxstring const & x)
+string & string::operator+=(string const & x)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        return append(x);
 }
 
 
-lyxstring & lyxstring::operator+=(value_type const * x)
+string & string::operator+=(value_type const * x)
 {
-       lyx::Assert(x); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(x); // OURS!
+       TeststringInvariant(this);
 
        return append(x);
 }
 
 
-lyxstring & lyxstring::operator+=(value_type c)
+string & string::operator+=(value_type c)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        push_back(c);
        return *this;
 }
 
 
-void lyxstring::push_back(value_type c)
+void string::push_back(value_type c)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        rep->push_back(c);
 }
 
 
-lyxstring & lyxstring::append(lyxstring const & x)
+string & string::append(string const & x)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        if (x.empty()) return *this;
        rep = rep->get_own_copy();
@@ -753,19 +757,19 @@ lyxstring & lyxstring::append(lyxstring const & x)
 }
 
 
-lyxstring & lyxstring::append(lyxstring const & x, size_type pos, size_type n)
+string & string::append(string const & x, size_type pos, size_type n)
 {
-       lyx::Assert(pos <= x.rep->sz); // STD!
-       TestlyxstringInvariant(this);
+       Assert(pos <= x.rep->sz); // STD!
+       TeststringInvariant(this);
 
        return append(x.substr(pos, n));
 }
 
 
-lyxstring & lyxstring::append(value_type const * p, size_type n)
+string & string::append(value_type const * p, size_type n)
 {
-       lyx::Assert(p); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(p); // OURS!
+       TeststringInvariant(this);
 
        if (!*p || !n) return *this;
        rep = rep->get_own_copy();
@@ -774,16 +778,16 @@ lyxstring & lyxstring::append(value_type const * p, size_type n)
 }
 
 
-lyxstring & lyxstring::append(value_type const * p)
+string & string::append(value_type const * p)
 {
-       lyx::Assert(p); // OURS!
+       Assert(p); // OURS!
        return append(p, strlen(p));
 }
 
 
-lyxstring & lyxstring::append(size_type n, value_type c)
+string & string::append(size_type n, value_type c)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        value_type * tmp = new value_type[n];
        memset(tmp, c, n);
@@ -794,9 +798,9 @@ lyxstring & lyxstring::append(size_type n, value_type c)
 }
 
 
-lyxstring & lyxstring::append(iterator first, iterator last)
+string & string::append(iterator first, iterator last)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        rep->append(last - first, first);
@@ -805,19 +809,19 @@ lyxstring & lyxstring::append(iterator first, iterator last)
 
 // insert characters before (*this)[pos]
 
-lyxstring & lyxstring::insert(size_type pos, lyxstring const & x)
+string & string::insert(size_type pos, string const & x)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        return insert(pos, x, 0, x.rep->sz);
 }
 
 
-lyxstring & lyxstring::insert(size_type pos, lyxstring const & x,
+string & string::insert(size_type pos, string const & x,
                              size_type pos2, size_type n)
 {
-       lyx::Assert(pos <= rep->sz && pos2 <= x.rep->sz); // STD!
-       TestlyxstringInvariant(this);
+       Assert(pos <= rep->sz && pos2 <= x.rep->sz); // STD!
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        rep->insert(pos, &(x.rep->s[pos2]), min(n, x.rep->sz));
@@ -825,10 +829,10 @@ lyxstring & lyxstring::insert(size_type pos, lyxstring const & x,
 }
 
 
-lyxstring & lyxstring::insert(size_type pos, value_type const * p, size_type n)
+string & string::insert(size_type pos, value_type const * p, size_type n)
 {
-       lyx::Assert(p); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(p); // OURS!
+       TeststringInvariant(this);
 
        if (*p && n) {
                // insert nothing and you change nothing
@@ -839,16 +843,16 @@ lyxstring & lyxstring::insert(size_type pos, value_type const * p, size_type n)
 }
 
 
-lyxstring & lyxstring::insert(size_type pos, value_type const * p)
+string & string::insert(size_type pos, value_type const * p)
 {
-       lyx::Assert(p); // OURS!
+       Assert(p); // OURS!
        return insert(pos, p, strlen(p));
 }
 
 
-lyxstring & lyxstring::insert(size_type pos, size_type n, value_type c)
+string & string::insert(size_type pos, size_type n, value_type c)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        value_type * tmp = new value_type[n];
@@ -859,9 +863,9 @@ lyxstring & lyxstring::insert(size_type pos, size_type n, value_type c)
 }
 
 
-lyxstring::iterator lyxstring::insert(iterator p, value_type c)
+string::iterator string::insert(iterator p, value_type c)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        // what iterator is this supposed to return??
        size_type tmp = p - begin();
@@ -870,17 +874,17 @@ lyxstring::iterator lyxstring::insert(iterator p, value_type c)
 }
 
 
-void lyxstring::insert(iterator p, size_type n , value_type c)
+void string::insert(iterator p, size_type n , value_type c)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        insert(p - begin(), n , c);
 }
 
 
-void lyxstring::insert(iterator p, iterator first, iterator last)
+void string::insert(iterator p, iterator first, iterator last)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        insert(p - begin(), first, last - first);
 }
@@ -895,11 +899,11 @@ void lyxstring::insert(iterator p, iterator first, iterator last)
         // some of the parameters wrong, also some of the funcs can surely
         // be written more effectively.
 
-lyxstring::size_type lyxstring::find(lyxstring const & a, size_type i) const
+string::size_type string::find(string const & a, size_type i) const
 {
        if (!rep->sz || i >= rep->sz) return npos;
 
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        size_type n = a.length();
        if (!n) return npos;
@@ -921,13 +925,13 @@ lyxstring::size_type lyxstring::find(lyxstring const & a, size_type i) const
 }
 
 
-lyxstring::size_type lyxstring::find(value_type const * ptr, size_type i,
+string::size_type string::find(value_type const * ptr, size_type i,
                                     size_type n) const
 {
-       lyx::Assert(ptr); // OURS!
+       Assert(ptr); // OURS!
        if (!rep->sz || !*ptr || i >= rep->sz) return npos;
 
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        // What is "n" here? is it the number of value_types to use in ptr
        // or does "i" and "n" togeter form a substring to search
@@ -953,23 +957,23 @@ lyxstring::size_type lyxstring::find(value_type const * ptr, size_type i,
 }
 
 
-lyxstring::size_type lyxstring::find(value_type const * s, size_type i) const
+string::size_type string::find(value_type const * s, size_type i) const
 {
-       lyx::Assert(s); // OURS!
+       Assert(s); // OURS!
        if (!rep->sz || i >= rep->sz) return npos;
 
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        if (!s || !*s) return npos;
        return find(s, i, strlen(s));
 }
 
 
-lyxstring::size_type lyxstring::find(value_type c, size_type i) const
+string::size_type string::find(value_type c, size_type i) const
 {
        if (!rep->sz || i >= rep->sz) return npos;
 
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        for (size_type t = 0; t + i < rep->sz; ++t) {
                if (rep->s[t + i] == c) return t + i;
@@ -978,9 +982,9 @@ lyxstring::size_type lyxstring::find(value_type c, size_type i) const
 }
 
 
-lyxstring::size_type lyxstring::rfind(lyxstring const & a, size_type i) const
+string::size_type string::rfind(string const & a, size_type i) const
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        size_type n = a.length();
        if (!n || rep->sz < n)
@@ -1004,11 +1008,11 @@ lyxstring::size_type lyxstring::rfind(lyxstring const & a, size_type i) const
 }
 
 
-lyxstring::size_type lyxstring::rfind(value_type const * ptr, size_type i,
+string::size_type string::rfind(value_type const * ptr, size_type i,
                                      size_type n) const
 {
-       lyx::Assert(ptr); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(ptr); // OURS!
+       TeststringInvariant(this);
 
        n = min(n, strlen(ptr));
        if (!n || rep->sz < n)
@@ -1032,19 +1036,19 @@ lyxstring::size_type lyxstring::rfind(value_type const * ptr, size_type i,
 }
 
 
-lyxstring::size_type lyxstring::rfind(value_type const * ptr,
+string::size_type string::rfind(value_type const * ptr,
                                      size_type i) const
 {
-       lyx::Assert(ptr); // OURS!
+       Assert(ptr); // OURS!
 
        if (!ptr || !*ptr) return npos;
        return rfind(ptr, i, strlen(ptr));
 }
 
 
-lyxstring::size_type lyxstring::rfind(value_type c, size_type i) const
+string::size_type string::rfind(value_type c, size_type i) const
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        size_type const sz = rep->sz;
        if (sz < 1) return npos;
@@ -1056,11 +1060,11 @@ lyxstring::size_type lyxstring::rfind(value_type c, size_type i) const
 }
 
 
-lyxstring::size_type lyxstring::find_first_of(lyxstring const & a,
+string::size_type string::find_first_of(string const & a,
                                              size_type i) const
 {
-       lyx::Assert(i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(i <= rep->sz); // OURS!
+       TeststringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
                if (a.find(rep->s[t]) != npos) return t;
@@ -1069,12 +1073,12 @@ lyxstring::size_type lyxstring::find_first_of(lyxstring const & a,
 }
 
 
-lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
+string::size_type string::find_first_of(value_type const * ptr,
                                              size_type i,
                                              size_type n) const
 {
-       lyx::Assert(ptr && i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(ptr && i <= rep->sz); // OURS!
+       TeststringInvariant(this);
        if (!n) return npos;
 
        for (size_type t = i; t < rep->sz; ++t) {
@@ -1084,11 +1088,11 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
 }
 
 
-lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
+string::size_type string::find_first_of(value_type const * ptr,
                                              size_type i) const
 {
-       lyx::Assert(ptr && i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(ptr && i <= rep->sz); // OURS!
+       TeststringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
                if (strchr(ptr, rep->s[t]) != 0) return t;
@@ -1097,10 +1101,10 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
 }
 
 
-lyxstring::size_type lyxstring::find_first_of(value_type c, size_type i) const
+string::size_type string::find_first_of(value_type c, size_type i) const
 {
-       lyx::Assert(i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(i <= rep->sz); // OURS!
+       TeststringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
                if (rep->s[t] == c) return t;
@@ -1109,10 +1113,10 @@ lyxstring::size_type lyxstring::find_first_of(value_type c, size_type i) const
 }
 
 
-lyxstring::size_type lyxstring::find_last_of(lyxstring const & a,
+string::size_type string::find_last_of(string const & a,
                                             size_type i) const
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        size_type ii = min(rep->sz - 1, i);
        for (int t = ii; t >= 0; --t) {
@@ -1122,12 +1126,12 @@ lyxstring::size_type lyxstring::find_last_of(lyxstring const & a,
 }
 
 
-lyxstring::size_type lyxstring::find_last_of(value_type const * ptr,
+string::size_type string::find_last_of(value_type const * ptr,
                                             size_type i,
                                             size_type n) const
 {
-       lyx::Assert(ptr); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(ptr); // OURS!
+       TeststringInvariant(this);
        if (!n) return npos;
 
        size_type ii = min(rep->sz - 1, i);
@@ -1138,11 +1142,11 @@ lyxstring::size_type lyxstring::find_last_of(value_type const * ptr,
 }
 
 
-lyxstring::size_type lyxstring::find_last_of(value_type const * ptr,
+string::size_type string::find_last_of(value_type const * ptr,
                                             size_type i) const
 {
-       lyx::Assert(ptr); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(ptr); // OURS!
+       TeststringInvariant(this);
 
        size_type ii = min(rep->sz - 1, i);
        for (int t = ii; t >= 0; --t) {
@@ -1152,9 +1156,9 @@ lyxstring::size_type lyxstring::find_last_of(value_type const * ptr,
 }
 
 
-lyxstring::size_type lyxstring::find_last_of(value_type c, size_type i) const
+string::size_type string::find_last_of(value_type c, size_type i) const
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        if (!rep->sz) return npos;
        size_type ii = min(rep->sz - 1, i);
@@ -1165,13 +1169,13 @@ lyxstring::size_type lyxstring::find_last_of(value_type c, size_type i) const
 }
 
 
-lyxstring::size_type lyxstring::find_first_not_of(lyxstring const & a,
+string::size_type string::find_first_not_of(string const & a,
                                                  size_type i) const
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        if (!rep->sz) return npos;
-       lyx::Assert(i <= rep->sz);
+       Assert(i <= rep->sz);
        for (size_type t = i; t < rep->sz; ++t) {
                if (a.find(rep->s[t]) == npos) return t;
        }
@@ -1179,12 +1183,12 @@ lyxstring::size_type lyxstring::find_first_not_of(lyxstring const & a,
 }
 
 
-lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
+string::size_type string::find_first_not_of(value_type const * ptr,
                                                  size_type i,
                                                  size_type n) const
 {
-       lyx::Assert(ptr && i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(ptr && i <= rep->sz); // OURS!
+       TeststringInvariant(this);
 
        if (!n) return (i < rep->sz) ? i : npos;
        for (size_type t = i; t < rep->sz; ++t) {
@@ -1194,11 +1198,11 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
 }
 
 
-lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
+string::size_type string::find_first_not_of(value_type const * ptr,
                                                  size_type i) const
 {
-       lyx::Assert(ptr && i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(ptr && i <= rep->sz); // OURS!
+       TeststringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
                if (strchr(ptr, rep->s[t]) == 0) return t;
@@ -1207,12 +1211,12 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
 }
 
 
-lyxstring::size_type lyxstring::find_first_not_of(value_type c,
+string::size_type string::find_first_not_of(value_type c,
                                                  size_type i) const
 {
        if (!rep->sz) return npos;
-       lyx::Assert(i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(i <= rep->sz); // OURS!
+       TeststringInvariant(this);
 
        for (size_type t = i; t < rep->sz; ++t) {
                if (rep->s[t] != c) return t;
@@ -1221,10 +1225,10 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type c,
 }
 
 
-lyxstring::size_type lyxstring::find_last_not_of(lyxstring const & a,
+string::size_type string::find_last_not_of(string const & a,
                                                 size_type i) const
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        size_type ii = min(rep->sz - 1, i);
        for (int t = ii; t >= 0; --t) {
@@ -1234,12 +1238,12 @@ lyxstring::size_type lyxstring::find_last_not_of(lyxstring const & a,
 }
 
 
-lyxstring::size_type lyxstring::find_last_not_of(value_type const * ptr,
+string::size_type string::find_last_not_of(value_type const * ptr,
                                                 size_type i,
                                                 size_type n) const
 {
-       lyx::Assert(ptr); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(ptr); // OURS!
+       TeststringInvariant(this);
 
        if (!n) return npos;
        size_type ii = min(rep->sz - 1, i);
@@ -1251,11 +1255,11 @@ lyxstring::size_type lyxstring::find_last_not_of(value_type const * ptr,
 }
 
 
-lyxstring::size_type lyxstring::find_last_not_of(value_type const * ptr,
+string::size_type string::find_last_not_of(value_type const * ptr,
                                                 size_type i) const
 {
-       lyx::Assert(ptr); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(ptr); // OURS!
+       TeststringInvariant(this);
 
        size_type ii = min(rep->sz - 1, i);
        for (int t = ii; t >= 0; --t) {
@@ -1265,10 +1269,10 @@ lyxstring::size_type lyxstring::find_last_not_of(value_type const * ptr,
 }
 
 
-lyxstring::size_type lyxstring::find_last_not_of(value_type c,
+string::size_type string::find_last_not_of(value_type c,
                                                 size_type i) const
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        size_type ii = min(rep->sz - 1, i);
        for (int t = ii; t >= 0; --t) {
@@ -1282,20 +1286,20 @@ lyxstring::size_type lyxstring::find_last_not_of(value_type c,
 // Replace
 /////////////////
 
-lyxstring & lyxstring::replace(size_type i, size_type n, lyxstring const & x)
+string & string::replace(size_type i, size_type n, string const & x)
 {
-       lyx::Assert(i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(i <= rep->sz); // OURS!
+       TeststringInvariant(this);
 
        return replace(i, n, x, 0, x.rep->sz);
 }
 
 
-lyxstring & lyxstring::replace(size_type i, size_type n, lyxstring const & x,
+string & string::replace(size_type i, size_type n, string const & x,
                               size_type i2, size_type n2)
 {
-       lyx::Assert(i <= rep->sz && i2 <= x.rep->sz); // STD!
-       TestlyxstringInvariant(this);
+       Assert(i <= rep->sz && i2 <= x.rep->sz); // STD!
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        rep->replace(i, min(n, rep->sz), &(x.rep->s[i2]), min(n2, x.rep->sz));
@@ -1303,11 +1307,11 @@ lyxstring & lyxstring::replace(size_type i, size_type n, lyxstring const & x,
 }
 
 
-lyxstring & lyxstring::replace(size_type i, size_type n,
+string & string::replace(size_type i, size_type n,
                               value_type const * p, size_type n2)
 {
-       lyx::Assert(p && i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(p && i <= rep->sz); // OURS!
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        rep->replace(i, min(n, rep->sz), p, min(n2, strlen(p)));
@@ -1315,20 +1319,20 @@ lyxstring & lyxstring::replace(size_type i, size_type n,
 }
 
 
-lyxstring & lyxstring::replace(size_type i, size_type n, value_type const * p)
+string & string::replace(size_type i, size_type n, value_type const * p)
 {
-       lyx::Assert(p && i <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(p && i <= rep->sz); // OURS!
+       TeststringInvariant(this);
 
        return replace(i, min(n, rep->sz), p, (!p) ? 0 : strlen(p));
 }
 
 
-lyxstring & lyxstring::replace(size_type i, size_type n,
+string & string::replace(size_type i, size_type n,
                               size_type n2, value_type c)
 {
-       lyx::Assert(i <= rep->sz);  // OURS!
-       TestlyxstringInvariant(this);
+       Assert(i <= rep->sz);  // OURS!
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        value_type * tmp = new value_type[n2];
@@ -1340,58 +1344,58 @@ lyxstring & lyxstring::replace(size_type i, size_type n,
 
 
 /// FY! FY! FY! go away !
-lyxstring & lyxstring::replace(size_type i, size_type n, value_type c)
+string & string::replace(size_type i, size_type n, value_type c)
 {
        return replace(i, n, 1, c);
 }
 
 
-lyxstring & lyxstring::replace(iterator i, iterator i2, const lyxstring & str)
+string & string::replace(iterator i, iterator i2, const string & str)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        return replace(i - begin(), i2 - i, str);
 }
 
 
-lyxstring & lyxstring::replace(iterator i, iterator i2,
+string & string::replace(iterator i, iterator i2,
                               value_type const * p, size_type n)
 {
-       lyx::Assert(p); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(p); // OURS!
+       TeststringInvariant(this);
 
        return replace(i - begin(), i2 - i, p, n);
 }
 
 
-lyxstring & lyxstring::replace(iterator i, iterator i2, value_type const * p)
+string & string::replace(iterator i, iterator i2, value_type const * p)
 {
-       lyx::Assert(p); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(p); // OURS!
+       TeststringInvariant(this);
 
        return replace(i - begin(), i2 - i, p);
 }
 
 
-lyxstring & lyxstring::replace(iterator i, iterator i2,
+string & string::replace(iterator i, iterator i2,
                               size_type n , value_type c)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        return replace(i - begin(), i2 - i, n, c);
 }
 
 
-lyxstring & lyxstring::replace(iterator i, iterator i2,
+string & string::replace(iterator i, iterator i2,
                               iterator j, iterator j2)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        return replace(i - begin(), i2 - i, j, j2 - j);
 }
 
 
-void lyxstring::swap(lyxstring & str)
+void string::swap(string & str)
 {
        if (rep == str.rep) return;
        Srep * tmp = str.rep;
@@ -1400,10 +1404,10 @@ void lyxstring::swap(lyxstring & str)
 }
 
 
-lyxstring & lyxstring::erase(size_type i, size_type n)
+string & string::erase(size_type i, size_type n)
 {
-       lyx::Assert(i <= rep->sz); // STD!
-       TestlyxstringInvariant(this);
+       Assert(i <= rep->sz); // STD!
+       TeststringInvariant(this);
 
        rep = rep->get_own_copy();
        if (i == 0 && n >= rep->sz) {
@@ -1417,9 +1421,9 @@ lyxstring & lyxstring::erase(size_type i, size_type n)
 }
 
 
-lyxstring::iterator lyxstring::erase(iterator i)
+string::iterator string::erase(iterator i)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        // what iterator is this supposed to return?
        // the iterator after the one erased
@@ -1428,9 +1432,9 @@ lyxstring::iterator lyxstring::erase(iterator i)
 }
 
 
-lyxstring::iterator lyxstring::erase(iterator first, iterator last)
+string::iterator string::erase(iterator first, iterator last)
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
 
        erase(first - begin(), last - first);
        return begin(); // BUG
@@ -1441,25 +1445,25 @@ lyxstring::iterator lyxstring::erase(iterator first, iterator last)
 // Conversion to C-style Strings
 /////////////////////////////////////
 
-lyxstring::value_type const * lyxstring::c_str() const
+string::value_type const * string::c_str() const
 {
        rep->s[length()] = '\0';
        return rep->s;
 }
 
 
-lyxstring::value_type const * lyxstring::data() const
+string::value_type const * string::data() const
 {
        return rep->s;
 }
 
 
-lyxstring::size_type lyxstring::copy(value_type * buf, size_type len,
+string::size_type string::copy(value_type * buf, size_type len,
                                     size_type pos) const
 {
-       lyx::Assert(buf); // OURS!
-       lyx::Assert(pos <= rep->sz); // STD!
-       TestlyxstringInvariant(this);
+       Assert(buf); // OURS!
+       Assert(pos <= rep->sz); // STD!
+       TeststringInvariant(this);
 
        register int nn = min(len, length() - pos);
        memcpy(buf, &(rep->s[pos]), nn);
@@ -1473,7 +1477,7 @@ lyxstring::size_type lyxstring::copy(value_type * buf, size_type len,
 
 // Compare funcs should be verified.
 
-int lyxstring::internal_compare(size_type pos, size_type n,
+int string::internal_compare(size_type pos, size_type n,
                                value_type const * s,
                                size_type slen, size_type n2) const
 {
@@ -1496,49 +1500,49 @@ int lyxstring::internal_compare(size_type pos, size_type n,
 }
 
 
-int lyxstring::compare(lyxstring const & str) const
+int string::compare(string const & str) const
 {
-       TestlyxstringInvariant(this);
+       TeststringInvariant(this);
        return internal_compare(0, rep->sz, str.rep->s,
                                str.rep->sz, str.rep->sz);
 }
 
 
-int lyxstring::compare(value_type const * s) const
+int string::compare(value_type const * s) const
 {
-       lyx::Assert(s); //OURS!
-       TestlyxstringInvariant(this);
+       Assert(s); //OURS!
+       TeststringInvariant(this);
        int n = (!s) ? 0 : strlen(s);
        return internal_compare(0, rep->sz, s, n, n);
 }
 
 
-int lyxstring::compare(size_type pos, size_type n,
-                      lyxstring const & str) const
+int string::compare(size_type pos, size_type n,
+                      string const & str) const
 {
-       lyx::Assert(pos <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(pos <= rep->sz); // OURS!
+       TeststringInvariant(this);
        return internal_compare(pos, n, str.rep->s, str.rep->sz, str.rep->sz);
 }
 
 
-int lyxstring::compare(size_type pos, size_type n, lyxstring const & str,
+int string::compare(size_type pos, size_type n, string const & str,
                       size_type pos2, size_type n2) const
 {
-       lyx::Assert(pos <= rep->sz); // OURS!
-       lyx::Assert(pos2 <= str.rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(pos <= rep->sz); // OURS!
+       Assert(pos2 <= str.rep->sz); // OURS!
+       TeststringInvariant(this);
        return internal_compare(pos, n,
                                str.rep->s + pos2,
                                str.rep->sz - pos2, n2);
 }
 
 
-int lyxstring::compare(size_type pos, size_type n, value_type const * s,
+int string::compare(size_type pos, size_type n, value_type const * s,
                       size_type n2) const
 {
-       lyx::Assert(s && pos <= rep->sz); // OURS!
-       TestlyxstringInvariant(this);
+       Assert(s && pos <= rep->sz); // OURS!
+       TeststringInvariant(this);
        return internal_compare(pos, n, s, (!s) ? 0 : strlen(s), n2);
 }
 
@@ -1548,12 +1552,12 @@ int lyxstring::compare(size_type pos, size_type n, value_type const * s,
 /////////////////
 
 // i = index, n = length
-lyxstring lyxstring::substr(size_type i, size_type n) const
+string string::substr(size_type i, size_type n) const
 {
-       lyx::Assert(i <= rep->sz); // STD!
-       TestlyxstringInvariant(this);
+       Assert(i <= rep->sz); // STD!
+       TeststringInvariant(this);
 
-       return lyxstring(*this, i, n);
+       return string(*this, i, n);
 }
 
 
@@ -1561,184 +1565,182 @@ lyxstring lyxstring::substr(size_type i, size_type n) const
 // String operators, non member functions
 /////////////////////////////////////////////
 
-bool operator==(lyxstring const & a, lyxstring const & b)
+bool operator==(string const & a, string const & b)
 {
        return a.compare(b) == 0;
 }
 
 
-bool operator==(lyxstring::value_type const * a, lyxstring const & b)
+bool operator==(string::value_type const * a, string const & b)
 {
-       lyx::Assert(a); // OURS!
+       Assert(a); // OURS!
        return b.compare(a) == 0;
 }
 
 
-bool operator==(lyxstring const & a, lyxstring::value_type const * b)
+bool operator==(string const & a, string::value_type const * b)
 {
-       lyx::Assert(b); // OURS!
+       Assert(b); // OURS!
        return a.compare(b) == 0;
 }
 
 
-bool operator!=(lyxstring const & a, lyxstring const & b)
+bool operator!=(string const & a, string const & b)
 {
        return a.compare(b) != 0;
 }
 
 
-bool operator!=(lyxstring::value_type const * a, lyxstring const & b)
+bool operator!=(string::value_type const * a, string const & b)
 {
-       lyx::Assert(a); // OURS!
+       Assert(a); // OURS!
        return b.compare(a) != 0;
 }
 
 
-bool operator!=(lyxstring const & a, lyxstring::value_type const * b)
+bool operator!=(string const & a, string::value_type const * b)
 {
-       lyx::Assert(b); // OURS!
+       Assert(b); // OURS!
        return a.compare(b) != 0;
 }
 
 
-bool operator>(lyxstring const & a, lyxstring const & b)
+bool operator>(string const & a, string const & b)
 {
        return a.compare(b) > 0;
 }
 
 
-bool operator>(lyxstring::value_type const * a, lyxstring const & b)
+bool operator>(string::value_type const * a, string const & b)
 {
-       lyx::Assert(a); // OURS!
+       Assert(a); // OURS!
        return b.compare(a) < 0; // since we reverse the parameters
 }
 
 
-bool operator>(lyxstring const & a, lyxstring::value_type const * b)
+bool operator>(string const & a, string::value_type const * b)
 {
-       lyx::Assert(b); // OURS!
+       Assert(b); // OURS!
        return a.compare(b) > 0;
 }
 
 
-bool operator<(lyxstring const & a, lyxstring const & b)
+bool operator<(string const & a, string const & b)
 {
        return a.compare(b) < 0;
 }
 
 
-bool operator<(lyxstring::value_type const * a, lyxstring const & b)
+bool operator<(string::value_type const * a, string const & b)
 {
-       lyx::Assert(a); // OURS!
+       Assert(a); // OURS!
        return b.compare(a) > 0; // since we reverse the parameters
 }
 
 
-bool operator<(lyxstring const & a, lyxstring::value_type const * b)
+bool operator<(string const & a, string::value_type const * b)
 {
-       lyx::Assert(b); // OURS!
+       Assert(b); // OURS!
        return a.compare(b) < 0;
 }
 
 
-bool operator>=(lyxstring const & a, lyxstring const & b)
+bool operator>=(string const & a, string const & b)
 {
        return a.compare(b) >= 0;
 }
 
 
-bool operator>=(lyxstring::value_type const * a, lyxstring const & b)
+bool operator>=(string::value_type const * a, string const & b)
 {
-       lyx::Assert(a); // OURS!
+       Assert(a); // OURS!
        return b.compare(a) <= 0; // since we reverse the parameters
 }
 
 
-bool operator>=(lyxstring const & a, lyxstring::value_type const * b)
+bool operator>=(string const & a, string::value_type const * b)
 {
-       lyx::Assert(b); // OURS!
+       Assert(b); // OURS!
        return a.compare(b) >= 0;
 }
 
 
-bool operator<=(lyxstring const & a, lyxstring const & b)
+bool operator<=(string const & a, string const & b)
 {
        return a.compare(b) <= 0;
 }
 
 
-bool operator<=(lyxstring::value_type const * a, lyxstring const & b)
+bool operator<=(string::value_type const * a, string const & b)
 {
-       lyx::Assert(a); // OURS!
+       Assert(a); // OURS!
        return b.compare(a) >= 0; // since we reverse the parameters
 }
 
 
-bool operator<=(lyxstring const & a, lyxstring::value_type const * b)
+bool operator<=(string const & a, string::value_type const * b)
 {
-       lyx::Assert(b); // OURS!
+       Assert(b); // OURS!
        return a.compare(b) <= 0;
 }
 
 
-lyxstring operator+(lyxstring const & a, lyxstring const & b)
+string operator+(string const & a, string const & b)
 {
-       lyxstring tmp(a);
+       string tmp(a);
        tmp += b;
        return tmp;
 }
 
 
-lyxstring operator+(lyxstring::value_type const * a, lyxstring const & b)
+string operator+(string::value_type const * a, string const & b)
 {
-       lyx::Assert(a); // OURS!
-       lyxstring tmp(a);
+       Assert(a); // OURS!
+       string tmp(a);
        tmp += b;
        return tmp;
 }
 
 
-lyxstring operator+(lyxstring::value_type a, lyxstring const & b)
+string operator+(string::value_type a, string const & b)
 {
-       lyxstring tmp;
+       string tmp;
        tmp += a;
        tmp += b;
        return tmp;
 }
 
 
-lyxstring operator+(lyxstring const & a, lyxstring::value_type const * b)
+string operator+(string const & a, string::value_type const * b)
 {
-       lyx::Assert(b); // OURS!
-       lyxstring tmp(a);
+       Assert(b); // OURS!
+       string tmp(a);
        tmp += b;
        return tmp;
 }
 
 
-lyxstring operator+(lyxstring const & a, lyxstring::value_type b)
+string operator+(string const & a, string::value_type b)
 {
-       lyxstring tmp(a);
+       string tmp(a);
        tmp += b;
        return tmp;
 }
 
 
-void swap(lyxstring & str1, lyxstring & str2)
+void swap(string & str1, string & str2)
 {
        str1.swap(str2);
 }
 
 
-#include <iostream>
-
-istream & operator>>(istream & is, lyxstring & s)
+istream & operator>>(istream & is, string & s)
 {
 #if 0
        // very bad solution
        char * nome = new char[1024];
        is >> nome;
-       lyxstring tmp(nome);
+       string tmp(nome);
        delete [] nome;
        if (!tmp.empty()) s = tmp;
 #else
@@ -1765,14 +1767,14 @@ istream & operator>>(istream & is, lyxstring & s)
 }
 
 
-ostream & operator<<(ostream & o, lyxstring const & s)
+ostream & operator<<(ostream & o, string const & s)
 {
        return o.write(s.data(), s.length());
 }
 
 
-istream & getline(istream & is, lyxstring & s,
-                 lyxstring::value_type delim)
+istream & getline(istream & is, string & s,
+                 string::value_type delim)
 {
        // very bad solution
        char tmp = 0;
@@ -1788,9 +1790,11 @@ istream & getline(istream & is, lyxstring & s,
        return is;
 }
 
+} // namespace lyx
+
 #ifdef TEST_MAIN
 int main() {
-       lyxstring a = "abcac";
+       lyx::string a = "abcac";
        cout << a.rfind("ab") << endl;
        cout << a.rfind("c") << endl;
        cout << a.rfind("d") << endl;
index 508a06614320cb42633377abf1e493c1c6abc1a5..6ff86e65d3f33990f5288933f3b77cb5af9e3ad4 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <cstring> // for size_t
 
+namespace lyx {
+
 /** A string class for LyX
 
   This is a permanent String class. It is modeled closely after the C++ STL
@@ -84,7 +86,7 @@ When you want to copy an lyxstring, just do
 
   The class automatically handles deep copying when required.
 */
-class lyxstring {
+class string {
 public:
        /* Typedefs */
 
@@ -146,28 +148,28 @@ public:
        /// "all characters" marker
        static const size_type npos;
 
-       /// #lyxstring x;#
-       lyxstring();
+       /// #string x;#
+       string();
 
-       /// #lyxstring x(lyxstring ...)#
-       lyxstring(lyxstring const &, size_type pos = 0, size_type n = npos);
+       /// #string x(string ...)#
+       string(string const &, size_type pos = 0, size_type n = npos);
 
-       /// #lyxstring x("abc", 2) -> "ab"#
-       lyxstring(value_type const *, size_type n);
+       /// #string x("abc", 2) -> "ab"#
+       string(value_type const *, size_type n);
 
-       // #lyxstring x("abc")#
-       lyxstring(value_type const *);
+       // #string x("abc")#
+       string(value_type const *);
 
-       /// lyxstring(5, 'n') -> "nnnnn"
-       lyxstring(size_type n, value_type c);
+       /// string(5, 'n') -> "nnnnn"
+       string(size_type n, value_type c);
 
 #if 0
        ///
-       lyxstring(const_iterator first, const_iterator last);
+       string(const_iterator first, const_iterator last);
 #else
        ///
        template<class InputIterator>
-       lyxstring::lyxstring(InputIterator begin, InputIterator end) {
+       string(InputIterator begin, InputIterator end) {
                while (begin != end) {
                        push_back(*begin);
                        ++begin;
@@ -175,7 +177,7 @@ public:
        }
 #endif
        ///
-       ~lyxstring();
+       ~string();
 
        /// number of characters
        size_type size() const;
@@ -202,36 +204,36 @@ public:
        void reserve(size_type res_arg = 0);
 
        ///
-       lyxstring & operator=(lyxstring const &);
+       string & operator=(string const &);
 
        ///
-       lyxstring & operator=(value_type const *);
+       string & operator=(value_type const *);
 
        ///
-       lyxstring & operator=(value_type);
+       string & operator=(value_type);
 
        ///
-       lyxstring & assign(lyxstring const &);
+       string & assign(string const &);
 
        ///
-       lyxstring & assign(lyxstring const &, size_type pos, size_type n);
+       string & assign(string const &, size_type pos, size_type n);
 
        ///
-       lyxstring & assign(value_type const * p, size_type n);
+       string & assign(value_type const * p, size_type n);
 
        ///
-       lyxstring & assign(value_type const * p);
+       string & assign(value_type const * p);
 
        ///
-       lyxstring & assign(size_type n, value_type c);
+       string & assign(size_type n, value_type c);
 
 #if 1
        ///
-       lyxstring & assign(const_iterator first, const_iterator last);
+       string & assign(const_iterator first, const_iterator last);
 #else
        ///
        template<class InputIterator>
-       lyxstring & assign(InputIterator begin, InputIterator end) {
+       string & assign(InputIterator begin, InputIterator end) {
                clear;
                while (begin != end) {
                        push_back((*begin));
@@ -255,39 +257,39 @@ public:
        // add characters after (*this)[length()-1]:
 
        ///
-       lyxstring & operator+=(lyxstring const &);
+       string & operator+=(string const &);
 
        ///
-       lyxstring & operator+=(value_type const *);
+       string & operator+=(value_type const *);
 
        ///
-       lyxstring & operator+=(value_type);
+       string & operator+=(value_type);
 
        ///
        void push_back(value_type);
 
        ///
-       lyxstring & append(lyxstring const &);
+       string & append(string const &);
 
        ///
-       lyxstring & append(lyxstring const &, size_type pos, size_type n);
+       string & append(string const &, size_type pos, size_type n);
 
        ///
-       lyxstring & append(value_type const *, size_type n);
+       string & append(value_type const *, size_type n);
 
        ///
-       lyxstring & append(value_type const *);
+       string & append(value_type const *);
 
        ///
-       lyxstring & append(size_type n, value_type);
+       string & append(size_type n, value_type);
 
 #if 1
        ///
-       lyxstring & append(iterator first, iterator last);
+       string & append(iterator first, iterator last);
 #else
        ///
        template<class InputIterator>
-       lyxstring & append(InputIterator begin, InputIterator end) {
+       string & append(InputIterator begin, InputIterator end) {
                while (begin != end) {
                        push_back((*begin));
                        ++begin;
@@ -298,21 +300,21 @@ public:
        // insert characters before (*this)[pos]:
 
        ///
-       lyxstring & insert(size_type pos, lyxstring const &);
+       string & insert(size_type pos, string const &);
 
        ///
-       lyxstring & insert(size_type pos, lyxstring const &,
+       string & insert(size_type pos, string const &,
                        size_type pos2, size_type n);
 
        ///
-       lyxstring & insert(size_type pos, value_type const * p,
+       string & insert(size_type pos, value_type const * p,
                         size_type n);
 
        ///
-       lyxstring & insert(size_type pos, value_type const * p);
+       string & insert(size_type pos, value_type const * p);
 
        ///
-       lyxstring & insert(size_type pos, size_type n, value_type c);
+       string & insert(size_type pos, size_type n, value_type c);
 
        // insert characters before p
 
@@ -338,7 +340,7 @@ public:
 #endif
 
        ///
-       size_type find(lyxstring const &, size_type i = 0) const;
+       size_type find(string const &, size_type i = 0) const;
 
        ///
        size_type find(value_type const * p,
@@ -351,7 +353,7 @@ public:
        size_type find(value_type c, size_type i = 0) const;
 
        ///
-       size_type rfind(lyxstring const &, size_type i = npos) const;
+       size_type rfind(string const &, size_type i = npos) const;
 
        ///
        size_type rfind(value_type const * p, size_type i, size_type n) const;
@@ -363,7 +365,7 @@ public:
        size_type rfind(value_type c, size_type i = npos) const;
 
        ///
-       size_type find_first_of(lyxstring const &, size_type i = 0) const;
+       size_type find_first_of(string const &, size_type i = 0) const;
 
        ///
        size_type find_first_of(value_type const * p, size_type i,
@@ -376,7 +378,7 @@ public:
        size_type find_first_of(value_type c, size_type i = 0) const;
 
        ///
-       size_type find_last_of(lyxstring const &, size_type i = npos) const;
+       size_type find_last_of(string const &, size_type i = npos) const;
 
        ///
        size_type find_last_of(value_type const * p, size_type i,
@@ -389,7 +391,7 @@ public:
        size_type find_last_of(value_type c, size_type i = npos) const;
 
        ///
-       size_type find_first_not_of(lyxstring const &, size_type i = 0) const;
+       size_type find_first_not_of(string const &, size_type i = 0) const;
 
        ///
        size_type find_first_not_of(value_type const * p, size_type i,
@@ -403,7 +405,7 @@ public:
        size_type find_first_not_of(value_type c, size_type i = 0) const;
 
        ///
-       size_type find_last_not_of(lyxstring const &,
+       size_type find_last_not_of(string const &,
                                   size_type i = npos) const;
 
        ///
@@ -420,52 +422,52 @@ public:
        // replace [(*this)[i], (*this)[i+n]] with other characters:
 
        ///
-       lyxstring & replace(size_type i, size_type n, lyxstring const & str);
+       string & replace(size_type i, size_type n, string const & str);
 
        ///
-       lyxstring & replace(size_type i, size_type n, lyxstring const & s,
+       string & replace(size_type i, size_type n, string const & s,
                          size_type i2, size_type n2);
 
        ///
-       lyxstring & replace(size_type i, size_type n, value_type const * p,
+       string & replace(size_type i, size_type n, value_type const * p,
                          size_type n2);
 
        ///
-       lyxstring & replace(size_type i, size_type n, value_type const * p);
+       string & replace(size_type i, size_type n, value_type const * p);
 
        ///
-       lyxstring & replace(size_type i, size_type n,
+       string & replace(size_type i, size_type n,
                            size_type n2, value_type c);
 
        /// FY! FY! FY! go away !
-       lyxstring & replace(size_type i, size_type n,
+       string & replace(size_type i, size_type n,
                            value_type c);
 
        ///
-       lyxstring & replace(iterator i, iterator i2, const lyxstring & str);
+       string & replace(iterator i, iterator i2, const string & str);
 
        ///
-       lyxstring & replace(iterator i, iterator i2,
+       string & replace(iterator i, iterator i2,
                          value_type const * p, size_type n);
 
        ///
-       lyxstring & replace(iterator i, iterator i2, value_type const * p);
+       string & replace(iterator i, iterator i2, value_type const * p);
 
        ///
-       lyxstring & replace(iterator i, iterator i2,
+       string & replace(iterator i, iterator i2,
                            size_type n , value_type c);
 
        ///
-       lyxstring & replace(iterator i, iterator i2, iterator j, iterator j2);
+       string & replace(iterator i, iterator i2, iterator j, iterator j2);
 
        ///
-       void swap(lyxstring & str);
+       void swap(string & str);
 
        /// Erase n chars from position i.
-       lyxstring & erase(size_type i = 0, size_type n = npos);
+       string & erase(size_type i = 0, size_type n = npos);
 
        ///
-       lyxstring & clear() {
+       string & clear() {
                return erase(0, npos);
        }
 
@@ -490,16 +492,16 @@ public:
 
 
        ///
-       int compare(lyxstring const & str) const;
+       int compare(string const & str) const;
 
        ///
        int compare(value_type const * p) const;
 
        ///
-       int compare(size_type pos, size_type n, lyxstring const & str) const;
+       int compare(size_type pos, size_type n, string const & str) const;
 
        ///
-       int compare(size_type pos, size_type n, lyxstring const & str,
+       int compare(size_type pos, size_type n, string const & str,
                    size_type pos2, size_type n2) const;
 
        ///
@@ -508,7 +510,7 @@ public:
 
 
        ///
-       lyxstring substr(size_type i = 0, size_type n = npos) const;
+       string substr(size_type i = 0, size_type n = npos) const;
 
 private:
        // These three operators can be used to discover erronous use of
@@ -517,11 +519,11 @@ private:
        // in. Use them for debugging only (or perhaps not even then.)
        // Lgb.
        //
-       //lyxstring & operator+(int);
+       //string & operator+(int);
        //
-       //lyxstring & operator=(int);
+       //string & operator=(int);
        //
-       //lyxstring & operator+=(int);
+       //string & operator+=(int);
 
        /// Compare this with s. works with embedded '\0' chars also.
        int internal_compare(size_type pos, size_type n,
@@ -537,7 +539,7 @@ private:
        Srep * rep;
 
        /* Note: The empty_rep is a local static in each function that
-           benefits from one. There is no "global" empty srep but lyxstring
+           benefits from one. There is no "global" empty srep but string
            doesn't need one (no code actually relies upon a single
            empty srep).
            This overcomes *all* "static initialization" problems,
@@ -547,55 +549,57 @@ private:
 
 #ifdef ENABLE_ASSERTIONS
        /// lyxstringInvariant is used to test the lyxstring Invariant
-       friend class lyxstringInvariant;
+       friend class stringInvariant;
 #endif
 };
 
 // The usual comparison operators ==, !=, >, <, >=, <= are
 // provided for lyxstrings
 
-bool operator==(lyxstring const &, lyxstring const &);
-bool operator==(lyxstring::value_type const *, lyxstring const &);
-bool operator==(lyxstring const &, lyxstring::value_type const *);
+bool operator==(string const &, string const &);
+bool operator==(string::value_type const *, string const &);
+bool operator==(string const &, string::value_type const *);
 
 
-bool operator!=(lyxstring const &, lyxstring const &);
-bool operator!=(lyxstring::value_type const *, lyxstring const &);
-bool operator!=(lyxstring const &, lyxstring::value_type const *);
+bool operator!=(string const &, string const &);
+bool operator!=(string::value_type const *, string const &);
+bool operator!=(string const &, string::value_type const *);
 
 
-bool operator>(lyxstring const &, lyxstring const &);
-bool operator>(lyxstring::value_type const *, lyxstring const &);
-bool operator>(lyxstring const &, lyxstring::value_type const *);
+bool operator>(string const &, string const &);
+bool operator>(string::value_type const *, string const &);
+bool operator>(string const &, string::value_type const *);
 
 
-bool operator<(lyxstring const &, lyxstring const &);
-bool operator<(lyxstring::value_type const *, lyxstring const &);
-bool operator<(lyxstring const &, lyxstring::value_type const *);
+bool operator<(string const &, string const &);
+bool operator<(string::value_type const *, string const &);
+bool operator<(string const &, string::value_type const *);
 
 
-bool operator>=(lyxstring const &, lyxstring const &);
-bool operator>=(lyxstring::value_type const *, lyxstring const &);
-bool operator>=(lyxstring const &, lyxstring::value_type const *);
+bool operator>=(string const &, string const &);
+bool operator>=(string::value_type const *, string const &);
+bool operator>=(string const &, string::value_type const *);
 
 
-bool operator<=(lyxstring const &, lyxstring const &);
-bool operator<=(lyxstring::value_type const *, lyxstring const &);
-bool operator<=(lyxstring const &, lyxstring::value_type const *);
+bool operator<=(string const &, string const &);
+bool operator<=(string::value_type const *, string const &);
+bool operator<=(string const &, string::value_type const *);
 
 
 // Concatenation
 
-lyxstring operator+(lyxstring const & a, lyxstring const & b);
-lyxstring operator+(char const * a, lyxstring const & b);
-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);
+string operator+(string const & a, string const & b);
+string operator+(char const * a, string const & b);
+string operator+(string::value_type a, string const & b);
+string operator+(string const & a, string::value_type const * b);
+string operator+(string const & a, string::value_type b);
+
+void swap(string & s1, string & s2);
 
-void swap(lyxstring & s1, lyxstring & s2);
+std::istream & operator>>(std::istream &, string &);
+std::ostream & operator<<(std::ostream &, string const &);
+std::istream & getline(std::istream &, string &, string::value_type delim = '\n');
 
-std::istream & operator>>(std::istream &, lyxstring &);
-std::ostream & operator<<(std::ostream &, lyxstring const &);
-std::istream & getline(std::istream &, lyxstring &, lyxstring::value_type delim = '\n');
+} // namespace lyx
 
 #endif
index f7e89fa200544eaa16c086a91650be70487c082e..6d6bbb5f029fe00b7668a12abb41b79a7141e7d7 100644 (file)
@@ -42,7 +42,7 @@ template class boost::detail::crc_table_t<32, 0x04C11DB7, true>;
 #include <sys/mman.h>
 
 
-unsigned long lyx::sum(string const & file)
+unsigned long lyx::support::sum(string const & file)
 {
        lyxerr[Debug::FILES] << "lyx::sum() using mmap (lightning fast)"
                             << endl;
@@ -98,7 +98,7 @@ unsigned long do_crc(InputIterator first, InputIterator last)
 using std::ifstream;
 using std::istreambuf_iterator;
 
-unsigned long lyx::sum(string const & file)
+unsigned long lyx::support::sum(string const & file)
 {
        lyxerr[Debug::FILES] << "lyx::sum() using istreambuf_iterator (fast)"
                             << endl;
@@ -116,7 +116,7 @@ unsigned long lyx::sum(string const & file)
 using std::istream_iterator;
 using std::ios;
 
-unsigned long lyx::sum(string const & file)
+unsigned long lyx::support::sum(string const & file)
 {
        lyxerr[Debug::FILES]
                << "lyx::sum() using istream_iterator (slow as a snail)"
index 577b3a0613eed9f6864b2d32ea3bba061f9cbfa8..e45d46728e4d1575d304355655d016406737e6bc 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "lyxlib.h"
 
-int lyx::mkdir(string const & pathname, unsigned long int mode)
+int lyx::support::mkdir(string const & pathname, unsigned long int mode)
 {
        // FIXME: why don't we have mode_t in lyx::mkdir prototype ??
        return ::mkdir(pathname.c_str(), mode_t(mode));
index 6edc51178644e2b4a121d80a2b3b4b66dbafcfd7..5d6c47f729666f462ac799ef669388ff01b3f266 100644 (file)
 #include "LString.h"
 
 /// wrap OS specific stuff
+namespace lyx {
+namespace support {
 namespace os {
-       //
-       enum shell_type {
-               UNIX,   // Do we have to distinguish sh and csh?
-               CMD_EXE
-       };
 
-       // do some work just once
-       void init(int * argc, char ** argv[]);
-       // returns path of LyX binary
-       string binpath();
-       // returns name of LyX binary
-       string binname();
-       // system_tempdir actually doesn't belong here
-       // I put it here only to avoid a global variable.
-       void setTmpDir(string const & p);
-       // 
-       string getTmpDir();
-       //
-       string current_root();
-       //
-       shell_type shell();
-       // DBCS aware!
-       string::size_type common_path(string const & p1, string const & p2);
-       // no-op on UNIX, '\\'->'/' on OS/2 and Win32, ':'->'/' on MacOS, etc.
-       string slashify_path(string const & p);
-       // converts a host OS path to unix style
-       string external_path(string const & p);
-       // converts a unix path to host OS style
-       string internal_path(string const & p);
-       // is path absolute?
-       bool is_absolute_path(string const & p);
-       // returns a string suitable to be passed to popen when
-       // same for popen().
+//
+enum shell_type {
+       UNIX,   // Do we have to distinguish sh and csh?
+       CMD_EXE
+};
+
+// do some work just once
+void init(int * argc, char ** argv[]);
+// returns path of LyX binary
+string binpath();
+// returns name of LyX binary
+string binname();
+// system_tempdir actually doesn't belong here
+// I put it here only to avoid a global variable.
+void setTmpDir(string const & p);
+//
+string getTmpDir();
+//
+string current_root();
+//
+shell_type shell();
+// DBCS aware!
+string::size_type common_path(string const & p1, string const & p2);
+// no-op on UNIX, '\\'->'/' on OS/2 and Win32, ':'->'/' on MacOS, etc.
+string slashify_path(string const & p);
+// converts a host OS path to unix style
+string external_path(string const & p);
+// converts a unix path to host OS style
+string internal_path(string const & p);
+// is path absolute?
+bool is_absolute_path(string const & p);
+// returns a string suitable to be passed to popen when
+// same for popen().
        char const * popen_read_mode();
-       //
-       void warn(string const & mesg);
-}
+//
+void warn(string const & mesg);
+
+} // namespace os
+} // namespace support
+} // namespace lyx
 
 #endif
index ddff701f52f9f6b7e60ab8ad787d4dd274026831..716dce17f41a0cfdc880bfbab281e3588e3fbed9 100644 (file)
@@ -24,7 +24,8 @@ string tmpdir_;
 
 }
 
-
+namespace lyx {
+namespace support {
 namespace os {
 
 void init(int * /*argc*/, char ** argv[])
@@ -144,4 +145,6 @@ shell_type shell()
        return UNIX;
 }
 
-} // end namespace os
+} // namespace os
+} // namespace support
+} // namespace lyx
index 23f13dcbb1f1d83d164c8214b6aa678d2802272b..31e2842019eaae9b36ed3d713258f56b759dc34e 100644 (file)
@@ -12,6 +12,9 @@
 
 #include "path.h"
 
+namespace lyx {
+namespace support {
+
 int Path::pop()
 {
        if (popped_) {
@@ -20,7 +23,7 @@ int Path::pop()
                return 0;
        }
 
-       if (lyx::chdir(pushedDir_)) {
+       if (chdir(pushedDir_)) {
                // should throw an exception
                // throw DirChangeError();
        }
@@ -28,3 +31,6 @@ int Path::pop()
 
        return 0;
 }
+
+} // namespace support
+} // namespace lyx
index 55b7c2bdb7a37f1364057c3fda1b848528fcfba5..1e71fbad88edb496dc57e9cc42672b8f11f9be12 100644 (file)
@@ -16,6 +16,9 @@
 #include "lyxlib.h"
 #include <boost/utility.hpp>
 
+namespace lyx {
+namespace support {
+
 /**
  * Path - utility closs for stackable working directories
  *
@@ -37,8 +40,8 @@ public:
                : popped_(false)
        {
                if (!path.empty()) {
-                       pushedDir_ = lyx::getcwd();
-                       if (pushedDir_.empty() || lyx::chdir(path))
+                       pushedDir_ = getcwd();
+                       if (pushedDir_.empty() || chdir(path))
                                /* FIXME: throw */;
                } else {
                        popped_ = true;
@@ -68,4 +71,7 @@ private:
 #define Path(x) unnamed_Path;
 // Tip gotten from Bobby Schmidt's column in C/C++ Users Journal
 
+} // namespace support
+} // namespace lyx
+
 #endif // PATH_H
index 828517d09f64dc7e261327546a6d22e09e9d06a1..68c37b692f6255af1a843d79ccda76d529da7b18 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <cstdlib>
 
-int lyx::putenv(char const * str)
+int lyx::support::putenv(char const * str)
 {
        return ::putenv(const_cast<char*>(str));
 }
index 4a927fdf71eeeeca27c22d9e355544599abb7c1f..a8cb72c5c28d27c31af9f0c0c3cc849394411f19 100644 (file)
 
 #include "support/lyxlib.h"
 
-bool lyx::rename(string const & from, string const & to)
+bool lyx::support::rename(string const & from, string const & to)
 {
 #ifdef __EMX__
-       lyx::unlink(to.c_str());
+       unlink(to);
 #endif
        if (::rename(from.c_str(), to.c_str()) == -1)
-               if (lyx::copy(from, to)) {
-                       lyx::unlink(from);
+               if (copy(from, to)) {
+                       unlink(from);
                        return true;
                } else
                        return false;
index a2aeeb8a087cea7f8200094d3ad1322a2abb9446..68529657fd17b20872b29b832c75fcc903f5ac2e 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "lyxlib.h"
 
-int lyx::rmdir(string const & dir)
+int lyx::support::rmdir(string const & dir)
 {
        return ::rmdir(dir.c_str());
 }
index b9a196d2caf370382fbdcce81a25f493f70fbe0f..939d9dcba5789f06e53cca25d972633bd04abcdf 100644 (file)
@@ -22,6 +22,9 @@
 using std::system;
 #endif
 
+namespace lyx {
+namespace support {
+
 // Reuse of instance
 int Systemcall::startscript(Starttype how, string const & what)
 {
@@ -37,3 +40,6 @@ int Systemcall::startscript(Starttype how, string const & what)
 
        return ::system(command.c_str());
 }
+
+} // namespace support
+} // namespace lyx
index d993b08f3301c97778f0fb5f589483bfe2457cfd..fda1b12bf12354b2f6ae57ae5e2926ba3d7c8bf7 100644 (file)
@@ -17,6 +17,9 @@
 
 #include "LString.h"
 
+namespace lyx {
+namespace support {
+
 /**
  * An instance of Class Systemcall represents a single child process.
  *
@@ -42,4 +45,7 @@ public:
        int startscript(Starttype how, string const & what);
 };
 
+} // namespace support
+} // namespace lyx
+
 #endif // SYSTEMCALL_H
index 780b1939c26379cbd0526983aadea85e2a8638e4..8dea9a6adf4689f991785a2d74f0d3ea66c402da 100644 (file)
@@ -22,7 +22,6 @@
 
 using std::endl;
 
-
 namespace {
 
 inline
@@ -42,7 +41,7 @@ int make_tempfile(char * templ)
 } // namespace anon
 
 
-string const lyx::tempName(string const & dir, string const & mask)
+string const lyx::support::tempName(string const & dir, string const & mask)
 {
        string const tmpdir(dir.empty() ? os::getTmpDir() : dir);
        string tmpfl(AddName(tmpdir, mask));
index 17d2bae887371157f6ee23e86038218f9199f2e6..bdd9d83434b5fa75315171fe3ea9c93fc4f36bc9 100644 (file)
@@ -50,7 +50,7 @@ public:
 
        /// Find the mapping for the first argument
        T2 const & find(T1 const & first) const {
-               lyx::Assert(!map.empty());
+               Assert(!map.empty());
 
                // For explanation see the next find() function.
                typename Map::const_iterator it =
@@ -67,7 +67,7 @@ public:
 
        /// Find the mapping for the second argument
        T1 const & find(T2 const & second) const {
-               lyx::Assert(!map.empty());
+               Assert(!map.empty());
 
                // The idea is as follows:
                // find_if() will try to compare the data in the vector with
index dd7e16e3b15b0b6cf261dd7e9192678b182dbba3..2c5d78f8f1fb7a09005067026e7e554ac6b20666 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "lyxlib.h"
 
-int lyx::unlink(string const & pathname)
+int lyx::support::unlink(string const & pathname)
 {
        return ::unlink(pathname.c_str());
 }
index 302474338395911a96cb31f488f05b4d3ea3be5e..24a84637df578bb0903e90bc97017f9c313bfd22 100644 (file)
 #include <sys/types.h>
 
 namespace lyx {
+namespace support {
 
 string const user_name()
 {
        struct passwd * pw(getpwuid(geteuid()));
-       lyx::Assert(pw);
+       Assert(pw);
 
        string name = pw->pw_gecos;
        if (name.empty())
@@ -40,5 +41,5 @@ string const user_email()
        return email;
 }
 
-
+} // namespace support
 } // namespace lyx
index 4e2042a145cdbe31affb28298263977c1dc80035..a451a588c4b93d7fcc692ea3f5cfcef41b29bbbf 100644 (file)
@@ -15,6 +15,7 @@
 #include "LString.h"
 
 namespace lyx {
+namespace support {
 
 /// return the current user's real name
 string const user_name();
@@ -22,6 +23,7 @@ string const user_name();
 /// return the current user's e-mail address
 string const user_email();
 
-}; // namespace lyx
+} // namespace support
+} // namespace lyx
 
 #endif // USERINFO_H
index b2a60adc34d5b715bd6cec8fa9d54a0d483ffed1..6496fbae99482a4212ef36c048697dd774ddb247 100644 (file)
@@ -37,6 +37,8 @@
 #include <algorithm>
 #include <cstdlib>
 
+using namespace lyx::support;
+
 using std::abs;
 using std::ostream;
 using std::istream;
@@ -149,7 +151,7 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
        // If this and lt is not of the same size we have a serious bug
        // So then it is ok to throw an exception, or for now
        // call abort()
-       lyx::Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
+       Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
        cur_cell = -1;
        cell_info = lt.cell_info;
        row_info = lt.row_info;
@@ -426,7 +428,7 @@ int LyXTabular::numberOfCellsInRow(int cell) const
 }
 
 
-// returns 1 if there is a topline, returns 0 if not 
+// returns 1 if there is a topline, returns 0 if not
 bool LyXTabular::topLine(int cell, bool onlycolumn) const
 {
        int const row = row_of_cell(cell);
@@ -1169,14 +1171,14 @@ void LyXTabular::read(Buffer const * buf, LyXLex & lex)
        l_getline(is, line);
        if (!prefixIs(line, "<lyxtabular ")
                && !prefixIs(line, "<LyXTabular ")) {
-               lyx::Assert(false);
+               Assert(false);
                return;
        }
 
        int version;
        if (!getTokenValue(line, "version", version))
                return;
-       lyx::Assert(version >= 2);
+       Assert(version >= 2);
 
        int rows_arg;
        if (!getTokenValue(line, "rows", rows_arg))
@@ -1479,7 +1481,7 @@ int LyXTabular::getCellNumber(int row, int column) const
        else if (row < 0)
                row = 0;
 #else
-       lyx::Assert(column >= 0 || column < columns_ || row >= 0 || row < rows_);
+       Assert(column >= 0 || column < columns_ || row >= 0 || row < rows_);
 #endif
        return cell_info[row][column].cellno;
 }
index ac2e2fbfe2e02a3618548d5ae2238bb387699423..4d88ecd75c73bcf382ddf975d3989d914ae6169f 100644 (file)
@@ -17,6 +17,8 @@
 #include "support/LIstream.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::strlen;
 #endif
index 4396e1989459bf91eaa2ddc0f26d4b09b5df8591..3109fcbe4cb0524d0688aa14b153d1ec7d641cab 100644 (file)
@@ -43,6 +43,8 @@
 
 #include <algorithm>
 
+using namespace lyx::support;
+
 using std::max;
 using std::min;
 using std::endl;
@@ -62,14 +64,14 @@ extern int bibitemMaxWidth(BufferView *, LyXFont const &);
 
 BufferView * LyXText::bv()
 {
-       lyx::Assert(bv_owner != 0);
+       Assert(bv_owner != 0);
        return bv_owner;
 }
 
 
 BufferView * LyXText::bv() const
 {
-       lyx::Assert(bv_owner != 0);
+       Assert(bv_owner != 0);
        return bv_owner;
 }
 
@@ -150,10 +152,10 @@ int LyXText::workWidth(Inset const * inset) const
        ParagraphList::iterator par = std::find(ownerParagraphs().begin(),
                                                ownerParagraphs().end(),
                                                *inset->parOwner());
-       //lyx::Assert(par);
+       //Assert(par);
 
        pos_type pos = par->getPositionOfInset(inset);
-       lyx::Assert(pos != -1);
+       Assert(pos != -1);
 
        LyXLayout_ptr const & layout = par->layout();
 
@@ -971,7 +973,7 @@ int LyXText::labelFill(Row const & row) const
 
        pos_type last = pit->beginningOfBody();
 
-       lyx::Assert(last > 0);
+       Assert(last > 0);
 
        // -1 because a label ends either with a space that is in the label,
        // or with the beginning of a footnote that is outside the label.
@@ -1011,7 +1013,7 @@ LColor::color LyXText::backgroundColor() const
 
 void LyXText::setHeightOfRow(RowList::iterator rit)
 {
-       lyx::Assert(rit != rows().end());
+       Assert(rit != rows().end());
 
        // get the maximum ascent and the maximum descent
        float layoutasc = 0;
@@ -1323,7 +1325,7 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
 // start at the implicit given position
 void LyXText::appendParagraph(RowList::iterator rowit)
 {
-       lyx::Assert(rowit != rowlist_.end());
+       Assert(rowit != rowlist_.end());
 
        pos_type const last = rowit->par()->size();
        bool done = false;
@@ -1353,7 +1355,7 @@ void LyXText::appendParagraph(RowList::iterator rowit)
 
 void LyXText::breakAgain(RowList::iterator rit)
 {
-       lyx::Assert(rit != rows().end());
+       Assert(rit != rows().end());
 
        bool not_ready = true;
 
@@ -1406,7 +1408,7 @@ void LyXText::breakAgain(RowList::iterator rit)
 // this is just a little changed version of break again
 void LyXText::breakAgainOneRow(RowList::iterator rit)
 {
-       lyx::Assert(rit != rows().end());
+       Assert(rit != rows().end());
 
        pos_type z = rowBreakPoint(*rit);
        RowList::iterator tmprit = rit;
index 1b805a51404aef41b2217bba9009971372ed94a4..dcc78c48ae42b15dd347938dae59e738e37e16a0 100644 (file)
@@ -47,6 +47,8 @@
 
 #include <boost/tuple/tuple.hpp>
 
+using namespace lyx::support;
+
 using std::vector;
 using std::copy;
 using std::endl;
@@ -115,7 +117,7 @@ void LyXText::init(BufferView * bview, bool reinit)
 LyXFont const LyXText::getFont(Buffer const * buf, ParagraphList::iterator pit,
                               pos_type pos) const
 {
-       lyx::Assert(pos >= 0);
+       Assert(pos >= 0);
 
        LyXLayout_ptr const & layout = pit->layout();
 
@@ -1128,7 +1130,7 @@ void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit)
                                else if (in->lyxCode() == Inset::WRAP_CODE)
                                        type = static_cast<InsetWrap*>(in)->params().type;
                                else
-                                       lyx::Assert(0);
+                                       Assert(0);
 
                                Floating const & fl = textclass.floats().getType(type);
 
@@ -1567,7 +1569,7 @@ bool LyXText::setCursor(ParagraphList::iterator pit,
 void LyXText::setCursor(LyXCursor & cur, ParagraphList::iterator pit,
                        pos_type pos, bool boundary)
 {
-       lyx::Assert(pit != ownerParagraphs().end());
+       Assert(pit != ownerParagraphs().end());
 
        cur.par(pit);
        cur.pos(pos);
index 33284bc3e9248f8cf65d1ab26c871b9e5e4c7faf..81952f4355a753b2077a2d70574d34fb515ad26a 100644 (file)
@@ -43,6 +43,8 @@
 #include <ctime>
 #include <clocale>
 
+using namespace lyx::support;
+
 using std::endl;
 using std::find;
 using std::vector;
@@ -107,7 +109,7 @@ namespace {
                        return 0;
 
                // get inset dimensions
-               lyx::Assert(par->getInset(pos));
+               Assert(par->getInset(pos));
 
                LyXFont const & font = text.getFont(bv->buffer(), par, pos);
 
@@ -920,7 +922,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
        }
 
        case LFUN_INSET_SETTINGS:
-               lyx::Assert(bv->theLockingInset());
+               Assert(bv->theLockingInset());
                bv->theLockingInset()->getLockingInset()->showInsetDialog(bv);
                break;
 
index 3c191cdd9e7aa1404e25f60d42e71e566930e8ce..3ef8608c77cf27e892d289d5bb03a6ca25075b72 100644 (file)
@@ -8,6 +8,8 @@
 #include "debug.h"
 #include "trans_mgr.h"
 
+using namespace lyx::support;
+
 using std::map;
 using std::endl;
 
index d4cc80fce2a3161c2a0ed7063767f1bb4bbc48a1..496bdd7394071d1b37038aa380fbadf29f63b810 100644 (file)
@@ -12,6 +12,8 @@
 #include "lyxrc.h"
 #include "support/lstrings.h"
 
+using namespace lyx::support;
+
 using std::endl;
 using std::pair;
 
index 92304179a4415fbb8a22b8b603b50f4a2490bb69..b0233213c7632b54da7bbc4a1e9b698010f26ccc 100644 (file)
@@ -62,7 +62,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
        // Set the right(new) inset-owner of the paragraph if there is any.
        UpdatableInset * inset =
                static_cast<UpdatableInset *>(buf->getInsetFromID(undo.inset_id));
-       
+
        ParagraphList::iterator pit = undo.pars.begin();
        ParagraphList::iterator end = undo.pars.end();
        for ( ; pit != end; ++pit)
@@ -130,7 +130,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
                        inset->localDispatch(cmd);
                }
        }
-       
+
        if (inset) {
                lyxerr << "fit cursor...\n";
                bv->fitCursor();
@@ -192,10 +192,10 @@ void createUndo(BufferView * bv, Undo::undo_kind kind,
        plist = &buf->paragraphs;
        // this is what we'd like to have in the end for small grained undo
        for (ParIterator it = buf->par_iterator_begin(); it != null; ++it) {
-               if (it->id() == first->id()) 
-                       first = it.outerPar(); 
+               if (it->id() == first->id())
+                       first = it.outerPar();
                if (it->id() == last->id())
-                       last = it.outerPar(); 
+                       last = it.outerPar();
        }
 
 #endif
index f862d6735663c984f2fdfb6f412a65714e913d8d..5c3e6f3731074ba2f3d9c3a5f4a873d9fdb63c7a 100644 (file)
@@ -17,6 +17,8 @@
 
 #include <fstream>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::asctime;
 using std::gmtime;
index a87181a6d3c8ca814245e3b016baf8c572c988ea..9b35ac7943d9bf0df766418b6e526acc32d40db6 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <cstdio>
 
+using namespace lyx::support;
+
 #ifndef CXX_GLOBAL_CSTD
 using std::sscanf;
 #endif