00001 // $Id: TDbiString.hxx,v 1.1 2011/01/18 05:49:20 finch Exp $ 00002 00003 #ifndef DBISTRING 00004 #define DBISTRING 00005 00006 /** 00007 * 00008 * $Id: TDbiString.hxx,v 1.1 2011/01/18 05:49:20 finch Exp $ 00009 * 00010 * \class TDbiString 00011 * 00012 * 00013 * \brief 00014 * <b>Concept</b> Output string stream - string that can be assembled 00015 * from basic types. 00016 * 00017 * \brief 00018 * <b>Purpose</b> This is used to assemble SQL commands. It was written 00019 * to plug what was then a deficiency in gcc ostrstream. It could be removed 00020 * now if I had the energy. 00021 * 00022 * Contact: A.Finch@lancaster.ac.uk 00023 * 00024 * 00025 */ 00026 00027 #include <string> 00028 00029 #ifndef ROOT_Rtypes 00030 #if !defined(__CINT__) || defined(__MAKECINT__) 00031 #include "Rtypes.h" 00032 #endif 00033 #endif 00034 00035 00036 class TDbiString 00037 { 00038 00039 public: 00040 00041 // Constructors and destructors. 00042 TDbiString(); 00043 TDbiString(const Char_t* str); 00044 TDbiString(const std::string& str); 00045 virtual ~TDbiString(); 00046 00047 // State testing member functions 00048 const Char_t* c_str() const { return fString.c_str(); } 00049 const std::string& GetString() const { return fString; } 00050 00051 // State changing member functions 00052 TDbiString& operator<<(Int_t data); 00053 TDbiString& operator<<(UInt_t data); 00054 TDbiString& operator<<(Float_t data); 00055 TDbiString& operator<<(Char_t data); 00056 TDbiString& operator<<(const Char_t* data); 00057 TDbiString& operator<<(const std::string& data); 00058 void Clear() { fString.clear(); } 00059 std::string& GetString() { return fString; } 00060 00061 private: 00062 00063 00064 // Data members 00065 00066 /// The underlying string 00067 std::string fString; 00068 00069 ClassDef(TDbiString,0) // output string stream 00070 00071 }; 00072 00073 00074 00075 #endif // DBISTRING 00076 00077