Changeset 10486 for trunk/FACT++
- Timestamp:
- 04/28/11 17:35:33 (14 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventImp.cc
r10423 r10486 186 186 187 187 return find(fAllowedStates.begin(), fAllowedStates.end(), state)!=fAllowedStates.end(); 188 } 189 190 // -------------------------------------------------------------------------- 191 // 192 //! @returns the event data converted to a std::string. Trailing redundant 193 //! \0's are removed. 194 //! 195 string EventImp::GetString() const 196 { 197 size_t s = GetSize()-1; 198 while (s>0 && GetText()[s]==0) 199 s--; 200 201 return std::string(GetText(), s+1); 188 202 } 189 203 -
trunk/FACT++/src/EventImp.h
r10423 r10486 35 35 EventImp &operator()(const std::string str) { SetDescription(str); return *this; } 36 36 EventImp &operator()(const char *str) { SetDescription(str); return *this; } 37 EventImp &operator()(int state) { fAllowedStates.push_back(state); return *this; } 37 38 38 39 // Print contents … … 65 66 double GetDouble() const { return *reinterpret_cast<const double*>(GetData()); } 66 67 const char *GetText() const { return reinterpret_cast<const char*>(GetData()); } 67 std::string GetString() const { return std::string(GetText(), GetSize()); }68 68 std::vector<char> GetVector() const { return std::vector<char>(GetText(), GetText()+GetSize()); } 69 69 std::string GetString() const; 70 70 }; 71 71
Note:
See TracChangeset
for help on using the changeset viewer.