Changeset 10342 for trunk/FACT++/src/Description.cc
- Timestamp:
- 04/10/11 10:13:39 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Description.cc
r10311 r10342 25 25 Description as comment. The unit will remain empty. 26 26 27 You can omit either the name, the unit or the comment or any combination of them. 28 The descriptions of the individual format strings are separated by a vertical line. 27 You can omit either the name, the unit or the comment or any 28 combination of them. The descriptions of the individual format strings 29 are separated by a vertical line. If you want to enclose the name into 30 []-braces (e.g. marking an optional argument in a dim command), you 31 have add empty brackets for the units. 29 32 30 33 For a suggestion for rules for the names please have a look at: … … 41 44 42 45 using namespace std; 43 44 // --------------------------------------------------------------------------45 //46 //! This function removed whitshapces on both sides of a string.47 //!48 //! @param s49 //! string to be cleaned50 //!51 //! @returns52 //! string cleaned from whitespaces53 //54 string Description::Trim(string s)55 {56 // Trim Both leading and trailing spaces57 const size_t start = s.find_first_not_of(' '); // Find the first character position after excluding leading blank spaces58 const size_t end = s.find_last_not_of(' '); // Find the first character position from reverse af59 60 // if all spaces or empty return an empty string61 if (string::npos==start || string::npos==end)62 return string();63 64 return s.substr(start, end-start+1);65 }66 46 67 47 // -------------------------------------------------------------------------- … … 87 67 88 68 // Extract a general description 89 const string d = Description::Trim(desc.substr(0, p));69 const string d = Trim(desc.substr(0, p)); 90 70 91 71 vector<Description> vec;
Note:
See TracChangeset
for help on using the changeset viewer.