Message.h

Go to the documentation of this file.
00001 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00002  *
00003  * VR Juggler is (C) Copyright 1998-2005 by Iowa State University
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Christopher Just,
00007  *   Patrick Hartling, Kevin Meinert,
00008  *   Carolina Cruz-Neira, Albert Baker
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public
00021  * License along with this library; if not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * -----------------------------------------------------------------
00026  * File:          $RCSfile$
00027  * Date modified: $Date: 2005-01-16 17:51:42 -0600 (Sun, 16 Jan 2005) $
00028  * Version:       $Revision: 16627 $
00029  * -----------------------------------------------------------------
00030  *
00031  *************** <auto-copyright.pl END do not edit this line> ***************/
00032 
00033 #ifndef _VRJ_TEST_MESSAGE_H_
00034 #define _VRJ_TEST_MESSAGE_H_
00035 
00036 #include <vector>
00037 #include <string>
00038 #include <sstream>
00039 
00040 namespace vrj
00041 {
00042 
00043 namespace test
00044 {
00045 
00053 class Message
00054 {
00055 public:
00056    Message()
00057    {;}
00058 
00059    explicit Message(const std::string& shortDesc)
00060       : mShortDesc(shortDesc)
00061    {
00062       mShortDesc = shortDesc;
00063    }
00064 
00065    Message(const std::string& shortDesc, const std::string& detail1)
00066       : mShortDesc(shortDesc)
00067    {
00068       addDetail(detail1);
00069    }
00070 
00071    Message(const std::string &shortDesc, const std::string &detail1,
00072            const std::string &detail2)
00073       : mShortDesc(shortDesc)
00074    {
00075       addDetail(detail1, detail2);
00076    }
00077 
00078    Message(const std::string &shortDesc, const std::string &detail1,
00079            const std::string &detail2, const std::string &detail3)
00080      : mShortDesc(shortDesc)
00081    {
00082       addDetail(detail1, detail2, detail3);
00083    }
00084 
00088    const std::string& shortDesc()
00089    {
00090       return mShortDesc;
00091    }
00092 
00106    std::string details() const
00107    {
00108       std::stringstream oss;
00109 
00110       for(unsigned i=0;i<mDetails.size();++i)
00111       {
00112          oss << "- " << mDetails[i] << "\n";
00113       }
00114 
00115       return oss.str();
00116    }
00117 
00120    void clearDetails()
00121    {
00122       mDetails.clear();
00123    }
00124 
00126    const std::vector<std::string>& getDetails()
00127    {
00128       return mDetails;
00129    }
00130 
00132    void addDetail(const std::string &detail)
00133    {
00134       mDetails.push_back(detail);
00135    }
00136 
00138    void addDetail(const std::string& detail1, const std::string& detail2)
00139    {
00140       addDetail(detail1);
00141       addDetail(detail2);
00142    }
00143 
00145    void addDetail(const std::string &detail1, const std::string &detail2,
00146                   const std::string &detail3)
00147    {
00148       addDetail(detail1);
00149       addDetail(detail2);
00150       addDetail(detail3);
00151    }
00152 
00154    void setShortDesc(const std::string& shortDesc)
00155    {
00156       mShortDesc = shortDesc;
00157    }
00158 
00159 private:
00160   std::string              mShortDesc;    
00161   std::vector<std::string> mDetails;      
00162 };
00163 
00164 }
00165 
00166 }
00167 
00168 
00169 #endif

Generated on Thu Jan 4 10:56:51 2007 for VR Juggler by  doxygen 1.5.1