diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-07-12 14:48:01 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-07-12 14:48:01 +0000 |
commit | f414ac1343672c39882322693b0ff4e1ac8bd98a (patch) | |
tree | 77bfd2f5135a3ff306440dbf5b391a02a036b577 | |
parent | 1371129129a6e7a5234c1ffb23656af644633f87 (diff) |
INTEGRATION: CWS adc8 (1.8.16); FILE MERGED
2004/07/01 13:54:23 np 1.8.16.1: #i30968# Implement csv::StreamStr strip-functions. Also some general cosv maintenance. Fixing the bug with directory attributes in ploc_dir.cxx. Updating documentation. Making string classes 64-bit compatible by replacing UINT32 by ::size_t for the strings size- and position-type.
-rw-r--r-- | cosv/source/strings/streamstr.cxx | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/cosv/source/strings/streamstr.cxx b/cosv/source/strings/streamstr.cxx index f1c0341c3142..ce1334683d6a 100644 --- a/cosv/source/strings/streamstr.cxx +++ b/cosv/source/strings/streamstr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: streamstr.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: obo $ $Date: 2004-02-20 09:30:06 $ + * last change: $Author: rt $ $Date: 2004-07-12 15:48:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -542,6 +542,60 @@ StreamStr::operator_read_line( bstream & i_src ) } void +StreamStr::strip_front(char i_cToRemove) +{ + const_iterator it = begin(); + for ( ; + it != end() ? *it == i_cToRemove : false; + ++it ); + pop_front(it - begin()); +} + +void +StreamStr::strip_back(char i_cToRemove) +{ + const_iterator it = end(); + for ( ; + it != begin() ? *(it-1) == i_cToRemove : false; + --it ); + pop_back(end() - it); +} + +void +StreamStr::strip_frontback(char i_cToRemove) +{ + strip_front(i_cToRemove); + strip_back(i_cToRemove); +} + +void +StreamStr::strip_front_whitespace() +{ + const_iterator it = begin(); + for ( ; + it != end() ? *it < 33 : false; + ++it ); + pop_front(it - begin()); +} + +void +StreamStr::strip_back_whitespace() +{ + const_iterator it = end(); + for ( ; + it != begin() ? *(it-1) < 33 : false; + --it ); + pop_back(end() - it); +} + +void +StreamStr::strip_frontback_whitespace() +{ + strip_front_whitespace(); + strip_back_whitespace(); +} + +void StreamStr::replace( position_type i_nStart, size_type i_nSize, Area i_aReplacement ) |