]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetlabel.C
clear()->erase() ; lots of using directives for cxx
[lyx.git] / src / insets / insetlabel.C
index 2ebb685295e86b4ca01490d5b20c2308b010f4aa..0973ad239cd1b419a570cc4609693deaf86241a3 100644 (file)
@@ -4,9 +4,9 @@
  *           LyX, The Document Processor
  *      
  *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-1999 The LyX Team.
+ *          Copyright 1995-2000 The LyX Team.
  *
- * ======================================================*/
+ * ====================================================== */
 
 #include <config.h>
 
@@ -15,6 +15,9 @@
 #endif
 
 #include "insetlabel.h"
+#include "support/LOstream.h"
+
+using std::ostream;
 
 /* Label. Used to insert a label automatically */
 
@@ -25,15 +28,9 @@ InsetLabel::InsetLabel(string const & cmd)
 }
 
 
-InsetLabel::~InsetLabel()
+Inset * InsetLabel::Clone() const
 {
-}
-
-
-Inset* InsetLabel::Clone()
-{
-       InsetLabel *result = new InsetLabel(getCommand());
-       return result;
+       return new InsetLabel(getCommand());
 }
 
 
@@ -48,30 +45,31 @@ string InsetLabel::getLabel(int) const
        return contents;
 }
 
-int InsetLabel::Latex(FILE *file, signed char /*fragile*/)
+
+int InsetLabel::Latex(ostream & os,
+                     bool /*fragile*/, bool /*fs*/) const
 {
-       fprintf(file, "%s", escape(getCommand()).c_str());
+       os << escape(getCommand());
        return 0;
 }
 
-
-int InsetLabel::Latex(string &file, signed char /*fragile*/)
+int InsetLabel::Ascii(ostream & os) const
 {
-       file += escape(getCommand());
+       os << "<" << getContents()  << ">";
        return 0;
 }
 
 
-int InsetLabel::Linuxdoc(string &file)
+int InsetLabel::Linuxdoc(ostream & os) const
 {
-       file += "<label id=\"" + getContents() +"\" >";
+       os << "<label id=\"" << getContents() << "\" >";
        return 0;
 }
 
 
-int InsetLabel::DocBook(string &file)
+int InsetLabel::DocBook(ostream & os) const
 {
-       file += "<anchor id=\"" + getContents() +"\" >";
+       os << "<anchor id=\"" << getContents() << "\" >";
        return 0;
 }
 
@@ -82,14 +80,14 @@ string InsetLabel::escape(string const & lab) const {
        char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
                              '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
        string enc;
-       for (string::size_type i=0; i<lab.length(); i++) {
-               unsigned char c=lab[i];
-               if (c >= 128 || c=='=' || c=='%') {
+       for (string::size_type i= 0; i < lab.length(); ++i) {
+               unsigned char c = lab[i];
+               if (c >= 128 || c == '=' || c == '%') {
                        enc += '=';
-                       enc += hexdigit[c>>4];
+                       enc += hexdigit[c >> 4];
                        enc += hexdigit[c & 15];
                } else {
-                       enc += (char) c;
+                       enc += c;
                }
        }
        return enc;