diff options
Diffstat (limited to 'src/formatter.cpp')
| -rw-r--r-- | src/formatter.cpp | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/src/formatter.cpp b/src/formatter.cpp index ce92caa..7eaa1e2 100644 --- a/src/formatter.cpp +++ b/src/formatter.cpp | |||
| @@ -120,30 +120,45 @@ void Bu::Formatter::read( void *sStr, int iLen ) | |||
| 120 | Bu::FString Bu::Formatter::readToken() | 120 | Bu::FString Bu::Formatter::readToken() |
| 121 | { | 121 | { |
| 122 | Bu::FString sRet; | 122 | Bu::FString sRet; |
| 123 | for(;;) | 123 | if( fLast.bTokenize ) |
| 124 | { | 124 | { |
| 125 | char buf; | 125 | for(;;) |
| 126 | int iRead = rStream.read( &buf, 1 ); | ||
| 127 | if( iRead == 0 ) | ||
| 128 | return sRet; | ||
| 129 | if( buf == ' ' || buf == '\t' || buf == '\n' || buf == '\r' ) | ||
| 130 | continue; | ||
| 131 | else | ||
| 132 | { | 126 | { |
| 133 | sRet += buf; | 127 | char buf; |
| 134 | break; | 128 | int iRead = rStream.read( &buf, 1 ); |
| 129 | if( iRead == 0 ) | ||
| 130 | return sRet; | ||
| 131 | if( buf == ' ' || buf == '\t' || buf == '\n' || buf == '\r' ) | ||
| 132 | continue; | ||
| 133 | else | ||
| 134 | { | ||
| 135 | sRet += buf; | ||
| 136 | break; | ||
| 137 | } | ||
| 138 | } | ||
| 139 | for(;;) | ||
| 140 | { | ||
| 141 | char buf; | ||
| 142 | int iRead = rStream.read( &buf, 1 ); | ||
| 143 | if( iRead == 0 ) | ||
| 144 | return sRet; | ||
| 145 | if( buf == ' ' || buf == '\t' || buf == '\n' || buf == '\r' ) | ||
| 146 | return sRet; | ||
| 147 | else | ||
| 148 | sRet += buf; | ||
| 135 | } | 149 | } |
| 136 | } | 150 | } |
| 137 | for(;;) | 151 | else |
| 138 | { | 152 | { |
| 139 | char buf; | 153 | for(;;) |
| 140 | int iRead = rStream.read( &buf, 1 ); | 154 | { |
| 141 | if( iRead == 0 ) | 155 | char buf; |
| 142 | return sRet; | 156 | int iRead = rStream.read( &buf, 1 ); |
| 143 | if( buf == ' ' || buf == '\t' || buf == '\n' || buf == '\r' ) | 157 | if( iRead == 0 ) |
| 144 | return sRet; | 158 | return sRet; |
| 145 | else | 159 | else |
| 146 | sRet += buf; | 160 | sRet += buf; |
| 161 | } | ||
| 147 | } | 162 | } |
| 148 | } | 163 | } |
| 149 | 164 | ||
| @@ -228,6 +243,12 @@ Bu::Formatter::Fmt &Bu::Formatter::Fmt::caps( bool bCaps ) | |||
| 228 | return *this; | 243 | return *this; |
| 229 | } | 244 | } |
| 230 | 245 | ||
| 246 | Bu::Formatter::Fmt &Bu::Formatter::Fmt::tokenize( bool bTokenize ) | ||
| 247 | { | ||
| 248 | this->bTokenize = bTokenize; | ||
| 249 | return *this; | ||
| 250 | } | ||
| 251 | |||
| 231 | Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::Formatter::Fmt &fmt ) | 252 | Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::Formatter::Fmt &fmt ) |
| 232 | { | 253 | { |
| 233 | f.setTempFormat( fmt ); | 254 | f.setTempFormat( fmt ); |
