Back to index

salome-smesh  6.5.0
SMESH_Comment.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 //  SMESH SMESH : implementaion of SMESH idl descriptions
00021 // File      : SMESH_Comment.hxx
00022 // Created   : Wed Mar 14 18:28:45 2007
00023 // Author    : Edward AGAPOV (eap)
00024 // Module    : SMESH
00025 // $Header: 
00026 //
00027 #ifndef SMESH_Comment_HeaderFile
00028 #define SMESH_Comment_HeaderFile
00029 
00030 # include <string>
00031 # include <sstream>
00032 
00033 using namespace std;
00034 
00038 class SMESH_Comment : public string
00039 {
00040   ostringstream _s ;
00041 
00042 public :
00043 
00044   SMESH_Comment():string("") {}
00045 
00046   SMESH_Comment(const SMESH_Comment& c):string() {
00047     _s << c.c_str() ;
00048     this->string::operator=( _s.str() );
00049   }
00050 
00051   SMESH_Comment & operator=(const SMESH_Comment& c) {
00052     _s << c.c_str() ;
00053     this->string::operator=( _s.str() );
00054     return *this;
00055   }
00056 
00057   template <class T>
00058   SMESH_Comment( const T &anything ) {
00059     _s << anything ;
00060     this->string::operator=( _s.str() );
00061   }
00062 
00063   template <class T>
00064   SMESH_Comment & operator<<( const T &anything ) {
00065     _s << anything ;
00066     this->string::operator=( _s.str() );
00067     return *this ;
00068   }
00069 
00070   operator char*() const {
00071     return (char*)c_str();
00072   }
00073 };
00074 
00075 
00076 #endif