]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.h
use the new sstream return non-pods as const, use string instead of char * in a lot...
[lyx.git] / src / mathed / math_inset.h
index 1deccae3228ad4873bc4d1175be7fa620c5c234a..1b374a866d7b25c2c94939a5936d0d52ec2065d8 100644 (file)
@@ -8,7 +8,7 @@
  *
  *  Dependencies: Xlib, XForms
  *
- *  Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra
+ *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
  *
  *   Version: 0.8beta, Mathed & Lyx project.
  *
 #include "symbol_def.h"
 #include "LString.h"
 
-
 /**
  Functions or LaTeX names for objects that I don't know how to draw.
  */
 class MathFuncInset: public MathedInset  {
 public:
        ///
-       MathFuncInset(char const * nm,
+       explicit
+       MathFuncInset(string const & nm,
                      short ot = LM_OT_FUNC, short st = LM_ST_TEXT);
        ///
        ~MathFuncInset();
@@ -46,11 +46,7 @@ public:
        ///
        void draw(Painter &, int, int);
        ///
-       void Write(ostream &);
-#ifndef USE_OSTREAM_ONLY
-       ///
-       void Write(string & file);
-#endif
+       void Write(std::ostream &, bool fragile);
        ///
        void Metrics();
        ///
@@ -61,7 +57,7 @@ protected:
        ///
        bool lims;
        ///
-       char * fname;
+       string fname;
 };
 
 
@@ -79,11 +75,7 @@ public:
        ///
        void draw(Painter &, int, int);
        ///
-       void Write(ostream &);
-#ifndef USE_OSTREAM_ONLY
-       ///
-       void Write(string & file);
-#endif
+       void Write(std::ostream &, bool fragile);
        ///
        void Metrics();
        ///
@@ -107,17 +99,13 @@ protected:
 class MathDotsInset: public MathedInset {
 public:
        ///
-       MathDotsInset(char const *, int, short st = LM_ST_TEXT);
+       MathDotsInset(string const &, int, short st = LM_ST_TEXT);
        ///
        MathedInset * Clone();
        ///
        void draw(Painter &, int, int);
        ///
-       void Write(ostream &);
-#ifndef USE_OSTREAM_ONLY
-       ///
-       void Write(string & file);
-#endif
+       void Write(std::ostream &, bool fragile);
        ///
        void Metrics();
 protected:
@@ -136,11 +124,7 @@ public:
        ///
        void draw(Painter &, int, int);
        ///
-       void Write(ostream &);
-#ifndef USE_OSTREAM_ONLY
-       ///
-       void Write(string & file);
-#endif
+       void Write(std::ostream &, bool fragile);
        ///
        inline void Metrics();
        ///
@@ -157,17 +141,13 @@ protected:
 class MathBigopInset: public MathedInset {
 public:
        ///
-       MathBigopInset(char const *, int, short st = LM_ST_TEXT);
+       MathBigopInset(string const &, int, short st = LM_ST_TEXT);
        ///
        MathedInset * Clone();
        ///
        void draw(Painter &, int, int);
        ///
-       void Write(ostream &);
-#ifndef USE_OSTREAM_ONLY
-       ///
-       void Write(string & file);
-#endif
+       void Write(std::ostream &, bool fragile);
        ///
        void Metrics();
        ///
@@ -194,11 +174,7 @@ public:
        ///
        void draw(Painter &, int x, int baseline);
        ///
-       void Write(ostream &);
-#ifndef USE_OSTREAM_ONLY
-       ///
-       void Write(string & file);
-#endif
+       void Write(std::ostream &, bool fragile);
        ///
        void Metrics();
        ///
@@ -221,11 +197,7 @@ public:
        ///
        void draw(Painter &, int x, int baseline);
        ///
-       void Write(ostream &);
-#ifndef USE_OSTREAM_ONLY
-       ///
-       void Write(string & file);
-#endif
+       void Write(std::ostream &, bool fragile);
        ///
        void Metrics();
        
@@ -271,11 +243,7 @@ public:
        ///
        void draw(Painter &, int, int);
        ///
-       void Write(ostream &);
-#ifndef USE_OSTREAM_ONLY
-       ///
-       void Write(string & file);
-#endif
+       void Write(std::ostream &, bool fragile);
        ///
        void Metrics();
 protected:
@@ -296,11 +264,7 @@ public:
        ///
        void draw(Painter &, int, int);
        ///
-       void Write(ostream &);
-#ifndef USE_OSTREAM_ONLY
-       ///
-       void Write(string & file);
-#endif
+       void Write(std::ostream &, bool fragile);
        ///
        void Metrics();
        ///
@@ -320,9 +284,7 @@ protected:
  
 inline
 MathFuncInset::~MathFuncInset()
-{
-    if (fname && GetType() == LM_OT_UNDEF) delete[] fname;
-}
+{}
 
 
 inline
@@ -333,23 +295,12 @@ bool MathFuncInset::GetLimits() const
 
 
 inline
-void MathFuncInset::Write(ostream & os)
+void MathFuncInset::Write(std::ostream & os, bool /* fragile */)
 {
        os << "\\" << name << ' ';
 }
 
 
-#ifndef USE_OSTREAM_ONLY
-inline
-void MathFuncInset::Write(string & file)
-{
-   file += '\\';
-   file += name;
-   file += ' ';
-}
-#endif
-
-
 inline
 void MathSpaceInset::Metrics()
 {