Changeset 11026

Show
Ignore:
Timestamp:
03/20/07 13:46:06 (2 years ago)
Author:
mloskot
Message:

Added operator[] to CPLString (thanks to Nowak for suggestion).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/port/cpl_string.h

    r10913 r11026  
    170170{ 
    171171public: 
     172 
     173     
    172174    CPLString(void) {} 
    173175    CPLString( const std::string &oStr ) : std_string( oStr ) {} 
     
    176178    operator const char* (void) const { return c_str(); } 
    177179 
     180    char& operator[](std::string::size_type i) 
     181    { 
     182        return std::string::operator[](i); 
     183    } 
     184     
     185    const char& operator[](std::string::size_type i) const 
     186    { 
     187        return std::string::operator[](i); 
     188    } 
     189 
     190    char& operator[](int i) 
     191    { 
     192        return std::string::operator[](static_cast<std::string::size_type>(i)); 
     193    } 
     194 
     195    const char& operator[](int i) const 
     196    { 
     197        return std::string::operator[](static_cast<std::string::size_type>(i)); 
     198    } 
     199 
    178200    CPLString &Printf( const char *pszFormat, ... ); 
    179201    CPLString &vPrintf( const char *pszFormat, va_list args );