diff options
author | Nikolai Pretzell <np@openoffice.org> | 2002-05-14 07:08:46 +0000 |
---|---|---|
committer | Nikolai Pretzell <np@openoffice.org> | 2002-05-14 07:08:46 +0000 |
commit | 41022e5f7242a979eb757a5eb51b45d5fba6d200 (patch) | |
tree | 21e3588c9a9b1b4ee40a7207c34f117c18fc276b /cosv | |
parent | 5e64ff8760e61b03b13726ab90f14cbf6324e309 (diff) |
#98964#, New layout for IDL-docu and some fixes for gcc and in Filehandling
Diffstat (limited to 'cosv')
-rw-r--r-- | cosv/inc/cosv/comfunc.hxx | 10 | ||||
-rw-r--r-- | cosv/inc/cosv/csv_env.hxx | 29 | ||||
-rw-r--r-- | cosv/inc/cosv/csv_precomp.h | 6 | ||||
-rw-r--r-- | cosv/inc/cosv/openclose.hxx | 6 | ||||
-rw-r--r-- | cosv/inc/cosv/persist.hxx | 6 | ||||
-rw-r--r-- | cosv/inc/cosv/ploc.hxx | 8 | ||||
-rw-r--r-- | cosv/inc/cosv/ploc_dir.hxx | 4 | ||||
-rw-r--r-- | cosv/inc/cosv/streamstr.hxx | 28 | ||||
-rw-r--r-- | cosv/prj/build.lst | 3 | ||||
-rw-r--r-- | cosv/source/comphelp/badcast.cxx | 79 | ||||
-rw-r--r-- | cosv/source/comphelp/makefile.mk | 90 | ||||
-rw-r--r-- | cosv/source/service/std_outp.cxx | 6 | ||||
-rw-r--r-- | cosv/source/storage/file.cxx | 34 | ||||
-rw-r--r-- | cosv/source/storage/ploc.cxx | 13 | ||||
-rw-r--r-- | cosv/source/storage/plocroot.cxx | 7 | ||||
-rw-r--r-- | cosv/source/strings/streamstr.cxx | 59 | ||||
-rw-r--r-- | cosv/util/makefile.mk | 9 |
17 files changed, 333 insertions, 64 deletions
diff --git a/cosv/inc/cosv/comfunc.hxx b/cosv/inc/cosv/comfunc.hxx index ea9badcb454a..a1c05f8e7bee 100644 --- a/cosv/inc/cosv/comfunc.hxx +++ b/cosv/inc/cosv/comfunc.hxx @@ -2,9 +2,9 @@ * * $RCSfile: comfunc.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: np $ $Date: 2002-03-22 10:22:47 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,11 +117,11 @@ switch_endian( NUMTYPE & o_rNumber, const NUMTYPE & i_rNumber ) { char * pFront = reinterpret_cast< char* >(&o_rNumber); - const char * pBack = reinterpret_cast< const char* >(&i_rNumber) + (sizeof(NUMTYPE) - 1); + const char * pBack = reinterpret_cast< const char* >(&i_rNumber) + sizeof(NUMTYPE); - for ( unsigned int p = sizeof(NUMTYPE); p != 0; --p ) + for ( size_t p = 0; p < sizeof(NUMTYPE); --p ) { - *pFront++ = *pBack--; + *pFront++ = *(--pBack); } } diff --git a/cosv/inc/cosv/csv_env.hxx b/cosv/inc/cosv/csv_env.hxx index 746cfb7822d4..8dbd6ae5380d 100644 --- a/cosv/inc/cosv/csv_env.hxx +++ b/cosv/inc/cosv/csv_env.hxx @@ -2,9 +2,9 @@ * * $RCSfile: csv_env.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,7 +67,7 @@ // BEGIN Compiler dependent defines regarding standard compliance, // subject to changes: // #define CSV_NO_BOOL_TYPE // States that no system type 'bool' exists -#define CSV_NO_MUTABLE // No keyword mutable +// #define CSV_NO_MUTABLE // No keyword mutable #define CSV_NO_EXPLICIT // No keyword explicit // #define CSV_NO_IOSTREAMS // No iostreams // END Compiler dependent defines, subject to changes @@ -158,22 +158,27 @@ void PerformAssertion( // Subject to change to more sophisticated handling #define precond(x) csv_assert(x) #define postcond(x) csv_assert(x) -#define csv_assert(x) ( (x) ? (void)(0) : csv::PerformAssertion( #x, __FILE__, __LINE__) ) -#define csv_noimpl(x) csv::PerformAssertion( "Functon " #x " is not yet implemented.", __FILE__, __LINE__) -#define csv_exception csv::PerformAssertion( "Exception to be raised.", __FILE__, __LINE__) + +#ifdef CSV_USE_CSV_ASSERTIONS +#define csv_assert(x) ( (x) ? (void)(0) : ::csv::PerformAssertion( #x, __FILE__, __LINE__) ) +#define csv_noimpl(x) ::csv::PerformAssertion( "Functon " #x " is not yet implemented.", __FILE__, __LINE__) +#define csv_exception ::csv::PerformAssertion( "Exception to be raised.", __FILE__, __LINE__) #else +#include <assert.h> +#define csv_assert(x) assert(x); +#define csv_noimpl(x) assert(x); +#define csv_exception assert(x); +#endif + +#else // #ifndef CSV_NO_ASSERTIONS else + #define precond(x) #define postcond(x) #define csv_assert(x) #define csv_noimpl(x) #define csv_exception -#endif // end ifndef NDEBUG else - - - - - +#endif // end ifndef CSV_NO_ASSERTIONS else diff --git a/cosv/inc/cosv/csv_precomp.h b/cosv/inc/cosv/csv_precomp.h index 301776c6283c..7a36fa77ecc8 100644 --- a/cosv/inc/cosv/csv_precomp.h +++ b/cosv/inc/cosv/csv_precomp.h @@ -2,9 +2,9 @@ * * $RCSfile: csv_precomp.h,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,7 +63,9 @@ #define __CSV_PRECOMP_H_06071998__ +#define CSV_USE_CSV_ASSERTIONS #include <cosv/csv_env.hxx> + #include <cosv/comfunc.hxx> #include <cosv/string.hxx> #include <cosv/streamstr.hxx> diff --git a/cosv/inc/cosv/openclose.hxx b/cosv/inc/cosv/openclose.hxx index 1c4bf59805bc..f92184d06a30 100644 --- a/cosv/inc/cosv/openclose.hxx +++ b/cosv/inc/cosv/openclose.hxx @@ -2,9 +2,9 @@ * * $RCSfile: openclose.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -153,7 +153,7 @@ OpenCloseGuard::OpenCloseGuard( OpenClose & i_rOpenClose, { rOpenClose.open(i_nOpenModeInfo); } inline OpenCloseGuard::~OpenCloseGuard() - { rOpenClose.close(); } + { if (rOpenClose.is_open()) rOpenClose.close(); } inline OpenCloseGuard::operator bool() const { return rOpenClose.is_open(); } diff --git a/cosv/inc/cosv/persist.hxx b/cosv/inc/cosv/persist.hxx index 579754ff4682..cd36c9b5e5b3 100644 --- a/cosv/inc/cosv/persist.hxx +++ b/cosv/inc/cosv/persist.hxx @@ -2,9 +2,9 @@ * * $RCSfile: persist.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,7 +98,7 @@ class Persistent virtual ~Persistent() {} const Path & MyPath() const; - /// @return Path of directories without completing delimiter. + /// @return all pathes without completing delimiter, even directories. const char * StrPath() const; bool Exists() const; diff --git a/cosv/inc/cosv/ploc.hxx b/cosv/inc/cosv/ploc.hxx index 3ec4542693f6..d242a2f302e9 100644 --- a/cosv/inc/cosv/ploc.hxx +++ b/cosv/inc/cosv/ploc.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ploc.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -115,8 +115,10 @@ class Path bool IsDirectory() const { return sFile.length() == 0; } bool IsFile() const { return sFile.length() > 0; } + /// Directories have a delimiter at the end, files not. virtual void Get( ostream & o_rPath ) const; + /// Directories have a delimiter at the end, files not. virtual void Get( bostream & o_rPath ) const; // ACCESS @@ -136,6 +138,7 @@ class Path +/// Directories produce a delimiter at the end, files not. inline csv::ostream & operator<<( csv::ostream & o_rOut, const csv::ploc::Path & i_rPath ) @@ -144,6 +147,7 @@ operator<<( csv::ostream & o_rOut, return o_rOut; } +/// Directories produce a delimiter at the end, files not. inline csv::bostream & operator<<( csv::bostream & o_rOut, const csv::ploc::Path & i_rPath ) diff --git a/cosv/inc/cosv/ploc_dir.hxx b/cosv/inc/cosv/ploc_dir.hxx index 1dfd2634dd39..aa39ee2365a1 100644 --- a/cosv/inc/cosv/ploc_dir.hxx +++ b/cosv/inc/cosv/ploc_dir.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ploc_dir.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: np $ $Date: 2002-05-02 12:35:10 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/cosv/inc/cosv/streamstr.hxx b/cosv/inc/cosv/streamstr.hxx index e17b8cdd3001..419f025927f7 100644 --- a/cosv/inc/cosv/streamstr.hxx +++ b/cosv/inc/cosv/streamstr.hxx @@ -2,9 +2,9 @@ * * $RCSfile: streamstr.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,9 +76,12 @@ namespace csv { +class String; void c_str(); // Dummy needed for StreamStr::operator<<(StreamStr::F_CSTR); + + /** Diese Klasse hat alle Funktionalitaet von strstream. Der Buffer braucht jedoch weder uebergeben noch (nach Gebrauch) geloescht zu werden. Seine Groesse wird @@ -127,13 +130,13 @@ class StreamStr : public bostream const char * str1, // [!= 0] const char * str2, // [!= 0] ... ); // Has to end with NIL . - /// Copies also inssert_mode and current position. + /// Copies also insert_mode and current position. StreamStr( const self & i_rOther ); ~StreamStr(); // OPERATORS - /// Copies also inssert_mode and current position. + /// Copies also insert_mode and current position. self & operator=( const self & i_rOther ); @@ -186,6 +189,7 @@ class StreamStr : public bostream self & seekp( seek_type i_nCount, seek_dir i_eDirection = ::csv::beg ); + self & reset() { return seekp(0); } /** Sets the insertion mode of all and only the operator<<() calls. str::overwrite: seekp() always sets the cur end of the string. @@ -212,6 +216,22 @@ class StreamStr : public bostream void pop_back( size_type i_nCount ); + /// Works like operator<<() + self & operator_join( + std::vector<String>::const_iterator + i_rBegin, + std::vector<String>::const_iterator + i_rEnd, + const char * i_sLink ); + /// Works like operator<<() + self & operator_add_substr( + const char * i_sText, + size_type i_nLength ); + /// Works like operator<<() + self & operator_add_token( + const char * i_sText, + char i_cDelimiter ); + //*********** Not yet implemented *********************// void strip_front( char i_cToRemove ); diff --git a/cosv/prj/build.lst b/cosv/prj/build.lst index 98d5b81f7195..a5978a787f13 100644 --- a/cosv/prj/build.lst +++ b/cosv/prj/build.lst @@ -10,6 +10,7 @@ cs cosv\source\inc get - all cs_src_inc NULL cs cosv\source\service nmake - all cs_serv NULL cs cosv\source\storage nmake - all cs_store NULL cs cosv\source\strings nmake - all cs_string NULL -cs cosv\util nmake - all cs_util cs_serv cs_store cs_string NULL +cs cosv\source\comphelp nmake - all cs_badcast NULL +cs cosv\util nmake - all cs_util cs_serv cs_store cs_string cs_badcast NULL #============================================================================================== diff --git a/cosv/source/comphelp/badcast.cxx b/cosv/source/comphelp/badcast.cxx new file mode 100644 index 000000000000..253d34ddbc18 --- /dev/null +++ b/cosv/source/comphelp/badcast.cxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * $RCSfile: badcast.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: np $ $Date: 2002-05-14 08:08:46 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + + +/* Include this for instantiating bad-cast, + due to problems with WNT-STL-headers. +*/ + +#ifdef WNT + +#define _NTSDK +#include<typeinfo> + +_STD_BEGIN +bad_cast G_Dummy_Inst_bad_cast; +_STD_END +#endif // WNT + + + diff --git a/cosv/source/comphelp/makefile.mk b/cosv/source/comphelp/makefile.mk new file mode 100644 index 000000000000..e7c6d1895476 --- /dev/null +++ b/cosv/source/comphelp/makefile.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: np $ $Date: 2002-05-14 08:08:46 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=cosv +TARGET=cosv_badcast_wnt +TARGETTYPE=CUI + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true + +.INCLUDE : settings.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/badcast.obj + + + +# --- Targets ------------------------------------------------------ + + +.INCLUDE : target.mk + + + diff --git a/cosv/source/service/std_outp.cxx b/cosv/source/service/std_outp.cxx index 6496303802ac..f12e5ddb7111 100644 --- a/cosv/source/service/std_outp.cxx +++ b/cosv/source/service/std_outp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: std_outp.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: np $ $Date: 2002-05-02 12:35:10 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,7 +63,7 @@ #include <cosv/std_outp.hxx> // NOT FULLY DECLARED SERVICES -#include <stdlib.h> +#include "stdlib.h" namespace csv diff --git a/cosv/source/storage/file.cxx b/cosv/source/storage/file.cxx index 8385c9f05d5f..143d31c8da01 100644 --- a/cosv/source/storage/file.cxx +++ b/cosv/source/storage/file.cxx @@ -2,9 +2,9 @@ * * $RCSfile: file.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,7 +106,7 @@ File::File( const String & i_sLocation, File::~File() { - if (is_open() ) + if ( inq_is_open() ) close(); } @@ -147,7 +147,7 @@ uintt File::do_read( void * out_pDest, uintt i_nNrofBytes ) { - if ( NOT is_open() ) + if ( NOT inq_is_open() ) return 0; if ( eLastIO == io_write ) @@ -163,7 +163,7 @@ File::do_read( void * out_pDest, bool File::inq_eod() const { - if ( NOT is_open() ) + if ( NOT inq_is_open() ) return true; return feof(pStream) != 0; } @@ -172,7 +172,7 @@ uintt File::do_write( const void * i_pSrc, uintt i_nNrofBytes ) { - if ( NOT is_open() ) + if ( NOT inq_is_open() ) return 0; if ( eLastIO == io_write ) @@ -189,6 +189,9 @@ uintt File::do_seek( intt i_nDistance, seek_dir i_eStartPoint ) { + if ( NOT inq_is_open() ) + return uintt(-1); + static int eSearchDir[3] = { SEEK_SET, SEEK_CUR, SEEK_END }; ::fseek( pStream, @@ -200,12 +203,22 @@ File::do_seek( intt i_nDistance, uintt File::inq_position() const { - return uintt( ::ftell(pStream) ); + if ( inq_is_open() ) + return uintt( ::ftell(pStream) ); + else + return uintt(-1); } bool File::do_open( uintt i_nOpenMode ) { + if ( inq_is_open() ) + { + if ( i_nOpenMode == 0 OR i_nOpenMode == nMode ) + return true; + close(); + } + if ( i_nOpenMode != 0 ) nMode = i_nOpenMode; @@ -235,8 +248,11 @@ File::do_open( uintt i_nOpenMode ) void File::do_close() { - ::fclose(pStream); - pStream = 0; + if ( inq_is_open() ) + { + ::fclose(pStream); + pStream = 0; + } eLastIO = io_none; } diff --git a/cosv/source/storage/ploc.cxx b/cosv/source/storage/ploc.cxx index c3d86658db5c..3c6509ab6757 100644 --- a/cosv/source/storage/ploc.cxx +++ b/cosv/source/storage/ploc.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ploc.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -121,9 +121,12 @@ Path::Set( const char * i_sPath, if (NOT i_bPathIsAlwaysDir) { - pRestPath = strrchr( pRestPath, *i_sDelimiter ); - if ( NOT no_str(pRestPath) ) - sFile = pRestPath + 1; + const char * pFile = strrchr( pRestPath, *i_sDelimiter ); + if (pFile == 0) + pFile = pRestPath; + else + pFile++; + sFile = pFile; } } diff --git a/cosv/source/storage/plocroot.cxx b/cosv/source/storage/plocroot.cxx index b44a1dc7cddc..f90029e9e860 100644 --- a/cosv/source/storage/plocroot.cxx +++ b/cosv/source/storage/plocroot.cxx @@ -2,9 +2,9 @@ * * $RCSfile: plocroot.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: np $ $Date: 2002-05-02 12:35:10 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,8 +63,9 @@ #include <cosv/ploc.hxx> // NOT FULLY DECLARED SERVICES -// #include <cosv/bstream.hxx> #include <ctype.h> +#include <cosv/bstream.hxx> +#include <cosv/csv_ostream.hxx> namespace csv diff --git a/cosv/source/strings/streamstr.cxx b/cosv/source/strings/streamstr.cxx index 15751a2b4e5e..aecfe5c4807c 100644 --- a/cosv/source/strings/streamstr.cxx +++ b/cosv/source/strings/streamstr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: streamstr.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: np $ $Date: 2002-03-22 13:32:37 $ + * last change: $Author: np $ $Date: 2002-05-14 08:08:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -474,6 +474,49 @@ StreamStr::pop_back( size_type i_nCount ) *pEnd = '\0'; } +StreamStr & +StreamStr::operator_join( std::vector<String>::const_iterator i_rBegin, + std::vector<String>::const_iterator i_rEnd, + const char * i_sLink ) +{ + std::vector<String>::const_iterator it = i_rBegin; + if ( it != i_rEnd ) + { + operator<<(*it); + for ( ++it; it != i_rEnd; ++it ) + { + operator<<(i_sLink); + operator<<(*it); + } + } + return *this; +} + +StreamStr & +StreamStr::operator_add_substr( const char * i_sText, + size_type i_nLength ) +{ + size_type nLength = csv::min<size_type>(i_nLength, strlen(i_sText)); + + ProvideAddingSize( nLength ); + memcpy( pCur, i_sText, nLength ); + Advance(nLength); + + return *this; +} + +StreamStr & +StreamStr::operator_add_token( const char * i_sText, + char i_cDelimiter ) +{ + const char * pTokenEnd = strchr(i_sText, i_cDelimiter); + if (pTokenEnd == 0) + operator<<(i_sText); + else + operator_add_substr(i_sText, pTokenEnd-i_sText); + return *this; +} + void StreamStr::replace( position_type i_nStart, size_type i_nSize, @@ -494,9 +537,13 @@ StreamStr::replace( position_type i_nStart, } else if ( i_nSize > i_aReplacement.nLength ) { - MoveData( dpData + i_nStart, + seek_type nMove = seek_type(i_nSize - i_aReplacement.nLength); + + MoveData( dpData + i_nStart + i_nSize, pEnd, - - seek_type(i_nSize - i_aReplacement.nLength) ); + -nMove ); + pEnd -= nMove; + *pEnd = '\0'; } memcpy( dpData + i_nStart, i_aReplacement.sStr, i_aReplacement.nLength ); @@ -523,11 +570,11 @@ StreamStr::replace_all( Area i_aStrToSearch, position_type p =0; const char * pSearch = i_aStrToSearch.sStr; size_type nSearch = i_aStrToSearch.nLength; - size_type nStop = length(); + size_type nStop = length(); if (nStop > nSearch) nStop -= nSearch; - while ( p <= nStop ) + while ( p < length() ) { if ( strncmp(dpData+p, pSearch, nSearch) == 0 ) { diff --git a/cosv/util/makefile.mk b/cosv/util/makefile.mk index f9035cb3f1e6..ed6753d6eed9 100644 --- a/cosv/util/makefile.mk +++ b/cosv/util/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: np $ $Date: 2002-03-22 12:42:24 $ +# last change: $Author: np $ $Date: 2002-05-14 08:08:46 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -77,8 +77,9 @@ ENABLE_EXCEPTIONS=true LIB1FILES= \ $(LB)$/cosv_service.lib \ - $(LB)$/cosv_storage.lib \ - $(LB)$/cosv_strings.lib + $(LB)$/cosv_storage.lib \ + $(LB)$/cosv_strings.lib \ + $(LB)$/cosv_badcast_wnt.lib # --- Targets ------------------------------------------------------ |