Changeset 10342 for trunk/FACT++


Ignore:
Timestamp:
04/10/11 10:13:39 (13 years ago)
Author:
tbretz
Message:
Replaces local Trim function by new function from tools
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Description.cc

    r10311 r10342  
    2525Description as comment. The unit will remain empty.
    2626
    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.
     27You can omit either the name, the unit or the comment or any
     28combination of them. The descriptions of the individual format strings
     29are 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
     31have add empty brackets for the units.
    2932
    3033For a suggestion for rules for the names please have a look at:
     
    4144
    4245using namespace std;
    43 
    44 // --------------------------------------------------------------------------
    45 //
    46 //! This function removed whitshapces on both sides of a string.
    47 //!
    48 //! @param s
    49 //!     string to be cleaned
    50 //!
    51 //! @returns
    52 //!     string cleaned from whitespaces
    53 //
    54 string Description::Trim(string s)
    55 {
    56     // Trim Both leading and trailing spaces
    57     const size_t start = s.find_first_not_of(' '); // Find the first character position after excluding leading blank spaces
    58     const size_t end   = s.find_last_not_of(' ');  // Find the first character position from reverse af
    59 
    60     // if all spaces or empty return an empty string
    61     if (string::npos==start || string::npos==end)
    62         return string();
    63 
    64     return s.substr(start, end-start+1);
    65 }
    6646
    6747// --------------------------------------------------------------------------
     
    8767
    8868    // Extract a general description
    89     const string d = Description::Trim(desc.substr(0, p));
     69    const string d = Trim(desc.substr(0, p));
    9070
    9171    vector<Description> vec;
  • trunk/FACT++/src/Description.h

    r10297 r10342  
    44#include <string>
    55#include <vector>
     6
     7#include "tools.h"
    68
    79struct Description
     
    1113    std::string comment;
    1214
    13     static std::string Trim(std::string s);
    1415    static std::vector<Description> SplitDescription(const std::string &buffer);
    1516
Note: See TracChangeset for help on using the changeset viewer.