]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcommand.C
prepare for 1.1.6pre2
[lyx.git] / src / insets / insetcommand.C
index 6260da9615442c334bced468d273a1c8794940b0..b3ff8cbba3d5aa5c2ef566cd104c52b50e846000 100644 (file)
@@ -33,7 +33,7 @@ InsetCommandParams::InsetCommandParams( string const & n,
 {}
 
 
-string InsetCommandParams::getAsString() const
+string const InsetCommandParams::getAsString() const
 {
        string b(cmdname);
        b += "|++|" + options + "|++|" + contents;
@@ -44,13 +44,18 @@ string InsetCommandParams::getAsString() const
 void InsetCommandParams::setFromString( string const & b )
 {
        string::size_type idx = b.find("|++|");
-       if( idx == string::npos ) return;
+       if (idx == string::npos) {
+               cmdname = "";
+               options  = "";
+               contents = "";
+               return;
+       }
 
        cmdname = b.substr(0, idx);
        string tmp = b.substr(idx+4);
 
        idx = tmp.find("|++|");
-       if( idx == string::npos ) {
+       if (idx == string::npos) {
                options = tmp;
        } else {
                options  = tmp.substr(0, idx);
@@ -61,19 +66,14 @@ void InsetCommandParams::setFromString( string const & b )
 
 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 +168,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 +199,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;
 }