Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2008, 1:24:29 AM (17 years ago)
Author:
landauf
Message:

started implementing a config-file manager, but this is still unfinished.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/util/String.cc

    r994 r1006  
    5353    strip(&output);
    5454    return output;
     55}
     56
     57/**
     58    @brief Returns a copy of a string without trailing whitespaces.
     59    @param str The string
     60    @return The modified copy
     61*/
     62std::string removeTrailingWhitespaces(const std::string& str)
     63{
     64}
     65
     66/**
     67    @brief Returns true if the string contains something like '..."between quotes"...'
     68    @param The string
     69    @return True if there is something between quotes
     70*/
     71bool hasStringBetweenQuotes(const std::string& str)
     72{
     73}
     74
     75/**
     76    @brief If the string contains something like '..."between quotes"...' then 'between quotes' gets returned (without quotes).
     77    @param The string
     78    @param The string between the quotes
     79*/
     80std::string getStringBetweenQuotes(const std::string& str)
     81{
    5582}
    5683
     
    218245
    219246/**
    220  * @brief compares two strings without ignoring the case
    221  * @param s1 first string
    222  * @param s2 second string
    223  */
     247   @brief compares two strings without ignoring the case
     248   @param s1 first string
     249   @param s2 second string
     250*/
    224251int nocaseCmp(const std::string& s1, const std::string& s2)
    225252{
     
    246273
    247274/**
    248  * @brief compares two strings without ignoring the case
    249  * @param s1 first string
    250  * @param s2 second string
    251  * @param len how far from the beginning to start.
    252  */
     275   @brief compares two strings without ignoring the case
     276   @param s1 first string
     277   @param s2 second string
     278   @param len how far from the beginning to start.
     279*/
    253280int nocaseCmp(const std::string& s1, const std::string& s2, unsigned int len)
    254281{
     
    270297    return 0;
    271298}
     299
     300/**
     301    @brief Returns true if the string contains a comment, introduced by #, %, ; or //.
     302    @param str The string
     303    @return True if the string contains a comment
     304*/
     305bool hasComment(const std::string& str)
     306{
     307    return (getCommentPosition(str) != std::string::npos);
     308}
     309
     310/**
     311    @brief If the string contains a comment, the comment gets returned (including the comment symbol), an empty string otherwise.
     312    @param str The string
     313    @return The comment
     314*/
     315std::string getComment(const std::string& str)
     316{
     317    return str.substr(getCommentPosition(str));
     318}
     319
     320/**
     321    @brief If the string contains a comment, the position of the comment-symbol gets returned, std::string::npos otherwise.
     322    @param str The string
     323    @return The position
     324*/
     325unsigned int getCommentPosition(const std::string& str)
     326{
     327    for (unsigned int i = 0; i < str.size(); i++)
     328        if (isComment(str.substr(i)))
     329            return i;
     330
     331    return std::string::npos;
     332}
Note: See TracChangeset for help on using the changeset viewer.