]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcommand.C
fix compilation pb ; update eu.po
[lyx.git] / src / insets / insetcommand.C
index 6260da9615442c334bced468d273a1c8794940b0..a1533070a59425dd0d069438a63f6525dcd5c3f6 100644 (file)
@@ -33,47 +33,46 @@ InsetCommandParams::InsetCommandParams( string const & n,
 {}
 
 
-string InsetCommandParams::getAsString() const
+string const InsetCommandParams::getAsString() const
 {
-       string b(cmdname);
-       b += "|++|" + options + "|++|" + contents;
-       return b;
+       return cmdname + "|++|" + contents + "|++|" + options;
 }
 
 
 void InsetCommandParams::setFromString( string const & b )
 {
        string::size_type idx = b.find("|++|");
-       if( idx == string::npos ) return;
+       if (idx == string::npos) {
+               cmdname = b;
+               contents = "";
+               options = "";
+               return;
+       }
 
        cmdname = b.substr(0, idx);
        string tmp = b.substr(idx+4);
 
        idx = tmp.find("|++|");
-       if( idx == string::npos ) {
-               options = tmp;
+       if (idx == string::npos) {
+               contents = tmp;
+               options = "";
        } else {
-               options  = tmp.substr(0, idx);
-               contents = tmp.substr(idx+4);
+               contents  = tmp.substr(0, idx);
+               options = tmp.substr(idx+4);
        }
 }
 
 
 bool InsetCommandParams::operator==(InsetCommandParams const & o) const
 {
-       if( cmdname  != o.cmdname )  return false;
-       if( contents != o.contents ) return false;
-       if( options  != o.options )  return false;
-       return true;
+       if (cmdname == o.cmdname && contents == o.contents && options == o.options) return true;
+       return false;
 }
 
 
 bool InsetCommandParams::operator!=(InsetCommandParams const & o) const
 {
-       if( cmdname  != o.cmdname )  return true;
-       if( contents != o.contents ) return true;
-       if( options  != o.options )  return true;
-       return false;
+       return !(*this == o);
 }
 
 
@@ -168,7 +167,7 @@ void InsetCommandParams::Write(ostream & os) const
 }
 
 
-string InsetCommandParams::getCommand() const
+string const InsetCommandParams::getCommand() const
 {      
        string s;
        if (!getCmdName().empty()) s += "\\"+getCmdName();
@@ -199,7 +198,7 @@ int InsetCommand::Latex(Buffer const *, ostream & os,
 }
 
 
-int InsetCommand::Ascii(Buffer const *, ostream &) const
+int InsetCommand::Ascii(Buffer const *, ostream &, int) const
 {
        return 0;
 }