summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Pretzell <np@openoffice.org>2002-03-08 13:25:40 +0000
committerNikolai Pretzell <np@openoffice.org>2002-03-08 13:25:40 +0000
commit8913e1e75efa377a107fa37d22680ec223cb043c (patch)
treef2c7a438e6bfaab1a6c708a43afa1b2fc71ef6bc
parentd4bc2730f1d2088e5d4537ce7eb7333822c747d6 (diff)
Moving Autodoc to OpenOffice.org, module cosv: CommonServices
-rw-r--r--cosv/inc/cosv/bstream.hxx184
-rw-r--r--cosv/inc/cosv/comdline.hxx103
-rw-r--r--cosv/inc/cosv/comfunc.hxx137
-rw-r--r--cosv/inc/cosv/csv_env.hxx197
-rw-r--r--cosv/inc/cosv/csv_ostream.hxx168
-rw-r--r--cosv/inc/cosv/csv_precomp.h78
-rw-r--r--cosv/inc/cosv/datetime.hxx118
-rw-r--r--cosv/inc/cosv/dirchain.hxx208
-rw-r--r--cosv/inc/cosv/file.hxx171
-rw-r--r--cosv/inc/cosv/mbstream.hxx127
-rw-r--r--cosv/inc/cosv/openclose.hxx173
-rw-r--r--cosv/inc/cosv/persist.hxx139
-rw-r--r--cosv/inc/cosv/ploc.hxx161
-rw-r--r--cosv/inc/cosv/ploc_dir.hxx152
-rw-r--r--cosv/inc/cosv/plocroot.hxx114
-rw-r--r--cosv/inc/cosv/std_outp.hxx165
-rw-r--r--cosv/inc/cosv/str_types.hxx123
-rw-r--r--cosv/inc/cosv/streamstr.hxx369
-rw-r--r--cosv/inc/cosv/string.hxx602
-rw-r--r--cosv/inc/cosv/stringdata.hxx169
-rw-r--r--cosv/inc/cosv/x.hxx105
-rw-r--r--cosv/prj/build.lst15
-rw-r--r--cosv/prj/d.lst10
-rw-r--r--cosv/source/fullcpp.mk87
-rw-r--r--cosv/source/inc/precomp.h70
-rw-r--r--cosv/source/service/comdline.cxx91
-rw-r--r--cosv/source/service/comfunc.cxx189
-rw-r--r--cosv/source/service/csv_ostream.cxx126
-rw-r--r--cosv/source/service/datetime.cxx118
-rw-r--r--cosv/source/service/makefile.mk94
-rw-r--r--cosv/source/service/std_outp.cxx111
-rw-r--r--cosv/source/storage/dirchain.cxx184
-rw-r--r--cosv/source/storage/file.cxx257
-rw-r--r--cosv/source/storage/makefile.mk104
-rw-r--r--cosv/source/storage/mbstream.cxx153
-rw-r--r--cosv/source/storage/persist.cxx121
-rw-r--r--cosv/source/storage/ploc.cxx183
-rw-r--r--cosv/source/storage/ploc_dir.cxx364
-rw-r--r--cosv/source/storage/plocroot.cxx558
-rw-r--r--cosv/source/strings/makefile.mk93
-rw-r--r--cosv/source/strings/str_types.cxx78
-rw-r--r--cosv/source/strings/streamstr.cxx774
-rw-r--r--cosv/source/strings/string.cxx430
-rw-r--r--cosv/source/unittest/file_ut.cxx155
-rw-r--r--cosv/source/unittest/makefile.mk109
-rw-r--r--cosv/source/unittest/string_ut.cxx174
-rw-r--r--cosv/source/unittest/ut.hxx87
-rw-r--r--cosv/source/unittest/ut_main.cxx81
-rw-r--r--cosv/util/makefile.mk92
49 files changed, 8671 insertions, 0 deletions
diff --git a/cosv/inc/cosv/bstream.hxx b/cosv/inc/cosv/bstream.hxx
new file mode 100644
index 000000000000..55f04a0a9c9d
--- /dev/null
+++ b/cosv/inc/cosv/bstream.hxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * $RCSfile: bstream.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_BSTREAM_HXX
+#define CSV_BSTREAM_HXX
+
+#include <string.h>
+#include <cosv/string.hxx>
+
+
+namespace csv
+{
+
+
+enum seek_dir
+{
+ beg = 0,
+ cur = 1,
+ end = 2
+};
+
+
+class bistream
+{
+ public:
+ // LIFECYCLE
+ virtual ~bistream() {}
+
+ // OPERATIONS
+ /// @return Number of actually read bytes.
+ uintt read(
+ void * out_pDest,
+ uintt i_nNrofBytes);
+ // INQUIRY
+ /** @return True, if already one try to read had failed.
+ There is no guarantee, that it returns true, if end of data
+ is just reached.
+ Though it will return false, if there is still somemething
+ to read.
+ */
+ bool eod() const;
+
+ private:
+ virtual uintt do_read(
+ void * out_pDest,
+ uintt i_nNrofBytes) = 0;
+ virtual bool inq_eod() const = 0;
+};
+
+
+class bostream
+{
+ public:
+ // LIFECYCLE
+ virtual ~bostream() {}
+
+ // OPERATIONS
+ /// @return Number of actually written bytes.
+ uintt write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes);
+ /// @return Number of actually written bytes.
+ uintt write(
+ const char * i_pSrc );
+ /// @return Number of actually written bytes.
+ uintt write(
+ const String & i_pSrc );
+ private:
+ virtual uintt do_write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes) = 0;
+};
+
+
+class bstream : public bistream,
+ public bostream
+{
+ public:
+ uintt seek(
+ intt i_nDistanceFromBegin,
+ seek_dir i_eStartPoint = ::csv::beg );
+ uintt position() const;
+
+ private:
+ virtual uintt do_seek(
+ intt i_nDistance,
+ seek_dir i_eStartPoint = ::csv::beg ) = 0;
+ virtual uintt inq_position() const = 0;
+};
+
+
+// IMPLEMENTATION
+inline uintt
+bistream::read( void * o_pDest,
+ uintt i_nNrofBytes)
+ { return do_read(o_pDest, i_nNrofBytes); }
+inline bool
+bistream::eod() const
+ { return inq_eod(); }
+
+inline uintt
+bostream::write( const void * i_pSrc,
+ uintt i_nNrofBytes)
+ { return do_write( i_pSrc, i_nNrofBytes ); }
+inline uintt
+bostream::write( const char * i_sSrc )
+ { return write( i_sSrc, strlen(i_sSrc) ); }
+inline uintt
+bostream::write( const String & i_sSrc )
+ { return write( i_sSrc.c_str(), i_sSrc.length() ); }
+
+inline uintt
+bstream::seek( intt i_nDistance,
+ seek_dir i_eStartPoint )
+ { return do_seek( i_nDistance, i_eStartPoint ); }
+inline uintt
+bstream::position() const
+ { return inq_position(); }
+
+
+
+} // namespace csv
+
+
+#endif
+
diff --git a/cosv/inc/cosv/comdline.hxx b/cosv/inc/cosv/comdline.hxx
new file mode 100644
index 000000000000..14fcdaf0128d
--- /dev/null
+++ b/cosv/inc/cosv/comdline.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * $RCSfile: comdline.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_COMDLINE_HXX
+#define CSV_COMDLINE_HXX
+
+
+
+namespace csv
+{
+
+class CommandLine_Ifc
+{
+ public:
+ virtual ~CommandLine_Ifc() {}
+
+ void Init(
+ int argc,
+ char * argv[] );
+ void PrintUse() const;
+ bool CheckParameters() const;
+
+ private:
+ virtual void do_Init(
+ int argc,
+ char * argv[] ) = 0;
+
+ virtual void do_PrintUse() const = 0;
+ virtual bool inq_CheckParameters() const = 0;
+};
+
+inline void
+CommandLine_Ifc::Init( int argc,
+ char * argv[] )
+ { do_Init( argc, argv ); }
+inline void
+CommandLine_Ifc::PrintUse() const
+ { do_PrintUse(); }
+
+} // namespace csv
+
+
+
+#endif
+
diff --git a/cosv/inc/cosv/comfunc.hxx b/cosv/inc/cosv/comfunc.hxx
new file mode 100644
index 000000000000..076d0553834c
--- /dev/null
+++ b/cosv/inc/cosv/comfunc.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * $RCSfile: comfunc.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_COMFUNC_HXX
+#define CSV_COMFUNC_HXX
+
+namespace csv
+{
+
+class String;
+
+// min, max and range functions
+template <class E>
+inline E max(E in1, E in2);
+template <class E>
+inline E min(E in1, E in2);
+template <class E>
+inline bool in_range(E low, E val, E high); // return low <= val < high;
+
+
+// string functions
+inline const char * valid_str(const char * str);
+inline bool no_str(const char * str); // return !str || !strlen(str)
+intt count_chars(const char * str, char c);
+
+
+// endian functions
+template <class NUMTYPE>
+void switch_endian(
+ NUMTYPE & o_rNumber,
+ const NUMTYPE & i_rNumber );
+
+// Zeit-Typecasts
+bool str2date(const char * str, int & out_day, int & out_month, int & out_year);
+void date2str(String & out_Str, int day, int month, int year);
+bool str2time(const char * str, int & out_hour, int & out_min, int & out_sec);
+void time2str(String & out_Str, int hour, int min, int sec);
+
+
+template <class E>
+inline E
+max(E in1, E in2) { return in1 < in2 ? in2 : in1; }
+template <class E>
+inline E
+min(E in1, E in2) { return in1 < in2 ? in1 : in2; }
+template <class E>
+inline bool
+in_range(E low, E val, E high) { return low <= val AND val < high; }
+
+inline const char *
+valid_str(const char * str) { return str != 0 ? str : ""; }
+inline bool
+no_str(const char * str) { return str != 0 ? *str == '\0' : true; }
+
+
+template <class NUMTYPE>
+void
+switch_endian( NUMTYPE & o_rNumber,
+ const NUMTYPE & i_rNumber )
+{
+ char * pFront = reinterpret< char* >(&o_rNumber);
+ const char * pBack = reinterpret< char* >(&i_rNumber) + (sizeof(NUMTYPE) - 1);
+
+ for ( unsigned int p = sizeof(NUMTYPE); p != 0; --p )
+ {
+ *pFront++ = *pBack--;
+ }
+}
+
+
+
+} // namespace csv
+
+
+
+
+#endif
+
+
diff --git a/cosv/inc/cosv/csv_env.hxx b/cosv/inc/cosv/csv_env.hxx
new file mode 100644
index 000000000000..746cfb7822d4
--- /dev/null
+++ b/cosv/inc/cosv/csv_env.hxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * $RCSfile: csv_env.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_CSV_ENV_HXX
+#define CSV_CSV_ENV_HXX
+
+
+
+// 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_EXPLICIT // No keyword explicit
+// #define CSV_NO_IOSTREAMS // No iostreams
+// END Compiler dependent defines, subject to changes
+
+
+// BEGIN Compiler dependent defines, controlled by above defines
+#ifdef CSV_NO_BOOL_TYPE
+typedef int bool_int;
+#define bool bool_int
+#define false 0
+#define true 1
+#endif // CSV_NO_BOOL_TYPE
+
+#ifdef CSV_NO_MUTABLE
+#define mutable
+#endif // CSV_NO_MUTABLE
+
+#ifdef CSV_NO_EXPLICIT
+#define explicit
+#endif // CSV_NO_EXPLICIT
+// END Compiler dependent defines, controlled by above defines
+
+
+//******* Builtin types of exact length ************//
+
+// Exact length builtin types
+typedef signed char INT8;
+typedef unsigned char UINT8;
+typedef short INT16;
+typedef unsigned short UINT16;
+typedef long INT32;
+typedef unsigned long UINT32;
+typedef float REAL32;
+typedef double REAL64;
+
+
+// Additional builtin types
+typedef INT32 intt; // Um ein exakt definiertes Standard-int zu haben.
+typedef UINT32 uintt; // Das dazu passende Standard-unsigned-int.
+typedef REAL64 real;
+
+// Constants
+// ---------
+// Zero-pointer for use in ellipsed (...) parameter lists which expect a
+// pointer which may have another size than an int.
+// Must be a define to be used in precompiled headers:
+#define NIL ((void*)0)
+// char '\0'
+#define NULCH '\0'
+
+
+
+// Boolesche Operatoren
+#define AND &&
+#define OR ||
+#define NOT !
+
+// Macro for distinguishing dynamic allocated pointers from
+// referencing pointers
+#define DYN // Exact specification: DYN has to be used if and only if:
+ // 1. DYN specifies a class member pointer or reference variable and
+ // the class must free the referenced memory.
+ // 2. DYN specifies a pointer or reference (return-) parameter of a function
+ // and for in-parameters the function or its class
+ // must free the referenced memory, the parameter is then called
+ // a let-parameter.
+ // For out- and inout-parameters
+ // or return values the caller of the function hast to
+ // free the referenced memory.
+ //
+ // It is irrelevant who allocated the memory!
+ //
+ // DYN - variables use the prefixes "dp" or "dr" instead of "p" or "r".
+
+
+//****** Assertions ******//
+
+namespace csv
+{
+void PerformAssertion(
+ const char * condition,
+ const char * file,
+ unsigned line );
+}
+
+// Programming by contract
+#ifndef CSV_NO_ASSERTIONS
+// 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__)
+#else
+#define precond(x)
+#define postcond(x)
+#define csv_assert(x)
+#define csv_noimpl(x)
+#define csv_exception
+#endif // end ifndef NDEBUG else
+
+
+
+
+
+
+
+
+
+/* Additional Programming Conventions
+1. see above at "#define DYN"
+2. function parameters get one of these prefixes:
+ - i_ := Function uses only the value, but must not change a referenced variable.
+ - o_ := Parameter is undefined until function has set it.
+ Parametere must be set by the function.
+ - io_ := Function may use and change the referenced variable.
+ - let_ := Funktion may use and change the referenced variable and HAS TO free the
+ associated memory.
+3. Global constants get the prefix 'C_', global variables the prefix
+ 'G_', local constants the prefix 'c_' .
+4. Static members end with an underscore '_'.
+
+*/
+
+
+#endif
+
diff --git a/cosv/inc/cosv/csv_ostream.hxx b/cosv/inc/cosv/csv_ostream.hxx
new file mode 100644
index 000000000000..e852701ab870
--- /dev/null
+++ b/cosv/inc/cosv/csv_ostream.hxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * $RCSfile: csv_ostream.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_CSV_OSTREAM_HXX
+#define CSV_CSV_OSTREAM_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+ // PARAMETERS
+
+
+
+#ifndef CSV_NO_IOSTREAMS
+
+#include <iostream>
+
+
+namespace csv
+{
+
+typedef std::ios ios;
+typedef std::ostream ostream;
+
+} // namespace csv
+
+
+#else
+
+#include <cosv/template/dyn.hxx>
+
+namespace csv
+{
+
+class StreamStr;
+
+class ios
+{
+ public:
+ enum seek_dir
+ {
+ beg=0,
+ cur=1,
+ end=2
+ };
+};
+
+class ostream : public ios
+{
+ public:
+ typedef ostream self;
+
+ virtual ~ostream();
+
+ self & operator<<(
+ const char * i_s );
+ self & operator<<(
+ char i_c );
+ self & operator<<(
+ unsigned char i_c );
+ self & operator<<(
+ signed char i_c );
+
+ self & operator<<(
+ short i_n );
+ self & operator<<(
+ unsigned short i_n );
+ self & operator<<(
+ int i_n );
+ self & operator<<(
+ unsigned int i_n );
+ self & operator<<(
+ long i_n );
+ self & operator<<(
+ unsigned long i_n );
+
+ self & operator<<(
+ float i_n );
+ self & operator<<(
+ double i_n );
+
+ self & seekp(
+ intt i_nOffset,
+ seek_dir i_eStart = ios::beg );
+ protected:
+ ostream(
+ uintt i_nStartSize );
+ const StreamStr & Data() const;
+
+ private:
+ Dyn<StreamStr> pData;
+};
+
+
+
+inline const StreamStr &
+ostream::Data() const
+ { return *pData; }
+
+
+} // namespace csv
+
+
+#endif
+
+
+
+
+#endif
+
diff --git a/cosv/inc/cosv/csv_precomp.h b/cosv/inc/cosv/csv_precomp.h
new file mode 100644
index 000000000000..301776c6283c
--- /dev/null
+++ b/cosv/inc/cosv/csv_precomp.h
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * $RCSfile: csv_precomp.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef __CSV_PRECOMP_H_06071998__
+#define __CSV_PRECOMP_H_06071998__
+
+
+#include <cosv/csv_env.hxx>
+#include <cosv/comfunc.hxx>
+#include <cosv/string.hxx>
+#include <cosv/streamstr.hxx>
+#include <cosv/std_outp.hxx>
+#include <cosv/template/dyn.hxx>
+
+
+
+
+
+#endif
+
diff --git a/cosv/inc/cosv/datetime.hxx b/cosv/inc/cosv/datetime.hxx
new file mode 100644
index 000000000000..7500a7bef1ed
--- /dev/null
+++ b/cosv/inc/cosv/datetime.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: datetime.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_DATETIME_HXX
+#define CSV_DATETIME_HXX
+
+
+
+namespace csv
+{
+
+
+class Date
+{
+ public:
+ Date();
+ Date(
+ unsigned i_nDay,
+ unsigned i_nMonth,
+ unsigned i_nYear );
+
+ unsigned Day() const { return nData >> 24; }
+ unsigned Month() const { return (nData & 0x00FF0000) >> 16; }
+ unsigned Year() const { return nData & 0x0000FFFF; }
+
+ static const Date & Null_();
+
+ private:
+ UINT32 nData;
+};
+
+class Time
+{
+ public:
+ Time();
+ Time(
+ unsigned i_nHour,
+ unsigned i_nMinutes,
+ unsigned i_nSeconds = 0,
+ unsigned i_nSeconds100 = 0 );
+
+ unsigned Hour() const { return nData >> 24; }
+ unsigned Minutes() const { return (nData & 0x00FF0000) >> 16; }
+ unsigned Seconds() const { return (nData & 0x0000FF00) >> 8; }
+ unsigned Seconds100() const { return nData & 0x000000FF; }
+
+ static const Time & Null_();
+
+ private:
+ UINT32 nData;
+};
+
+
+} // namespace csv
+
+
+
+
+#endif
+
diff --git a/cosv/inc/cosv/dirchain.hxx b/cosv/inc/cosv/dirchain.hxx
new file mode 100644
index 000000000000..e7556ee0348f
--- /dev/null
+++ b/cosv/inc/cosv/dirchain.hxx
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * $RCSfile: dirchain.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_DIRCHAIN_HXX
+#define CSV_DIRCHAIN_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+
+#include <cosv/persist.hxx>
+#include <cosv/template/tpltools.hxx>
+
+
+
+namespace csv
+{
+ class bostream;
+
+namespace ploc
+{
+
+
+class DirectoryChain
+{
+ public:
+ DirectoryChain();
+ DirectoryChain(
+ const char * i_sPath,
+ bool i_bPathIsAlwaysDir = false,
+ const char * i_sDelimiter = Delimiter() );
+ DirectoryChain(
+ const DirectoryChain &
+ i_rDC );
+ ~DirectoryChain();
+
+ // OPERATORS
+ DirectoryChain & operator=(
+ const DirectoryChain &
+ i_rDC );
+ DirectoryChain & operator+=(
+ const String & i_sName );
+ DirectoryChain & operator+=(
+ const DirectoryChain &
+ i_rDC );
+ // OPERATIONS
+ void Set(
+ const char * i_sPath,
+ bool i_bPathIsAlwaysDir = false,
+ const char * i_sDelimiter = Delimiter() );
+ void PushFront(
+ const String & i_sName );
+ void PushFront(
+ const DirectoryChain &
+ i_sPath );
+ void PushBack(
+ const String & i_sName );
+ void PushBack(
+ const DirectoryChain &
+ i_sPath );
+ void PopFront(
+ uintt i_nCount = 1 );
+ void PopBack(
+ uintt i_nCount = 1 );
+
+ // INQUIRY
+ uintt Size() const;
+
+ StringVector::const_iterator
+ Begin() const;
+ StringVector::const_iterator
+ End() const;
+
+ const String & Front() const;
+ const String & Back() const;
+
+ void Get(
+ ostream & o_rPath,
+ const char * i_sDelimiter ) const;
+ void Get(
+ bostream & o_rPath,
+ const char * i_sDelimiter ) const;
+ private:
+ StringVector aPath;
+};
+
+
+// IMPLEMENTATION
+inline
+DirectoryChain::DirectoryChain( const DirectoryChain & i_rDC )
+ { PushBack(i_rDC); }
+
+ // OPERATORS
+inline DirectoryChain &
+DirectoryChain::operator=( const DirectoryChain & i_rDC )
+ { csv::erase_container(aPath); PushBack(i_rDC); return *this; }
+inline DirectoryChain &
+DirectoryChain::operator+=( const String & i_sName )
+ { PushBack(i_sName); return *this; }
+inline DirectoryChain &
+DirectoryChain::operator+=( const DirectoryChain & i_rDC )
+ { PushBack(i_rDC); return *this; }
+inline uintt
+DirectoryChain::Size() const
+ { return aPath.size(); }
+
+inline StringVector::const_iterator
+DirectoryChain::Begin() const
+ { return aPath.begin(); }
+inline StringVector::const_iterator
+DirectoryChain::End() const
+ { return aPath.end(); }
+inline const String &
+DirectoryChain::Front() const
+ { return aPath.empty() ? String::Null_() : aPath.front(); }
+inline const String &
+DirectoryChain::Back() const
+ { return aPath.empty() ? String::Null_() : aPath.back(); }
+
+
+} // namespace ploc
+} // namespace csv
+
+
+inline csv::ostream &
+operator<<( csv::ostream & o_rOut,
+ const csv::ploc::DirectoryChain & i_rSubPath )
+{
+ i_rSubPath.Get(o_rOut, csv::ploc::Delimiter());
+ return o_rOut;
+}
+
+inline csv::bostream &
+operator<<( csv::bostream & o_rOut,
+ const csv::ploc::DirectoryChain & i_rSubPath )
+{
+ i_rSubPath.Get(o_rOut, csv::ploc::Delimiter());
+ return o_rOut;
+}
+
+
+
+#endif
+
+
+
diff --git a/cosv/inc/cosv/file.hxx b/cosv/inc/cosv/file.hxx
new file mode 100644
index 000000000000..01173555a92e
--- /dev/null
+++ b/cosv/inc/cosv/file.hxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * $RCSfile: file.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_FILE_HXX
+#define CSV_FILE_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+#include <cosv/bstream.hxx>
+#include <cosv/openclose.hxx>
+ // COMPONENTS
+#include <stdio.h>
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/persist.hxx>
+#include <cosv/ploc.hxx>
+
+
+class FileStrategy;
+
+
+namespace csv
+{
+
+
+/** @task
+ File is a class representing a file.
+*/
+class File : public bstream,
+ public OpenClose,
+ public ploc::Persistent
+{
+ public:
+ // LIFECYCLE
+ File(
+ uintt i_nMode = CFM_RW );
+ File(
+ const ::csv::ploc::Path &
+ i_rLocation,
+ uintt i_nMode = CFM_RW );
+ File(
+ const char * i_sLocation,
+ uintt in_nMode = CFM_RW );
+ File(
+ const String & i_sLocation,
+ uintt in_nMode = CFM_RW );
+ virtual ~File();
+
+ // OPERATIONS
+ bool Assign(
+ ploc::Path i_rLocation );
+ bool Assign(
+ const char * i_sLocation );
+ bool Assign(
+ const String & i_sLocation );
+ // INQUIRY
+ uintt Mode() const;
+
+ private:
+ enum E_LastIO
+ {
+ io_none = 0,
+ io_read,
+ io_write
+ };
+
+ // Interface bistream:
+ virtual uintt do_read(
+ void * out_pDest,
+ uintt i_nNrofBytes);
+ virtual bool inq_eod() const;
+ // Interface bostream:
+ virtual uintt do_write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes);
+ // Interface bstream:
+ virtual uintt do_seek(
+ intt i_nDistance,
+ seek_dir i_eStartPoint = ::csv::beg );
+ virtual uintt inq_position() const;
+ // Interface OpenClose:
+ virtual bool do_open(
+ uintt in_nOpenModeInfo );
+ virtual void do_close();
+ virtual bool inq_is_open() const;
+ // Interface Persistent:
+ virtual const ploc::Path &
+ inq_MyPath() const;
+ // DATA
+ ploc::Path aPath;
+ FILE * pStream;
+
+ uintt nMode; /// RWMode, OpenMode and ShareMode.
+ E_LastIO eLastIO;
+};
+
+
+
+// IMPLEMENTATION
+
+inline uintt
+File::Mode() const
+ { return nMode; }
+
+
+} // namespace csv
+
+
+
+
+#endif
+
+
diff --git a/cosv/inc/cosv/mbstream.hxx b/cosv/inc/cosv/mbstream.hxx
new file mode 100644
index 000000000000..45756568de08
--- /dev/null
+++ b/cosv/inc/cosv/mbstream.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * $RCSfile: mbstream.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_MBSTREAM_HXX
+#define CSV_MBSTREAM_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+#include <cosv/bstream.hxx>
+ // COMPONENTS
+ // PARAMETERS
+
+
+namespace csv
+{
+
+class mbstream : public bstream
+{
+ public:
+ // LIFECYCLE
+ mbstream(
+ uintt i_nSize);
+ ~mbstream();
+ // OPERATIONS
+ void resize(
+ uintt i_nSize );
+ // INQUIRY
+ uintt size() const;
+ const void * data() const;
+
+ private:
+ // Interface bistream:
+ virtual uintt do_read(
+ void * out_pDest,
+ uintt i_nNrofBytes);
+ virtual bool inq_eod() const;
+ // Interface bostream:
+ virtual uintt do_write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes);
+ // Interface bstream:
+ virtual uintt do_seek(
+ intt i_nDistance,
+ seek_dir i_eStartPoint = ::csv::beg );
+ virtual uintt inq_position() const;
+
+ // DYN
+ DYN char * dpOwnedMemorySpace;
+ uintt nSize;
+ uintt nCurPosition;
+};
+
+
+// IMPLEMENTATION
+
+inline uintt
+mbstream::size() const
+ { return nSize; }
+inline const void *
+mbstream::data() const
+ { return dpOwnedMemorySpace; }
+
+
+} // namespace csv
+
+
+#endif
+
+
diff --git a/cosv/inc/cosv/openclose.hxx b/cosv/inc/cosv/openclose.hxx
new file mode 100644
index 000000000000..1c4bf59805bc
--- /dev/null
+++ b/cosv/inc/cosv/openclose.hxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * $RCSfile: openclose.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_OPENCLOSE_HXX
+#define CSV_OPENCLOSE_HXX
+
+
+namespace csv
+{
+
+// Open modes for storages:
+enum E_RWMode
+{
+ rwDefault = 0x0000, // Keep old settings. If there are none, set default.
+ rwRead = 0x0001, // Reads only
+ rwWrite = 0x0002, // Writes only
+ rwReadWrite = 0x0003 // Reads and writes.
+};
+
+enum E_OpenMode
+{
+ omCreateIfNecessary = 0x0000, // Creates a new file only, if file does not exist.
+ omCreateNot = 0x0010, // Open fails, if file does not exist.
+ omCreate = 0x0020 // Existing file will be deleted.
+};
+enum E_ShareMode
+{
+ shmShareNot = 0x0000, // Allow others nothing
+ shmShareRead = 0x0004, // Allow others to read
+ shmShareAll = 0x000C // Allow others to read and write
+};
+
+/** Constants for filemode combinations
+ These combinations are the only ones, guaranteed to be supported.
+*/
+const UINT32 CFM_RW = rwReadWrite;
+const UINT32 CFM_CREATE = rwReadWrite | omCreate;
+const UINT32 CFM_READ = rwRead | omCreateNot | shmShareRead;
+
+
+
+class OpenClose
+{
+ public:
+ bool open(
+ UINT32 in_nOpenModeInfo = 0 ); /// Combination of values of E_RWMode and E_ShareMode und E_OpenMode. 0 := Keep existing mode.
+ void close();
+
+ bool is_open() const;
+
+ private:
+ virtual bool do_open(
+ UINT32 in_nOpenModeInfo ) = 0;
+ virtual void do_close() = 0;
+ virtual bool inq_is_open() const = 0;
+};
+
+
+
+class OpenCloseGuard
+{
+ public:
+ OpenCloseGuard(
+ OpenClose & i_rOpenClose,
+ UINT32 i_nOpenModeInfo = 0 );
+ ~OpenCloseGuard();
+ operator bool() const;
+
+ private:
+ // Forbidden:
+ OpenCloseGuard(OpenCloseGuard&);
+ OpenCloseGuard & operator=(OpenCloseGuard&);
+
+ // DATA
+ OpenClose & rOpenClose;
+};
+
+
+// IMPLEMENTATION
+
+inline bool
+OpenClose::open( UINT32 i_nOpenModeInfo )
+ { return do_open(i_nOpenModeInfo); }
+inline void
+OpenClose::close()
+ { do_close(); }
+inline bool
+OpenClose::is_open() const
+ { return inq_is_open(); }
+
+inline
+OpenCloseGuard::OpenCloseGuard( OpenClose & i_rOpenClose,
+ UINT32 i_nOpenModeInfo )
+ : rOpenClose(i_rOpenClose)
+ { rOpenClose.open(i_nOpenModeInfo); }
+inline
+OpenCloseGuard::~OpenCloseGuard()
+ { rOpenClose.close(); }
+inline
+OpenCloseGuard::operator bool() const
+ { return rOpenClose.is_open(); }
+
+
+
+
+} // namespace csv
+
+
+
+
+
+
+#endif
+
+
diff --git a/cosv/inc/cosv/persist.hxx b/cosv/inc/cosv/persist.hxx
new file mode 100644
index 000000000000..579754ff4682
--- /dev/null
+++ b/cosv/inc/cosv/persist.hxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * $RCSfile: persist.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_PERSIST_HXX
+#define CSV_PERSIST_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+
+
+namespace csv
+{
+namespace ploc
+{
+
+class Path;
+
+
+inline const char *
+Delimiter()
+{
+#ifdef WNT
+ return "\\";
+#elif defined(UNX)
+ return "/";
+#else
+#error For using csv::ploc there has to be defined: WNT or UNX.
+#endif
+}
+
+
+
+class Persistent
+{
+ public:
+ virtual ~Persistent() {}
+
+ const Path & MyPath() const;
+ /// @return Path of directories without completing delimiter.
+ const char * StrPath() const;
+ bool Exists() const;
+
+ protected:
+ Persistent();
+ void InvalidatePath();
+
+ private:
+ virtual const Path &
+ inq_MyPath() const = 0;
+ // DATA
+ mutable StreamStr sPath;
+};
+
+
+
+// IMPLEMENTATION
+
+inline
+Persistent::Persistent()
+ : sPath(30) { }
+inline const Path &
+Persistent::MyPath() const
+ { return inq_MyPath(); }
+inline void
+Persistent::InvalidatePath()
+ { sPath.clear(); }
+
+
+
+} // namespace csv
+} // namespace ploc
+
+
+#endif
+
+
+
diff --git a/cosv/inc/cosv/ploc.hxx b/cosv/inc/cosv/ploc.hxx
new file mode 100644
index 000000000000..3ec4542693f6
--- /dev/null
+++ b/cosv/inc/cosv/ploc.hxx
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * $RCSfile: ploc.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_PLOC_HXX
+#define CSV_PLOC_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+#include <cosv/plocroot.hxx>
+#include <cosv/dirchain.hxx>
+#include <cosv/template/dyn.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+
+
+namespace csv
+{
+ class bostream;
+
+
+namespace ploc
+{
+ class Root;
+
+class Path
+{
+ public:
+
+ // LIFECYCLE
+ Path(
+ const char * i_sPath = ".", /// Dirs have to be ended with a '\\ or '/'.
+ bool i_bPathIsAlwaysDir = false, /// This overrides a missing Delimiter at the end of the i_sPath, if true.
+ const char * i_sDelimiter = Delimiter() );
+ Path(
+ const Path & i_rPath );
+ ~Path();
+ // OPERATORS
+ Path & operator=(
+ const Path & i_rPath );
+ // OPERATIONS
+ void Set(
+ const char * i_sPath,
+ bool i_bPathIsAlwaysDir = false,
+ const char * i_sDelimiter = Delimiter() );
+ void SetFile( // If there is already a file, that is exchanged.
+ const String & i_sName );
+ // INQUIRY
+ const Root & RootDir() const { return *pRoot; }
+ const DirectoryChain &
+ DirChain() const { return aPath; }
+ const String & File() const { return sFile; }
+ const char * FileEnding() const;
+ bool IsValid() const;
+ bool IsDirectory() const { return sFile.length() == 0; }
+ bool IsFile() const { return sFile.length() > 0; }
+
+ virtual void Get(
+ ostream & o_rPath ) const;
+ virtual void Get(
+ bostream & o_rPath ) const;
+ // ACCESS
+ DirectoryChain & DirChain() { return aPath; }
+
+ private:
+ Dyn<Root> pRoot;
+ DirectoryChain aPath;
+ String sFile;
+};
+
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
+inline csv::ostream &
+operator<<( csv::ostream & o_rOut,
+ const csv::ploc::Path & i_rPath )
+{
+ i_rPath.Get(o_rOut);
+ return o_rOut;
+}
+
+inline csv::bostream &
+operator<<( csv::bostream & o_rOut,
+ const csv::ploc::Path & i_rPath )
+{
+ i_rPath.Get(o_rOut);
+ return o_rOut;
+}
+
+
+
+
+#endif
+
+
+
diff --git a/cosv/inc/cosv/ploc_dir.hxx b/cosv/inc/cosv/ploc_dir.hxx
new file mode 100644
index 000000000000..585af589fae0
--- /dev/null
+++ b/cosv/inc/cosv/ploc_dir.hxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * $RCSfile: ploc_dir.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_PLOCDIR_HXX
+#define CSV_PLOCDIR_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+#include <cosv/persist.hxx>
+ // COMPONENTS
+#include <cosv/ploc.hxx>
+ // PARAMETERS
+
+namespace csv
+{
+namespace ploc
+{
+
+class DirectoryChain;
+
+enum E_Recursivity
+{
+ flat,
+ recursive
+};
+
+class Directory : public Persistent
+{
+ public:
+ // LIFECYCLE
+ Directory();
+ Directory(
+ const Path & i_rLocation );
+ Directory(
+ const char * i_rLocation );
+ Directory(
+ const String & i_rLocation );
+ Directory(
+ const Directory & i_rDir );
+ virtual ~Directory();
+
+ // OPERATORS
+ Directory & operator+=(
+ const String & i_sName );
+ Directory & operator+=(
+ const DirectoryChain &
+ i_sDirChain );
+ Directory & operator-=(
+ uintt i_nLevels );
+
+ // OPERATIONS
+ bool PhysicalCreate(
+ bool i_bCreateParentsIfNecessary = true );
+
+ // INQUIRY
+ void GetContainedDirectories(
+ StringVector & o_rResult ) const;
+ /** @param i_sFilter
+ Currently only filters of the form "*.ending" or "*.*"
+ (the default) are processed correctly under UNIX. Under WNT this
+ restriction does not apply.
+ */
+ void GetContainedFiles(
+ StringVector & o_rResult,
+ const char * i_sFilter = "*.*",
+ E_Recursivity i_eRecursivity = flat ) const;
+ private:
+ // Interface Peristent:
+ virtual const Path &
+ inq_MyPath() const;
+
+ // Locals:
+ /** @return
+ true, if parent(!) directory exists or could be created.
+ false, if this is a root directory.
+ */
+ bool Check_Parent();
+ bool PhysicalCreate_Dir(
+ const char * i_sStr ) const;
+ // DATA
+ Path aPath;
+};
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
+#endif
+
+
diff --git a/cosv/inc/cosv/plocroot.hxx b/cosv/inc/cosv/plocroot.hxx
new file mode 100644
index 000000000000..9989ea7af36b
--- /dev/null
+++ b/cosv/inc/cosv/plocroot.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * $RCSfile: plocroot.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_PLOCROOT_HXX
+#define CSV_PLOCROOT_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+#include <cosv/persist.hxx>
+
+
+namespace csv
+{
+
+class bostream;
+
+
+namespace ploc
+{
+
+
+class Root
+{
+ public:
+ virtual ~Root();
+
+ static DYN Root * Create_(
+ const char * & o_sPathAfterRoot,
+ const char * i_sPath,
+ const char * i_sDelimiter = Delimiter() );
+
+ virtual void Get( /// Does not add a '\0' at the end,
+ ostream & o_rPath ) const = 0;
+ virtual void Get( /// Does not add a '\0' at the end.
+ bostream & so_rPath ) const = 0;
+ virtual DYN Root * CreateCopy() const = 0;
+ virtual const char *
+ OwnDelimiter() const = 0;
+};
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
+#endif
+
+
+
diff --git a/cosv/inc/cosv/std_outp.hxx b/cosv/inc/cosv/std_outp.hxx
new file mode 100644
index 000000000000..ac1b193f4e3b
--- /dev/null
+++ b/cosv/inc/cosv/std_outp.hxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * $RCSfile: std_outp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_STD_OUTP_HXX
+#define CSV_STD_OUTP_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/csv_ostream.hxx>
+ // PARAMETERS
+
+
+
+
+namespace csv
+{
+
+class redirect_out : public ostream
+{
+ public:
+ virtual ~redirect_out() {}
+
+ void re_endl() { do_re_endl(); }
+ void re_flush() { do_re_flush(); }
+
+ static void set_(
+ redirect_out & o_rStdOut,
+ redirect_out & o_rStdErr )
+ { pStdOut_ = &o_rStdOut;
+ pStdErr_ = &o_rStdErr; }
+
+ static redirect_out &
+ std_() { return *pStdOut_; }
+ static redirect_out &
+ err_() { return *pStdErr_; }
+ static bool useme_() { return pStdOut_ != 0; }
+
+ private:
+ virtual void do_re_endl() = 0;
+ virtual void do_re_flush() = 0;
+
+ // DATA
+ static redirect_out *
+ pStdOut_;
+ static redirect_out *
+ pStdErr_;
+};
+
+
+
+inline ostream &
+Cout()
+{
+#ifndef CSV_NO_IOSTREAMS
+ return redirect_out::useme_()
+ ? (ostream&)( redirect_out::std_() )
+ : (ostream&)( std::cout );
+#else
+ csv_assert( redirect_out::useme_() );
+ return redirect_out::std_();
+#endif
+}
+
+inline ostream &
+Cerr()
+{
+#ifndef CSV_NO_IOSTREAMS
+ return redirect_out::useme_()
+ ? (ostream&)( redirect_out::err_() )
+ : (ostream&)( std::cerr );
+#else
+ csv_assert( redirect_out::useme_() );
+ return redirect_out::err_();
+#endif
+}
+
+
+
+typedef void (*F_FLUSHING_FUNC)(ostream&, bool, int*);
+
+void Endl( ostream&, bool, int* );
+
+void Flush( ostream&, bool, int* );
+
+
+} // namespace csv
+
+
+
+inline csv::ostream &
+operator<<( csv::ostream & io_rStream,
+ csv::F_FLUSHING_FUNC i_fFlushingFunc )
+{
+#ifndef CSV_NO_IOSTREAMS
+ (*i_fFlushingFunc)( io_rStream, csv::redirect_out::useme_(), 0 );
+#else
+ csv_assert( csv::redirect_out::useme_() );
+ (*i_fFlushingFunc)( io_rStream, true, 0 );
+#endif
+ return io_rStream;
+}
+
+
+#endif
+
+
diff --git a/cosv/inc/cosv/str_types.hxx b/cosv/inc/cosv/str_types.hxx
new file mode 100644
index 000000000000..0e3c239e161f
--- /dev/null
+++ b/cosv/inc/cosv/str_types.hxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * $RCSfile: str_types.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef COSV_STR_TYPES_HXX
+#define COSV_STR_TYPES_HXX
+
+
+namespace csv
+{
+
+struct str
+{
+ public:
+ typedef uintt position;
+ typedef position size;
+
+ enum constants
+ {
+ npos = position(-1),
+ maxsize = size(-1)
+ };
+
+ enum insert_mode
+ {
+ overwrite = 0,
+ insert = 1
+ };
+};
+
+
+class CharOrder_Table
+{
+ public:
+ /** @precond
+ Parameter i_pCharWeightsArray
+ must have size of 256.
+ */
+ CharOrder_Table(
+ const int * i_pCharWeightsArray );
+
+ /** @return the weight of the char i_c.
+ @precond
+ Even with unusual implementations, where char has more than 8 bit,
+ there must be true: 0 <= i_c < 256.
+ */
+ int operator()(
+ char i_c ) const;
+ private:
+ int cWeights[256];
+};
+
+
+// IMPLEMENTATION
+
+inline int
+CharOrder_Table::operator()( char i_c ) const
+ { return cWeights[i_c]; }
+
+
+
+} // namespace csv
+
+#endif
+
+
diff --git a/cosv/inc/cosv/streamstr.hxx b/cosv/inc/cosv/streamstr.hxx
new file mode 100644
index 000000000000..e17b8cdd3001
--- /dev/null
+++ b/cosv/inc/cosv/streamstr.hxx
@@ -0,0 +1,369 @@
+/*************************************************************************
+ *
+ * $RCSfile: streamstr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_STREAMSTR_HXX
+#define CSV_STREAMSTR_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+#include <cosv/bstream.hxx>
+ // COMPONENTS
+#include <cosv/str_types.hxx>
+ // PARAMETERS
+#include <string.h>
+
+
+
+namespace csv
+{
+
+
+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
+ mit 'length' im Constructor angegeben.
+*/
+
+class StreamStr : public bostream
+{
+ public:
+ typedef StreamStr self;
+
+ typedef str::size size_type;
+ typedef str::position position_type;
+ typedef intt seek_type;
+ typedef str::insert_mode insert_mode;
+
+ typedef const char * const_iterator;
+ typedef char * iterator;
+
+ typedef void (*F_CSTR)();
+
+
+ struct Area
+ {
+ typedef str::size size_type;
+
+ Area(
+ const char * i_str = "",
+ size_type i_nLength = str::maxsize )
+ : sStr(i_str),
+ nLength( i_nLength == str::maxsize
+ ? strlen(i_str)
+ : i_nLength ) {}
+ const char * sStr;
+ size_type nLength;
+ };
+
+ // LIFECYCLE
+ StreamStr(
+ size_type i_nCapacity );
+ StreamStr(
+ const char * i_sInitStr,
+ size_type i_nCapacity ); /// Only used if > strlen(i_sInitStr).
+ StreamStr(
+ size_type i_nGuessedCapacity,
+ const char * str1, // [!= 0]
+ const char * str2, // [!= 0]
+ ... ); // Has to end with NIL .
+ /// Copies also inssert_mode and current position.
+ StreamStr(
+ const self & i_rOther );
+ ~StreamStr();
+
+ // OPERATORS
+ /// Copies also inssert_mode and current position.
+ self & operator=(
+ const self & i_rOther );
+
+ self & operator<<(
+ const char * i_s );
+ self & operator<<(
+ const String & i_s );
+ self & operator<<(
+ char i_c );
+ self & operator<<(
+ unsigned char i_c );
+ self & operator<<(
+ signed char i_c );
+
+ self & operator<<(
+ short i_n );
+ self & operator<<(
+ unsigned short i_n );
+ self & operator<<(
+ int i_n );
+ self & operator<<(
+ unsigned int i_n );
+ self & operator<<(
+ long i_n );
+ self & operator<<(
+ unsigned long i_n );
+
+ self & operator<<(
+ float i_n );
+ self & operator<<(
+ double i_n );
+
+ const char * operator<<(
+ F_CSTR i_f );
+
+ const char & operator[](
+ position_type i_nPosition ) const;
+ char & operator[](
+ position_type i_nPosition );
+
+ // OPERATIONS
+ void resize(
+ size_type i_nMinimumCapacity );
+
+ void clear();
+
+ /** Sets start point for the next operator<<() call.
+ if the intended position is not reachable, nothing happens.
+ */
+ self & seekp(
+ seek_type i_nCount,
+ seek_dir i_eDirection = ::csv::beg );
+ /** Sets the insertion mode of all and only the operator<<() calls.
+
+ str::overwrite: seekp() always sets the cur end of the string.
+ operator<<() calls push the end of the string forward.
+ str::insert: seekp() only sets the insertion point.
+ operator<<() calls insert their text at the tellp()
+ position and keep the rest of the string. tellp() is
+ then after the inserted text, on the beginning of the
+ rest of the string.
+ */
+ self & set_insert_mode(
+ insert_mode i_eMode );
+
+ void push_front(
+ const char * i_str );
+ void push_front(
+ char i_c );
+ void push_back(
+ const char * i_str );
+ void push_back(
+ char i_c );
+ void pop_front(
+ size_type i_nCount );
+ void pop_back(
+ size_type i_nCount );
+
+//*********** Not yet implemented *********************//
+ void strip_front(
+ char i_cToRemove );
+ void strip_back(
+ char i_cToRemove );
+ void strip_frontback(
+ char i_cToRemove );
+ void strip_front_whitespace(); /// removes space, tab and crlf.
+ void strip_back_whitespace();
+ void strip_frontback_whitespace();
+//*********** end - not yet implemented *****************//
+
+ void replace(
+ position_type i_nStart,
+ size_type i_nSize,
+ Area i_aReplacement );
+
+ void replace_all(
+ char i_cCarToSearch,
+ char i_cReplacement );
+ void replace_all(
+ Area i_aStrToSearch,
+ Area i_aReplacement );
+
+ StreamStr & to_lower(
+ position_type i_nStart = 0,
+ size_type i_nLength = str::maxsize );
+ StreamStr & to_upper(
+ position_type i_nStart = 0,
+ size_type i_nLength = str::maxsize );
+
+ // INQUIRY
+ const char * c_str() const;
+ const char * data() const;
+
+ bool empty() const;
+ size_type size() const;
+ size_type length() const;
+
+ size_type capacity() const;
+
+ position_type tellp() const;
+
+ const_iterator begin() const;
+ const_iterator cur() const;
+ const_iterator end() const;
+
+ size_type token_count(
+ char i_cSplit ) const;
+ String token(
+ position_type i_nNr, /// Starting with 0.
+ char i_cSpli ) const;
+
+ // ACCESS
+ iterator begin();
+ iterator cur();
+ iterator end();
+
+ private:
+ // Interface bostream
+ virtual UINT32 do_write(
+ const void * i_pSrc,
+ UINT32 i_nNrofBytes);
+ // Locals
+ void ProvideAddingSize(
+ size_type i_nSize2Add );
+ /// Resizes with the factor 2.0 (under 128), 1.5 or until i_nMinimumCapacity, whatever is bigger.
+ void Resize(
+ size_type i_nMinimumCapacity = 0 );
+ void Advance(
+ size_type i_nAddedSize );
+ void MoveData(
+ char * i_pStart,
+ char * i_pEnd,
+ seek_type i_nDiff );
+ // DATA
+ size_type nCapacity1;
+ DYN char * dpData;
+ char * pEnd;
+ char * pCur;
+ insert_mode eMode;
+};
+
+
+
+class StreamStrLock
+{
+ public:
+ StreamStrLock(
+ uintt i_nMinimalSize );
+ ~StreamStrLock();
+
+ StreamStr & operator()() { return *pStr; }
+
+ private:
+ StreamStr * pStr;
+};
+
+
+// IMPLEMENTATION
+
+inline const char *
+StreamStr::operator<<( F_CSTR )
+ { return dpData; }
+inline void
+StreamStr::clear()
+ { pEnd = pCur = dpData; *pEnd = '\0'; }
+inline const char *
+StreamStr::c_str() const
+ { return dpData; }
+inline const char *
+StreamStr::data() const
+ { return dpData; }
+inline bool
+StreamStr::empty() const
+ { return dpData == pEnd; }
+inline StreamStr::size_type
+StreamStr::size() const
+ { return pEnd - dpData; }
+inline StreamStr::size_type
+StreamStr::length() const
+ { return size(); }
+inline StreamStr::size_type
+StreamStr::capacity() const
+ { return nCapacity1-1; }
+inline StreamStr::position_type
+StreamStr::tellp() const
+ { return size_type(pCur-dpData); }
+inline StreamStr::const_iterator
+StreamStr::begin() const
+ { return dpData; }
+inline StreamStr::const_iterator
+StreamStr::cur() const
+ { return pCur; }
+inline StreamStr::const_iterator
+StreamStr::end() const
+ { return pEnd; }
+inline StreamStr::iterator
+StreamStr::begin()
+ { return dpData; }
+inline StreamStr::iterator
+StreamStr::cur()
+ { return pCur; }
+inline StreamStr::iterator
+StreamStr::end()
+ { return pEnd; }
+
+
+} // namespace csv
+
+
+
+
+#endif
+
diff --git a/cosv/inc/cosv/string.hxx b/cosv/inc/cosv/string.hxx
new file mode 100644
index 000000000000..7baacbd0b77c
--- /dev/null
+++ b/cosv/inc/cosv/string.hxx
@@ -0,0 +1,602 @@
+/*************************************************************************
+ *
+ * $RCSfile: string.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef COSV_STRING_HXX
+#define COSV_STRING_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/stringdata.hxx>
+#include <cosv/str_types.hxx>
+ // PARAMETERS
+#include <string.h>
+#include <cosv/csv_ostream.hxx>
+#include <vector>
+
+
+
+namespace csv
+{
+
+/** The Simple String:
+ It is used to just hold short to middle long texts as
+ data, which are constant at most times. They are reference
+ counted, so they are space efficient and have constant time
+ copy semantics.
+
+ For all compare() functions the return value is like in strcmp().
+
+ @attention
+ The present version of this class is NOT thread safe.
+*/
+
+
+class String
+{
+ public:
+ typedef String self;
+
+ typedef str::size size_type;
+ typedef str::position position_type;
+
+ typedef const char * const_iterator;
+
+ // LIFECYCLE
+ String();
+
+ explicit String(
+ const char * i_str );
+ /// @precond i_nLength <= strlen(i_str) or i_nLength == str::maxsize.
+ String(
+ const char * i_str,
+ size_type i_nLength );
+ String(
+ const self & i_rStr,
+ position_type i_nStartPosition);
+ /** @precond i_nLength == str::maxsize
+ || i_nStartPosition+i_nLength <= i_rStr.Size().
+ */
+ String(
+ const self & i_rStr,
+ position_type i_nStartPosition,
+ size_type i_nLength );
+ /** @precond i_itBegin and i_itEnd are in the same valid
+ memory-area, such that zero to finite times repetition of
+ ++i_itBegin leads to i_itBegin == i_itEnd.
+ */
+ String(
+ const_iterator i_itBegin,
+ const_iterator i_itEnd );
+
+ String(
+ const self & i_rStr );
+
+ ~String();
+ // OPERATORS
+ self & operator=(
+ const self & i_rStr );
+ self & operator=(
+ const char * i_str );
+
+ operator const char * () const;
+
+ const char & operator[](
+ position_type i_nPosition ) const;
+
+ bool operator==(
+ const self & i_rStr ) const;
+ bool operator!=(
+ const self & i_rStr ) const;
+ bool operator<(
+ const self & i_rStr ) const;
+ bool operator>(
+ const self & i_rStr ) const;
+ bool operator<=(
+ const self & i_rStr ) const;
+ bool operator>=(
+ const self & i_rStr ) const;
+
+ // OPERATIONS
+ void clear();
+
+ void swap(
+ self & i_rStr );
+
+ void assign(
+ const self & i_rStr,
+ position_type i_nStartPosition);
+ /** @precond i_nLength == str::maxsize
+ || i_nStartPosition+i_nLength <= i_rStr.Size().
+ */
+ void assign(
+ const self & i_rStr,
+ position_type i_nStartPosition,
+ size_type i_nLength );
+ void assign(
+ const char * i_str );
+ /// @precond i_nLength == str::maxsize OR i_nLength < strlen(i_str) .
+ void assign(
+ const char * i_str,
+ size_type i_nLength );
+ /// Create a string consisting of a sequence of i_nCount times the same char.
+ void assign(
+ size_type i_nCount,
+ char i_c );
+ /** @precond i_itBegin and i_itEnd are in the same valid
+ memory-area, such that zero to finite times repetition of
+ ++i_itBegin leads to i_itBegin == i_itEnd.
+ */
+ void assign(
+ const_iterator i_itBegin,
+ const_iterator i_itEnd );
+
+ // INQUIRY
+ const char * c_str() const;
+ const char * data() const;
+
+ bool empty() const;
+ size_type size() const;
+ size_type length() const;
+
+ const_iterator begin() const;
+
+ /// This is inefficient, so shouldn't be used within loops.
+ const_iterator end() const;
+
+ int compare(
+ const self & i_rStr ) const;
+ int compare(
+ const CharOrder_Table &
+ i_rOrder,
+ const self & i_rStr ) const;
+
+ self substr(
+ position_type i_nStartPosition = 0,
+ size_type i_nLength = str::maxsize ) const;
+
+//*********** Not yet implemented *********************//
+ position_type find(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = 0 ) const;
+ position_type find(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = 0 ) const;
+
+ position_type rfind(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+ position_type rfind(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+
+ position_type find_first_not_of(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = 0 ) const;
+ position_type find_first_not_of(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = 0 ) const;
+
+ position_type find_last_not_of(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+ position_type find_last_not_of(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+//*********** end - not yet implemented *****************//
+
+ static const self & Null_();
+ static const char & Nulch_();
+
+ private:
+ struct S_Data
+ {
+ S_Data();
+ /// @precond i_nValidLength <= strlen(i_sData) or i_nValidLength == str::maxsize.
+ S_Data(
+ const char * i_sData,
+ size_type i_nValidLength = str::maxsize );
+ ~S_Data();
+
+ const S_Data * Acquire() const;
+
+ /// Deletes this, if nCount becomes 0.
+ void Release() const;
+
+ StringData<char> aStr;
+ mutable UINT32 nCount;
+
+ private:
+ // Forbidden functions, because this is a refcounted structure.
+ S_Data(const S_Data&);
+ S_Data & operator=(const S_Data&);
+ };
+
+ // Locals
+ const StringData<char> &
+ Str() const;
+
+ // DATA
+ const S_Data * pd;
+};
+
+
+//********** Global compare functions ***************//
+
+ //*** Natural order, no substrings
+
+inline int compare(
+ const String & i_s1,
+ const char * i_s2 );
+inline int compare(
+ const char * i_s1,
+ const String & i_s2 );
+inline int compare(
+ const char * i_s1,
+ const char * i_s2 );
+
+ //*** Natural order, substrings
+
+int compare(
+ const String & i_s1,
+ csv::str::position i_nStartPosition1,
+ const char * i_s2,
+ csv::str::size i_nLength = csv::str::maxsize );
+int compare(
+ const char * i_s1,
+ const String & i_s2,
+ csv::str::position i_nStartPosition2,
+ csv::str::size i_nLength = csv::str::maxsize );
+inline int compare(
+ const char * i_s1,
+ const char * i_s2,
+ csv::str::size i_nLength );
+
+ //*** Defined order, no substrings
+
+inline int compare(
+ const CharOrder_Table & i_rOrder,
+ const String & i_s1,
+ const char * i_s2 );
+inline int compare(
+ const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const String & i_s2 );
+int compare(
+ const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const char * i_s2 );
+
+ //*** Defined order, substrings
+
+int compare(
+ const CharOrder_Table & i_rOrder,
+ const String & i_s1,
+ csv::str::position i_nStartPosition1,
+ const char * i_s2,
+ csv::str::size i_nLength2 = csv::str::maxsize );
+int compare(
+ const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const String & i_s2,
+ csv::str::position i_nStartPosition2,
+ csv::str::size i_nLength = csv::str::maxsize );
+int compare(
+ const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const char * i_s2,
+ csv::str::size i_nLength );
+
+} // namespace csv
+
+
+//****************** global comparation operators *********************//
+
+inline bool operator==(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator!=(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator<(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator>(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator<=(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator>=(
+ const csv::String & i_s1,
+ const char * i_s2 );
+
+inline bool operator==(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator!=(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator<(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator>(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator<=(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator>=(
+ const char * i_s1,
+ const csv::String & i_s2 );
+
+
+//****************** global stream operators *********************//
+
+
+inline csv::ostream &
+operator<<( csv::ostream & o_rOut,
+ const csv::String & i_rSrc );
+
+
+// IMPLEMENTATION
+
+
+namespace csv
+{
+
+inline const StringData<char> &
+String::Str() const
+{ return pd->aStr; }
+
+
+inline const char &
+String::operator[]( position_type i_nPosition ) const
+{ if ( i_nPosition < Str().Size() )
+ return Str().Data()[i_nPosition];
+ return Nulch_();
+}
+
+inline bool
+String::operator==( const self & i_rStr ) const
+{ return compare(i_rStr) == 0; }
+
+inline bool
+String::operator!=( const self & i_rStr ) const
+{ return compare(i_rStr) != 0; }
+
+inline bool
+String::operator<( const self & i_rStr ) const
+{ return compare(i_rStr) < 0; }
+
+inline bool
+String::operator>( const self & i_rStr ) const
+{ return compare(i_rStr) > 0; }
+
+inline bool
+String::operator<=( const self & i_rStr ) const
+{ return compare(i_rStr) <= 0; }
+
+inline bool
+String::operator>=( const self & i_rStr ) const
+{ return compare(i_rStr) >= 0; }
+
+inline void
+String::clear()
+{ operator=( String::Null_() ); }
+
+inline const char *
+String::c_str() const
+{ return Str().Data(); }
+
+inline
+String::operator const char * () const
+{ return c_str(); }
+
+inline const char *
+String::data() const
+{ return c_str(); }
+
+inline String::size_type
+String::size() const
+{ return Str().Size(); }
+
+inline bool
+String::empty() const
+{ return size() == 0; }
+
+inline String::size_type
+String::length() const
+{ return size(); }
+
+inline String::const_iterator
+String::begin() const
+{ return data(); }
+
+inline String::const_iterator
+String::end() const
+{ return data() + size(); }
+
+
+
+//****************** global compare-functions ********************//
+inline int
+compare( const String & i_s1,
+ const char * i_s2 )
+{ return strcmp(i_s1.c_str(), i_s2); }
+
+inline int
+compare( const char * i_s1,
+ const String & i_s2 )
+{ return strcmp(i_s1, i_s2.c_str()); }
+
+inline int
+compare( const char * i_s1,
+ const char * i_s2 )
+{ return strcmp(i_s1, i_s2); }
+
+inline int
+compare( const char * i_s1,
+ const char * i_s2,
+ str::size i_nLength )
+{ return strncmp( i_s1, i_s2, i_nLength ); }
+
+inline int
+compare( const CharOrder_Table & i_rOrder,
+ const String & i_s1,
+ const char * i_s2 )
+{ return compare( i_rOrder, i_s1.c_str(), i_s2 ); }
+
+inline int
+compare( const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const String & i_s2 )
+{ return compare( i_rOrder, i_s1, i_s2.c_str() ); }
+
+
+} // namespace csv
+
+
+inline bool
+operator==( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) == 0; }
+
+inline bool
+operator!=( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) != 0; }
+
+inline bool
+operator<( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) < 0; }
+
+inline bool
+operator>( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) > 0; }
+
+inline bool
+operator<=( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) <= 0; }
+
+inline bool
+operator>=( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) >= 0; }
+
+
+inline bool
+operator==( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) == 0; }
+
+inline bool
+operator!=( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) != 0; }
+
+inline bool
+operator<( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) < 0; }
+
+inline bool
+operator>( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) > 0; }
+
+inline bool
+operator<=( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) <= 0; }
+
+inline bool
+operator>=( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) >= 0; }
+
+
+ //************ global stream operators **************//
+
+
+inline csv::ostream &
+operator<<( csv::ostream & o_rOut,
+ const csv::String & i_rSrc )
+ { o_rOut << i_rSrc.c_str(); return o_rOut; }
+
+
+//****************** typedefs *********************//
+
+
+namespace csv
+{
+typedef std::vector<String> StringVector;
+}
+
+
+
+#endif
+
+
diff --git a/cosv/inc/cosv/stringdata.hxx b/cosv/inc/cosv/stringdata.hxx
new file mode 100644
index 000000000000..9d08933a363d
--- /dev/null
+++ b/cosv/inc/cosv/stringdata.hxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * $RCSfile: stringdata.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef COSV_STRINGDATA_HXX
+#define COSV_STRINGDATA_HXX
+
+
+#include <cosv/str_types.hxx>
+
+
+
+namespace csv
+{
+
+/** @tpl CHAR
+ The expression CHAR(0) has to be valid.
+*/
+template <class CHAR>
+class StringData
+{
+ public:
+ typedef StringData self;
+
+ typedef str::size size_type;
+ typedef str::position position_type;
+
+ // LIFECYCLE
+ StringData();
+ /** @precond i_pData != 0
+ @precond i_nValidLength <= strlen(i_pData)
+ */
+ StringData(
+ const CHAR * i_pData,
+ size_type i_nValidLength );
+ ~StringData();
+ // OPERATORS
+
+ // OPERATIONS
+
+ // INQUIRY
+ const CHAR * Data() const;
+
+ /** @returns the allocated number of CHAR.
+ This may be different from the number of bytes.
+ There is actually allocated one more CHAR,
+ which is guaranteed to be CHAR(0) in all circumstances.
+ */
+ size_type Size() const;
+
+ private:
+ /* Because this is used only within a refcounted structure,
+ these functions are forbidden - at least yet.
+ */
+ StringData(const self&);
+ self & operator=(const self&);
+
+ // DATA
+ DYN CHAR * dpData;
+ size_type nSize; /// The allocated size - 1 (for the finishing 0).
+};
+
+
+
+// IMPLEMENTATION
+
+template <class CHAR>
+StringData<CHAR>::StringData()
+ : dpData( new CHAR[1] ),
+ nSize(0)
+{
+ *dpData = CHAR(0);
+}
+
+template <class CHAR>
+StringData<CHAR>::StringData( const CHAR * i_pData,
+ size_type i_nValidLength )
+ : dpData( new CHAR[i_nValidLength + 1] ),
+ nSize(i_nValidLength)
+{
+ memcpy( dpData, i_pData, i_nValidLength * sizeof(CHAR) );
+ dpData[nSize] = CHAR(0);
+}
+
+template <class CHAR>
+StringData<CHAR>::~StringData()
+{
+ delete [] dpData;
+}
+
+template <class CHAR>
+const CHAR *
+StringData<CHAR>::Data() const
+{
+ return dpData;
+}
+
+template <class CHAR>
+StringData<CHAR>::size_type
+StringData<CHAR>::Size() const
+{
+ return nSize;
+}
+
+
+
+} // namespace csv
+
+
+#endif
+
+
diff --git a/cosv/inc/cosv/x.hxx b/cosv/inc/cosv/x.hxx
new file mode 100644
index 000000000000..d013d024096b
--- /dev/null
+++ b/cosv/inc/cosv/x.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * $RCSfile: x.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CSV_X_HXX
+#define CSV_X_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+
+
+namespace csv
+{
+
+class Exception
+{
+ public:
+ virtual ~Exception() {}
+ virtual void GetInfo(
+ ostream & o_rOutputMedium ) const = 0;
+};
+
+
+class X_Default : public Exception
+{
+ public:
+ X_Default(
+ const char * i_sMessage )
+ : sMessage(i_sMessage) {}
+ virtual void GetInfo( // Implemented in comfunc.cxx
+ ostream & o_rOutputMedium ) const;
+ private:
+ String sMessage;
+};
+
+
+} // namespace csv
+
+
+
+#endif
+
+
+
diff --git a/cosv/prj/build.lst b/cosv/prj/build.lst
new file mode 100644
index 000000000000..499cd3e38bbf
--- /dev/null
+++ b/cosv/prj/build.lst
@@ -0,0 +1,15 @@
+#====================================================================================
+cs cosv : tools NULL
+cs cosv usr1 - all cs_mkout NULL
+cs cosv\prj get - all cs_prj NULL
+cs cosv\inc get - all cs_inc NULL
+cs cosv\inc\cosv get - all cs_inc_cosv NULL
+cs cosv\inc\cosv\template get - all cs_inc_templ NULL
+cs cosv\source get - all cs_src NULL
+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
+#==============================================================================================
+
diff --git a/cosv/prj/d.lst b/cosv/prj/d.lst
new file mode 100644
index 000000000000..81024c5d58ea
--- /dev/null
+++ b/cosv/prj/d.lst
@@ -0,0 +1,10 @@
+mkdir: %_DEST%\inc%_EXT%\cosv
+mkdir: %_DEST%\inc%_EXT%\cosv\template
+
+..\%__SRC%\lib\cosv.lib %_DEST%\lib%_EXT%\cosv.lib
+..\%__SRC%\lib\acosv.a %_DEST%\lib%_EXT%\acosv.a
+..\inc\cosv\*.hxx %_DEST%\inc%_EXT%\cosv\*.hxx
+..\inc\cosv\*.h %_DEST%\inc%_EXT%\cosv\*.h
+..\inc\cosv\template\*.hxx %_DEST%\inc%_EXT%\cosv\template\*.hxx
+..\inc\cosv\template\*.cxx %_DEST%\inc%_EXT%\cosv\template\*.cxx
+
diff --git a/cosv/source/fullcpp.mk b/cosv/source/fullcpp.mk
new file mode 100644
index 000000000000..f22e55dc17ed
--- /dev/null
+++ b/cosv/source/fullcpp.mk
@@ -0,0 +1,87 @@
+#*************************************************************************
+#
+# $RCSfile: fullcpp.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+
+
+# --- Settings -----------------------------------------------------
+# Has to be inlcuded AFTER settings.mk !
+
+
+.IF "$(GUI)"=="WNT"
+
+# RTTI
+CFLAGS+= /GR
+
+.IF "$(NP_LOCALBUILD)"!=""
+
+# Precompiled Headers
+PCH_NAME= cosv
+.IF "$(DEBUG)"==""
+CFLAGS+= -YX"precomp.h" /Fp$(PRJ)$/$(INPATH)$/misc$/$(PCH_NAME).pch
+.ELSE
+CFLAGS+= -YX"precomp.h" /Fp$(PRJ)$/$(INPATH)$/misc$/$(PCH_NAME).pcd -DNP_LOCALBUILD
+.ENDIF
+
+.ENDIF
+
+.ENDIF
+
diff --git a/cosv/source/inc/precomp.h b/cosv/source/inc/precomp.h
new file mode 100644
index 000000000000..368b092c991b
--- /dev/null
+++ b/cosv/source/inc/precomp.h
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * $RCSfile: precomp.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CSV_PRECOMP_H
+#define CSV_PRECOMP_H
+
+
+#include <cosv/csv_precomp.h>
+
+
+
+#endif
+
diff --git a/cosv/source/service/comdline.cxx b/cosv/source/service/comdline.cxx
new file mode 100644
index 000000000000..222c79300115
--- /dev/null
+++ b/cosv/source/service/comdline.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: comdline.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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 <precomp.h>
+#include <cosv/comdline.hxx>
+
+// NOT FULLY DECLARED SERVICES
+
+
+namespace csv
+{
+
+
+bool
+CommandLine_Ifc::CheckParameters() const
+{
+ if ( NOT inq_CheckParameters() )
+ {
+ PrintUse();
+ return false;
+ }
+
+ return true;
+}
+
+
+
+
+} // namespace csv
+
+
+
+
diff --git a/cosv/source/service/comfunc.cxx b/cosv/source/service/comfunc.cxx
new file mode 100644
index 000000000000..d045d421a975
--- /dev/null
+++ b/cosv/source/service/comfunc.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * $RCSfile: comfunc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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 <precomp.h>
+
+#include <ctype.h>
+#include <cosv/comfunc.hxx>
+#include <cosv/string.hxx>
+#include <cosv/x.hxx>
+#include <cosv/std_outp.hxx>
+
+
+
+namespace csv
+{
+
+
+void
+X_Default::GetInfo( ostream & o_rOutputMedium ) const
+{
+ o_rOutputMedium << "Error (general exception): ";
+ o_rOutputMedium << sMessage
+ << Endl;
+}
+
+intt
+count_chars(const char * str, char c)
+{
+ intt nCount = 0;
+ for ( const char * pSpc = strchr(str, c);
+ pSpc != 0;
+ pSpc = strchr(pSpc+1, c) )
+ {
+ nCount++;
+ }
+ return nCount;
+}
+
+
+
+// Zeit-Typecasts
+bool
+str2date(const char * str, int & out_day, int & out_month, int & out_year)
+{
+ const char * z = str;
+ out_day = 0;
+ out_month = 0;
+ out_year = 0;
+
+ while (isdigit(*z))
+ out_day = 10*out_day + *(z++) - '0';
+ if (*z == 0)
+ return false;
+ z++;
+ while (isdigit(*z))
+ out_month = 10*out_month + *(z++) - '0';
+ if (*z == 0)
+ return false;
+ z++;
+ while (isdigit(*z))
+ out_year = 10*out_year + *(z++) - '0';
+ return true;
+}
+
+void
+date2str(String & out_Str, int day, int month, int year)
+{
+ char buf[11] = "00.00.0000";
+ buf[0] = char(day/10) + '0';
+ buf[1] = char(day%10) + '0';
+ buf[3] = char(month/10) + '0';
+ buf[4] = char(month%10) + '0';
+
+ if (year < 100)
+ {
+ buf[6] = char(year/10) + '0';
+ buf[7] = char(year%10) + '0';
+ buf[8] = 0;
+ }
+ else
+ {
+ buf[6] = char(year/1000) + '0';
+ buf[7] = char(year%1000/100) + '0';
+ buf[8] = char(year%100/10) + '0';
+ buf[9] = char(year%10) + '0';
+ }
+ out_Str = buf;
+}
+
+bool
+str2time(const char * str, int & out_hour, int & out_min, int & out_sec)
+{
+ const char * z = str;
+ out_hour = 0;
+ out_min = 0;
+ out_sec = 0;
+
+ while (isdigit(*z))
+ out_hour = 10*out_hour + *(z++) - '0';
+ if (*z == 0)
+ return false;
+ z++;
+ while (isdigit(*z))
+ out_min = 10*out_min + *(z++) - '0';
+ if (*z == 0)
+ return false;
+ z++;
+ while (isdigit(*z))
+ out_sec = 10*out_sec + *(z++) - '0';
+ return true;
+}
+
+void
+time2str(String & out_Str, int hour, int min, int sec)
+{
+ char buf[9] = "00:00:00";
+ buf[0] = char(hour/10) + '0';
+ buf[1] = char(hour%10) + '0';
+ buf[3] = char(min/10) + '0';
+ buf[4] = char(min%10) + '0';
+ buf[6] = char(sec/10) + '0';
+ buf[7] = char(sec%10) + '0';
+ out_Str = buf;
+}
+
+
+
+} // namespace csv
+
+
+
diff --git a/cosv/source/service/csv_ostream.cxx b/cosv/source/service/csv_ostream.cxx
new file mode 100644
index 000000000000..c5a8c636141f
--- /dev/null
+++ b/cosv/source/service/csv_ostream.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * $RCSfile: csv_ostream.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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 <precomp.h>
+#include <cosv/csv_ostream.hxx>
+
+// NOT FULLY DECLARED SERVICES
+
+
+#ifndef CSV_NO_IOSTREAMS
+#else
+
+#include <cosv/streamstr.hxx>
+
+namespace csv
+{
+
+ostream::~ostream() { }
+
+ostream & ostream::operator<<(
+ const char * i_s ) { *pData << i_s; return *this; }
+ostream & ostream::operator<<(
+ char i_c ) { *pData << i_c; return *this; }
+ostream & ostream::operator<<(
+ unsigned char i_c ) { *pData << i_c; return *this; }
+ostream & ostream::operator<<(
+ signed char i_c ) { *pData << i_c; return *this; }
+
+ostream & ostream::operator<<(
+ short i_n ) { *pData << i_n; return *this; }
+ostream & ostream::operator<<(
+ unsigned short i_n ) { *pData << i_n; return *this; }
+ostream & ostream::operator<<(
+ int i_n ) { *pData << i_n; return *this; }
+ostream & ostream::operator<<(
+ unsigned int i_n ) { *pData << i_n; return *this; }
+ostream & ostream::operator<<(
+ long i_n ) { *pData << i_n; return *this; }
+ostream & ostream::operator<<(
+ unsigned long i_n ) { *pData << i_n; return *this; }
+
+ostream & ostream::operator<<(
+ float i_n ) { *pData << i_n; return *this; }
+ostream & ostream::operator<<(
+ double i_n ) { *pData << i_n; return *this; }
+
+ostream &
+ostream::seekp( intt i_nOffset,
+ seek_dir i_eStart )
+{
+ pData->seekp(i_nOffset, csv::seek_dir(int(i_eStart)) );
+ return *this;
+}
+
+ostream::ostream( uintt i_nStartSize )
+ : pData( new StreamStr(i_nStartSize) )
+{
+}
+
+
+
+} // namespace csv
+
+#endif
+
+
+
+
diff --git a/cosv/source/service/datetime.cxx b/cosv/source/service/datetime.cxx
new file mode 100644
index 000000000000..353fe0ed6373
--- /dev/null
+++ b/cosv/source/service/datetime.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: datetime.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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 <precomp.h>
+#include <cosv/datetime.hxx>
+
+
+// NOT FULLY DECLARED SERVICES
+
+
+namespace csv
+{
+
+
+Date::Date()
+ : nData( 0 )
+{
+}
+
+Date::Date( unsigned i_nDay,
+ unsigned i_nMonth,
+ unsigned i_nYear )
+ : nData( (i_nDay << 24) + (i_nMonth << 16) + i_nYear )
+{
+}
+
+const Date &
+Date::Null_()
+{
+ static const Date C_DateNull_(0,0,0);
+ return C_DateNull_;
+}
+
+
+Time::Time()
+ : nData( 0 )
+{
+}
+
+Time::Time( unsigned i_nHour,
+ unsigned i_nMinutes,
+ unsigned i_nSeconds,
+ unsigned i_nSeconds100 )
+ : nData( (i_nHour << 24) + (i_nMinutes << 16) + (i_nSeconds << 8) + i_nSeconds100 )
+{
+}
+
+const Time &
+Time::Null_()
+{
+ static const Time C_TimeNull_(0,0);
+ return C_TimeNull_;
+}
+
+
+
+} // namespace csv
+
+
diff --git a/cosv/source/service/makefile.mk b/cosv/source/service/makefile.mk
new file mode 100644
index 000000000000..85e23b232e5f
--- /dev/null
+++ b/cosv/source/service/makefile.mk
@@ -0,0 +1,94 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+#
+# 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_service
+
+ENABLE_EXCEPTIONS=true
+
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.INCLUDE : $(PRJ)$/source$/fullcpp.mk
+
+
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= \
+ $(OBJ)$/comdline.obj \
+ $(OBJ)$/comfunc.obj \
+ $(OBJ)$/csv_ostream.obj \
+ $(OBJ)$/datetime.obj \
+ $(OBJ)$/std_outp.obj
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+
diff --git a/cosv/source/service/std_outp.cxx b/cosv/source/service/std_outp.cxx
new file mode 100644
index 000000000000..c40f6c704dde
--- /dev/null
+++ b/cosv/source/service/std_outp.cxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: std_outp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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 <precomp.h>
+#include <cosv/std_outp.hxx>
+
+// NOT FULLY DECLARED SERVICES
+
+namespace csv
+{
+
+redirect_out * redirect_out::pStdOut_ = 0;
+redirect_out * redirect_out::pStdErr_ = 0;
+
+
+void
+Endl( ostream & io_rStream, bool bUseRedirect, int* )
+{
+#ifndef CSV_NO_IOSTREAMS
+ if (NOT bUseRedirect)
+ io_rStream << std::endl;
+ else
+#endif
+ static_cast< redirect_out& >(io_rStream).re_endl();
+}
+
+void
+Flush( ostream & io_rStream, bool bUseRedirect, int* )
+{
+#ifndef CSV_NO_IOSTREAMS
+ if (NOT bUseRedirect)
+ io_rStream << std::flush;
+ else
+#endif
+ static_cast< redirect_out& >(io_rStream).re_flush();
+}
+
+void
+PerformAssertion(const char * condition, const char * file, unsigned line)
+{
+ Cout() << "assertion failed: "
+ << condition
+ << " in file: "
+ << file
+ << " at line: "
+ << __LINE__
+ << Endl;
+
+ exit(3);
+}
+
+} // namespace csv
+
diff --git a/cosv/source/storage/dirchain.cxx b/cosv/source/storage/dirchain.cxx
new file mode 100644
index 000000000000..cccf086fcc5d
--- /dev/null
+++ b/cosv/source/storage/dirchain.cxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * $RCSfile: dirchain.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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 <precomp.h>
+#include <cosv/dirchain.hxx>
+
+// NOT FULLY DECLARED SERVICES
+#include <cosv/bstream.hxx>
+
+
+namespace csv
+{
+namespace ploc
+{
+
+DirectoryChain::DirectoryChain()
+{
+}
+
+DirectoryChain::DirectoryChain( const char * i_sSubPath,
+ bool i_bPathIsAlwaysDir,
+ const char * i_sDelimiter )
+{
+ Set( i_sSubPath, i_bPathIsAlwaysDir, i_sDelimiter );
+}
+
+DirectoryChain::~DirectoryChain()
+{
+}
+
+void
+DirectoryChain::Set( const char * i_sSubPath,
+ bool i_bPathIsAlwaysDir,
+ const char * i_sDelimiter )
+{
+ const char * pRestPath = i_sSubPath;
+ if ( pRestPath != 0 ? *pRestPath == *i_sDelimiter : false )
+ ++pRestPath;
+
+ for ( const char * pDirEnd = strchr(pRestPath,*i_sDelimiter);
+ pDirEnd != 0;
+ pDirEnd = strchr(pRestPath,*i_sDelimiter) )
+ {
+ aPath.push_back( String(pRestPath, pDirEnd - pRestPath) );
+ pRestPath = pDirEnd + 1;
+ }
+ if (*pRestPath != 0 AND i_bPathIsAlwaysDir)
+ aPath.push_back( String(pRestPath) );
+}
+
+void
+DirectoryChain::PushFront( const String & i_sName )
+{
+ aPath.insert( aPath.begin(), i_sName );
+}
+
+void
+DirectoryChain::PushFront( const DirectoryChain & i_sPath )
+{
+ aPath.insert( aPath.begin(), i_sPath.Begin(), i_sPath.End() );
+}
+
+void
+DirectoryChain::PushBack( const String & i_sName )
+{
+ aPath.push_back(i_sName);
+}
+
+void
+DirectoryChain::PushBack( const DirectoryChain & i_sPath )
+{
+ aPath.insert( aPath.end(), i_sPath.Begin(), i_sPath.End() );
+}
+
+void
+DirectoryChain::PopFront( uintt i_nCount )
+{
+ if (i_nCount <= aPath.size())
+ aPath.erase( aPath.begin(), aPath.begin() + i_nCount );
+ else
+ aPath.erase( aPath.begin(), aPath.end() );
+}
+
+void
+DirectoryChain::PopBack( uintt i_nCount )
+{
+ if (i_nCount <= aPath.size())
+ aPath.erase( aPath.end() - i_nCount, aPath.end() );
+ else
+ aPath.erase( aPath.begin(), aPath.end() );
+}
+
+void
+DirectoryChain::Get( ostream & o_rPath,
+ const char * i_sDelimiter ) const
+{
+ for ( std::vector<String>::const_iterator it = aPath.begin();
+ it != aPath.end();
+ ++it )
+ {
+ o_rPath << (*it).c_str() << i_sDelimiter;
+ }
+}
+
+void
+DirectoryChain::Get( bostream & o_rPath,
+ const char * i_sDelimiter ) const
+{
+ uintt deliLen = strlen(i_sDelimiter);
+
+ for ( std::vector<String>::const_iterator it = aPath.begin();
+ it != aPath.end();
+ ++it )
+ {
+ o_rPath.write( (*it).c_str() );
+ o_rPath.write( i_sDelimiter, deliLen);
+ }
+}
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
diff --git a/cosv/source/storage/file.cxx b/cosv/source/storage/file.cxx
new file mode 100644
index 000000000000..8385c9f05d5f
--- /dev/null
+++ b/cosv/source/storage/file.cxx
@@ -0,0 +1,257 @@
+/*************************************************************************
+ *
+ * $RCSfile: file.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ *
+ * 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 <precomp.h>
+#include <cosv/file.hxx>
+
+// NOT FULLY DECLARED SERVICES
+
+
+namespace csv
+{
+
+
+File::File( uintt i_nMode )
+ : // aPath,
+ pStream(0),
+ nMode(i_nMode),
+ eLastIO(io_none)
+{
+}
+
+File::File( const ploc::Path & i_rLocation,
+ uintt i_nMode )
+ : aPath(i_rLocation),
+ pStream(0),
+ nMode(i_nMode),
+ eLastIO(io_none)
+{
+}
+
+File::File( const char * i_sLocation,
+ uintt i_nMode )
+ : aPath(i_sLocation),
+ pStream(0),
+ nMode(i_nMode),
+ eLastIO(io_none)
+{
+}
+
+File::File( const String & i_sLocation,
+ uintt i_nMode )
+ : aPath(i_sLocation),
+ pStream(0),
+ nMode(i_nMode),
+ eLastIO(io_none)
+{
+}
+
+File::~File()
+{
+ if (is_open() )
+ close();
+}
+
+bool
+File::Assign( ploc::Path i_rLocation )
+{
+ if (is_open() )
+ return false;
+
+ InvalidatePath();
+ aPath = i_rLocation;
+ return true;
+}
+
+bool
+File::Assign( const char * i_sLocation )
+{
+ if (is_open() )
+ return false;
+
+ InvalidatePath();
+ aPath.Set( i_sLocation );
+ return true;
+}
+
+bool
+File::Assign( const String & i_sLocation )
+{
+ if (is_open() )
+ return false;
+
+ InvalidatePath();
+ aPath.Set( i_sLocation );
+ return true;
+}
+
+uintt
+File::do_read( void * out_pDest,
+ uintt i_nNrofBytes )
+{
+ if ( NOT is_open() )
+ return 0;
+
+ if ( eLastIO == io_write )
+ ::fseek( pStream, 0, SEEK_CUR );
+ uintt ret = position();
+ ::fread( out_pDest, 1, i_nNrofBytes, pStream );
+ ret = position() - ret;
+
+ eLastIO = io_read;
+ return ret;
+}
+
+bool
+File::inq_eod() const
+{
+ if ( NOT is_open() )
+ return true;
+ return feof(pStream) != 0;
+}
+
+uintt
+File::do_write( const void * i_pSrc,
+ uintt i_nNrofBytes )
+{
+ if ( NOT is_open() )
+ return 0;
+
+ if ( eLastIO == io_write )
+ ::fseek( pStream, 0, SEEK_CUR );
+ uintt ret = position();
+ ::fwrite( i_pSrc, 1, i_nNrofBytes, pStream );
+ ret = position() - ret;
+
+ eLastIO = io_write;
+ return ret;
+}
+
+uintt
+File::do_seek( intt i_nDistance,
+ seek_dir i_eStartPoint )
+{
+ static int eSearchDir[3] = { SEEK_SET, SEEK_CUR, SEEK_END };
+
+ ::fseek( pStream,
+ intt(i_nDistance),
+ eSearchDir[i_eStartPoint] );
+ return position();
+}
+
+uintt
+File::inq_position() const
+{
+ return uintt( ::ftell(pStream) );
+}
+
+bool
+File::do_open( uintt i_nOpenMode )
+{
+ if ( i_nOpenMode != 0 )
+ nMode = i_nOpenMode;
+
+ const char * sFacadeMode = "";
+ switch ( nMode )
+ {
+ case CFM_RW: sFacadeMode = "r+b";
+ break;
+ case CFM_CREATE: sFacadeMode = "w+b";
+ break;
+ case CFM_READ: sFacadeMode = "rb";
+ break;
+ default:
+ sFacadeMode = "rb";
+ }
+
+ pStream = ::fopen( StrPath(), sFacadeMode );
+ if ( pStream == 0 AND nMode == CFM_RW )
+ {
+ sFacadeMode = "w+b";
+ pStream = ::fopen( StrPath(), sFacadeMode );
+ }
+
+ return pStream != 0;
+}
+
+void
+File::do_close()
+{
+ ::fclose(pStream);
+ pStream = 0;
+ eLastIO = io_none;
+}
+
+bool
+File::inq_is_open() const
+{
+ return pStream != 0;
+}
+
+const ploc::Path &
+File::inq_MyPath() const
+{
+ return aPath;
+}
+
+
+} // namespace csv
+
diff --git a/cosv/source/storage/makefile.mk b/cosv/source/storage/makefile.mk
new file mode 100644
index 000000000000..bae315146df0
--- /dev/null
+++ b/cosv/source/storage/makefile.mk
@@ -0,0 +1,104 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+#
+# 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_storage
+
+ENABLE_EXCEPTIONS=true
+
+
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.INCLUDE : $(PRJ)$/source$/fullcpp.mk
+
+
+
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= \
+ $(OBJ)$/dirchain.obj \
+ $(OBJ)$/file.obj \
+ $(OBJ)$/mbstream.obj \
+ $(OBJ)$/persist.obj \
+ $(OBJ)$/ploc.obj \
+ $(OBJ)$/ploc_dir.obj \
+ $(OBJ)$/plocroot.obj
+
+#SLOFILES= \
+# $(SLO)$/file.obj \
+# $(SLO)$/csfileim.obj \
+# $(SLO)$/memstorg.obj
+
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+
diff --git a/cosv/source/storage/mbstream.cxx b/cosv/source/storage/mbstream.cxx
new file mode 100644
index 000000000000..526a42d2bd11
--- /dev/null
+++ b/cosv/source/storage/mbstream.cxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * $RCSfile: mbstream.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/mbstream.hxx>
+
+// NOT FULLY DECLARED SERVICES
+#include <string.h>
+
+
+namespace csv
+{
+
+
+
+mbstream::mbstream( uintt i_nSize )
+ : dpOwnedMemorySpace( new char[i_nSize+1] ),
+ nSize( i_nSize ),
+ nCurPosition( 0 )
+{
+ dpOwnedMemorySpace[i_nSize] = '\0';
+}
+
+mbstream::~mbstream()
+{
+ delete [] dpOwnedMemorySpace;
+}
+
+void
+mbstream::resize( uintt i_nSize )
+{
+ DYN char * pNew = new char[i_nSize];
+ memcpy( pNew, dpOwnedMemorySpace, min(i_nSize,nSize) );
+ delete [] dpOwnedMemorySpace;
+ dpOwnedMemorySpace = pNew;
+ nSize = i_nSize;
+}
+
+uintt
+mbstream::do_read( void * out_pDest,
+ uintt i_nNrofBytes )
+{
+ uintt ret = min( i_nNrofBytes, nSize - nCurPosition );
+ memcpy( out_pDest, dpOwnedMemorySpace, ret );
+ nCurPosition += ret;
+ return ret;
+}
+
+bool
+mbstream::inq_eod() const
+{
+ return nCurPosition == nSize;
+}
+
+uintt
+mbstream::do_write( const void * i_pSrc,
+ uintt i_nNrofBytes )
+{
+ resize( max( 3 * (nSize+1) / 2, nCurPosition + i_nNrofBytes) );
+ memcpy( dpOwnedMemorySpace+nCurPosition, i_pSrc, i_nNrofBytes );
+ nCurPosition += i_nNrofBytes;
+ return i_nNrofBytes;
+}
+
+uintt
+mbstream::do_seek( intt i_nDistance,
+ seek_dir i_eStartPoint )
+{
+ switch ( i_eStartPoint )
+ {
+ case beg: if ( uintt(i_nDistance) < nSize )
+ nCurPosition = uintt(i_nDistance);
+ break;
+ case cur: if ( i_nDistance < 0
+ ? uintt(-i_nDistance) <= nCurPosition
+ : uintt(i_nDistance) + nCurPosition < nSize )
+ nCurPosition = uintt( intt(nCurPosition) + i_nDistance );
+ break;
+ case end: if ( i_nDistance < 0
+ AND uintt(-i_nDistance) < nSize - 1 )
+ nCurPosition = uintt( intt(nSize) - 1 + i_nDistance );
+ break;
+ }
+ return position();
+}
+
+uintt
+mbstream::inq_position() const
+{
+ return nCurPosition;
+}
+
+
+} // namespace csv
+
diff --git a/cosv/source/storage/persist.cxx b/cosv/source/storage/persist.cxx
new file mode 100644
index 000000000000..9087c88b5c12
--- /dev/null
+++ b/cosv/source/storage/persist.cxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * $RCSfile: persist.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/persist.hxx>
+
+// NOT FULLY DECLARED SERVICES
+#include <cosv/streamstr.hxx>
+#include <cosv/ploc.hxx>
+
+
+namespace csv
+{
+namespace ploc
+{
+
+#ifdef WNT
+#include <io.h>
+
+bool
+Persistent::Exists() const
+{
+ return access( StrPath(), 00) == 0;
+}
+
+#elif defined(UNX)
+#include <unistd.h>
+
+bool
+Persistent::Exists() const
+{
+ return access( StrPath(), F_OK ) == 0;
+}
+
+
+#else
+#error For using csv::ploc there has to be defined: WNT or UNX.
+#endif
+
+const char *
+Persistent::StrPath() const
+{
+ if (sPath.empty() )
+ {
+#ifndef CSV_NO_MUTABLE
+ StreamStr & rsPath = sPath;
+#else
+ StreamStr & rsPath = const_cast< StreamStr& >(sPath);
+#endif
+ rsPath.seekp(0);
+ rsPath << MyPath();
+ if (MyPath().IsDirectory())
+ rsPath.pop_back(1); // Remove closing delimiter.
+ }
+ return sPath.c_str();
+}
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
diff --git a/cosv/source/storage/ploc.cxx b/cosv/source/storage/ploc.cxx
new file mode 100644
index 000000000000..c3d86658db5c
--- /dev/null
+++ b/cosv/source/storage/ploc.cxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * $RCSfile: ploc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/ploc.hxx>
+
+// NOT FULLY DECLARED SERVICES
+#include <cosv/bstream.hxx>
+// #include <ctype.h>
+
+
+namespace csv
+{
+namespace ploc
+{
+
+
+Path::Path( const char * i_sPath,
+ bool i_bPathIsAlwaysDir,
+ const char * i_sDelimiter )
+ : pRoot(0)
+ // aPath,
+ // sFile
+{
+ Set(i_sPath, i_bPathIsAlwaysDir, i_sDelimiter );
+}
+
+Path::Path( const Path & i_rPath )
+ : pRoot(i_rPath.pRoot->CreateCopy()),
+ aPath(i_rPath.aPath),
+ sFile(i_rPath.sFile)
+{
+}
+
+Path::~Path()
+{
+}
+
+Path &
+Path::operator=( const Path & i_rPath )
+{
+ pRoot = i_rPath.pRoot->CreateCopy();
+ aPath = i_rPath.aPath;
+ sFile = i_rPath.sFile;
+ return *this;
+}
+
+
+void
+Path::Set( const char * i_sPath,
+ bool i_bPathIsAlwaysDir,
+ const char * i_sDelimiter )
+{
+ if ( *i_sDelimiter != '\\' AND *i_sDelimiter != '/' )
+ return;
+
+ const char * pRestPath = 0;
+ pRoot = Root::Create_( pRestPath, i_sPath, i_sDelimiter );
+ if (pRestPath == 0)
+ return;
+
+ aPath.Set(pRestPath, i_bPathIsAlwaysDir, i_sDelimiter);
+
+ if (NOT i_bPathIsAlwaysDir)
+ {
+ pRestPath = strrchr( pRestPath, *i_sDelimiter );
+ if ( NOT no_str(pRestPath) )
+ sFile = pRestPath + 1;
+ }
+}
+
+void
+Path::SetFile( const String & i_sName )
+{
+ sFile = i_sName;
+}
+
+const char *
+Path::FileEnding() const
+{
+ const char * pEnd = strrchr(sFile, '.');
+ if (pEnd != 0)
+ ++pEnd;
+ else
+ pEnd = "";
+ return pEnd;
+}
+
+bool
+Path::IsValid() const { return RootDir().OwnDelimiter() != 0; }
+
+void
+Path::Get( ostream & o_rPath ) const
+{
+ if (NOT IsValid())
+ return;
+
+ pRoot->Get( o_rPath );
+ aPath.Get( o_rPath, pRoot->OwnDelimiter() );
+
+ if ( sFile.length() > 0 )
+ o_rPath << sFile;
+
+}
+
+void
+Path::Get( bostream & o_rPath ) const
+{
+ if (NOT IsValid())
+ return;
+
+ pRoot->Get( o_rPath );
+ aPath.Get( o_rPath, pRoot->OwnDelimiter() );
+
+ if ( sFile.length() > 0 )
+ o_rPath.write( sFile );
+}
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
diff --git a/cosv/source/storage/ploc_dir.cxx b/cosv/source/storage/ploc_dir.cxx
new file mode 100644
index 000000000000..00d424eed3d1
--- /dev/null
+++ b/cosv/source/storage/ploc_dir.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * $RCSfile: ploc_dir.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/ploc_dir.hxx>
+
+// NOT FULLY DECLARED SERVICES
+#include <cosv/ploc.hxx>
+
+
+namespace csv
+{
+namespace ploc
+{
+
+Directory::Directory()
+{
+}
+
+Directory::Directory( const Path & i_rPath )
+ : aPath(i_rPath)
+ // sPath
+{
+}
+
+Directory::Directory( const Directory & i_rDir )
+ : aPath(i_rDir.aPath)
+ // sPath
+{
+}
+
+Directory::Directory( const char * i_rLocation )
+ : aPath(i_rLocation, true)
+{
+}
+
+Directory::Directory( const String & i_rLocation )
+ : aPath(i_rLocation.c_str(), true)
+{
+}
+
+Directory::~Directory()
+{
+}
+
+Directory &
+Directory::operator+=( const String & i_sName )
+{
+ InvalidatePath();
+ aPath.DirChain() += i_sName;
+ return *this;
+}
+
+Directory &
+Directory::operator+=( const DirectoryChain & i_sDirChain )
+{
+ InvalidatePath();
+ aPath.DirChain() += i_sDirChain;
+ return *this;
+}
+
+Directory &
+Directory::operator-=( uintt i_nLevels )
+{
+ InvalidatePath();
+ aPath.DirChain().PopBack(i_nLevels);
+ return *this;
+}
+
+bool
+Directory::PhysicalCreate( bool i_bCreateParentsIfNecessary )
+{
+ bool ret = PhysicalCreate_Dir( StrPath() );
+ if ( ret OR NOT i_bCreateParentsIfNecessary )
+ return ret;
+
+ ret = Check_Parent();
+ if (ret)
+ ret = PhysicalCreate_Dir( StrPath() );
+ return ret;
+}
+
+bool
+Directory::Check_Parent()
+{
+ // There is no parent of root directories:
+ if ( aPath.DirChain().Size() == 0 )
+ return false;
+
+ // Become my own parent:
+ String sLastToken = aPath.DirChain().Back();
+ operator-=(1);
+
+ // Begin behaving as parent:
+ bool ret = Exists();
+ if (NOT ret)
+ {
+ ret = Check_Parent();
+ if (ret)
+ ret = PhysicalCreate_Dir( StrPath() );
+ }
+ // End behaving as parent.
+
+ // Become myself again:
+ operator+=(sLastToken);
+ return ret;
+}
+
+
+
+#ifdef WNT
+#include <direct.h>
+#include <io.h>
+
+bool
+Directory::PhysicalCreate_Dir( const char * i_sStr ) const
+{
+ return mkdir( i_sStr ) == 0;
+}
+
+void
+Directory::GetContainedDirectories( StringVector & o_rResult ) const
+{
+ const char * c_sANYDIR = "\\*.*";
+ String sNew;
+
+ StreamStr sFilter(200);
+ sFilter << StrPath()
+ << c_sANYDIR;
+
+ struct _finddata_t
+ aEntry;
+ long hFile = _findfirst( sFilter.c_str(), &aEntry );
+
+ for ( int bFindMore = (hFile == -1 ? 1 : 0);
+ bFindMore == 0;
+ bFindMore = _findnext( hFile, &aEntry ) )
+ {
+ if (aEntry.attrib == _A_SUBDIR AND *aEntry.name != '.' )
+ {
+ sNew = aEntry.name;
+ o_rResult.push_back( sNew );
+ }
+ } // end for
+ _findclose(hFile);
+}
+
+void
+Directory::GetContainedFiles( StringVector & o_rResult,
+ const char * i_sFilter,
+ E_Recursivity i_eRecursivity ) const
+{
+ StreamStr sNew(240);
+ sNew << aPath;
+ StreamStr::size_type
+ nStartFilename = sNew.tellp();
+
+ StreamStr sFilter(200);
+ sFilter << StrPath()
+ << "\\"
+ << i_sFilter;
+
+ struct _finddata_t
+ aEntry;
+ long hFile = _findfirst( sFilter.c_str(), &aEntry );
+ for ( int bFindMore = (hFile == -1 ? 1 : 0);
+ bFindMore == 0;
+ bFindMore = _findnext( hFile, &aEntry ) )
+ {
+ sNew.seekp(nStartFilename);
+ sNew << aEntry.name;
+ String sNewAsString( sNew.c_str() );
+ o_rResult.push_back(sNewAsString);
+ } // end for
+
+ _findclose(hFile);
+ if ( i_eRecursivity == flat )
+ return;
+
+ // gathering from subdirectories:
+ StringVector aSubDirectories;
+ GetContainedDirectories( aSubDirectories );
+
+ StringVector::const_iterator dEnd = aSubDirectories.end();
+ for ( StringVector::const_iterator d = aSubDirectories.begin();
+ d != dEnd;
+ ++d )
+ {
+ Directory aSub(*this);
+ aSub += *d;
+ aSub.GetContainedFiles( o_rResult,
+ i_sFilter,
+ i_eRecursivity );
+ }
+}
+
+#elif defined(UNX)
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <unistd.h>
+
+bool
+Directory::PhysicalCreate_Dir( const char * i_sStr ) const
+{
+ return mkdir( i_sStr, 00777 ) == 0;
+}
+
+void
+Directory::GetContainedDirectories( StringVector & o_rResult ) const
+{
+ DIR * pDir = opendir( StrPath().c_str() );
+ dirent * pEntry = 0;
+ struct stat aEntryStatus;
+
+ while ( (pEntry = readdir(pDir)) != 0 )
+ {
+ stat(pEntry->d_name, &aEntryStatus);
+ if ( (aEntryStatus.st_mode & S_IFDIR) == S_IFDIR
+ AND *pEntry->d_name != '.' )
+ {
+ String sNew(pEntry->d_name);
+ o_rResult.push_back(sNew);
+ } // endif (aEntry.attrib == _A_SUBDIR)
+ } // end while
+ closedir( pDir );
+}
+
+void
+Directory::GetContainedFiles( StringVector & o_rResult,
+ const char * i_sFilter,
+ E_Recursivity i_eRecursivity ) const
+{
+ StreamStr sNew(240);
+ sNew << aPath;
+ StreamStr::size_type
+ nStartFilename = sNew.tellp();
+
+ bool bUseFilter = strcmp( i_sFilter, "*.*" ) != 0
+ AND strncmp( i_sFilter, "*.", 2) == 0;
+
+ DIR * pDir = opendir( StrPath().c_str() );
+ dirent * pEntry = 0;
+ char * sEnding = "";
+ struct stat aEntryStatus;
+
+ while ( (pEntry = readdir(pDir)) != 0 )
+ {
+ stat(pEntry->d_name, &aEntryStatus);
+ if ( (aEntryStatus.st_mode & S_IFDIR) == S_IFDIR )
+ continue; // Don't gather directories.
+
+ if ( bUseFilter )
+ {
+ const char * pEnding = strrchr(pEntry->d_name,'.');
+ if (pEnding == 0)
+ continue;
+ if ( strcasecmp( pEnding + 1, i_sFilter + 2 ) != 0 )
+ continue;
+ }
+
+ sNew.seekp(nStartFilename);
+ sNew << pEntry->d_name;
+ String sNewAsString( sNew.c_str() );
+ o_rResult.push_back(sNewAsString);
+ } // end while
+
+ closedir( pDir );
+ if ( i_eRecursivity == flat )
+ return;
+
+ // gathering from subdirectories:
+ StringVector aSubDirectories;
+ GetContainedDirectories( aSubDirectories );
+
+ StringVector::const_iterator dEnd = aSubDirectories.end();
+ for ( StringVector::const_iterator d = aSubDirectories.begin();
+ d != dEnd;
+ ++d )
+ {
+ Directory aSub(*this);
+ aSub += *d;
+ aSub.GetContainedFiles( o_rResult,
+ i_sFilter,
+ i_eRecursivity );
+ }
+}
+
+#else
+#error For using csv::ploc there has to be defined: WNT or UNX.
+#endif
+
+
+const Path &
+Directory::inq_MyPath() const
+{
+ return aPath;
+}
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
diff --git a/cosv/source/storage/plocroot.cxx b/cosv/source/storage/plocroot.cxx
new file mode 100644
index 000000000000..b6f7f57d2f8c
--- /dev/null
+++ b/cosv/source/storage/plocroot.cxx
@@ -0,0 +1,558 @@
+/*************************************************************************
+ *
+ * $RCSfile: plocroot.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/ploc.hxx>
+
+// NOT FULLY DECLARED SERVICES
+// #include <cosv/bstream.hxx>
+// #include <ctype.h>
+
+
+namespace csv
+{
+namespace ploc
+{
+
+
+class UnixRootDir : public Root
+{
+ public:
+ UnixRootDir();
+
+ virtual void Get(
+ ostream & o_rPath ) const;
+ virtual void Get(
+ bostream & o_rPath ) const;
+ virtual DYN Root * CreateCopy() const;
+ virtual const char *
+ OwnDelimiter() const;
+};
+
+class WorkingDir : public Root
+{
+ public:
+ WorkingDir(
+ const char * i_sDelimiter = Delimiter() );
+
+ virtual void Get(
+ ostream & o_rPath ) const;
+ virtual void Get(
+ bostream & o_rPath ) const;
+ virtual DYN Root * CreateCopy() const;
+ virtual const char *
+ OwnDelimiter() const;
+ private:
+ String sOwnDelimiter;
+};
+
+class WinRootDir : public Root
+{
+ public:
+ WinRootDir();
+
+ virtual void Get(
+ ostream & o_rPath ) const;
+ virtual void Get(
+ bostream & o_rPath ) const;
+ virtual DYN Root * CreateCopy() const;
+ virtual const char *
+ OwnDelimiter() const;
+};
+
+class WinDrive : public Root
+{
+ public:
+ WinDrive(
+ char i_cDrive );
+ virtual void Get(
+ ostream & o_rPath ) const;
+ virtual void Get(
+ bostream & o_rPath ) const;
+ virtual DYN Root * CreateCopy() const;
+ virtual const char *
+ OwnDelimiter() const;
+ private:
+ char cDrive;
+};
+
+class WinDriveRootDir : public Root
+{
+ public:
+ WinDriveRootDir(
+ const char * i_sPath );
+ WinDriveRootDir(
+ char i_cDrive );
+
+ virtual void Get(
+ ostream & o_rPath ) const;
+ virtual void Get(
+ bostream & o_rPath ) const;
+ virtual DYN Root * CreateCopy() const;
+ virtual const char *
+ OwnDelimiter() const;
+ private:
+ char cDrive;
+};
+
+class UNCRoot : public Root
+{
+ public:
+ UNCRoot(
+ const char * i_sPath );
+ UNCRoot(
+ const String & i_sComputer,
+ const String & i_sEntryPt );
+
+ virtual void Get(
+ ostream & o_rPath ) const;
+ virtual void Get(
+ bostream & o_rPath ) const;
+ virtual DYN Root * CreateCopy() const;
+ virtual const char *
+ OwnDelimiter() const;
+ private:
+ String sComputer;
+ String sEntryPt;
+};
+
+class InvalidRoot : public Root
+{
+ public:
+ virtual void Get(
+ ostream & o_rPath ) const;
+ virtual void Get(
+ bostream & o_rPath ) const;
+ virtual DYN Root * CreateCopy() const;
+ virtual const char *
+ OwnDelimiter() const;
+};
+
+
+DYN Root *
+Create_WindowsRoot( const char * & o_sPathAfterRoot,
+ const char * i_sPath )
+{
+ if (i_sPath[0] == '\\')
+ {
+ if (i_sPath[1] == '\\')
+ { // UNC path name
+ o_sPathAfterRoot = strchr(i_sPath+2,'\\');
+ if (o_sPathAfterRoot != 0)
+ {
+ o_sPathAfterRoot = strchr(o_sPathAfterRoot+1,'\\');
+ if (o_sPathAfterRoot != 0)
+ ++o_sPathAfterRoot;
+ return new UNCRoot(i_sPath);
+ }
+ return new InvalidRoot; // Incomplete UNC root.
+ }
+ else
+ {
+ o_sPathAfterRoot = i_sPath+1;
+ return new WinRootDir;
+ }
+ }
+ else if (i_sPath[1] == ':')
+ {
+ if ( i_sPath[2] == '\\')
+ {
+ o_sPathAfterRoot = i_sPath + 3;
+ return new WinDriveRootDir(i_sPath);
+ }
+ else
+ {
+ o_sPathAfterRoot = i_sPath + 2;
+ return new WinDrive(*i_sPath);
+ }
+ }
+ else
+ {
+ o_sPathAfterRoot = i_sPath;
+ return new WorkingDir("\\");
+ }
+}
+
+DYN Root *
+Create_UnixRoot( const char * & o_sPathAfterRoot,
+ const char * i_sPath )
+{
+ if (*i_sPath == '/')
+ {
+ o_sPathAfterRoot = i_sPath + 1;
+ return new UnixRootDir;
+ }
+ else //
+ {
+ o_sPathAfterRoot = i_sPath;
+ return new WorkingDir("/");
+ } // endif
+}
+
+
+//********************** Root ****************************//
+
+Root::~Root()
+{
+
+}
+
+DYN Root *
+Root::Create_( const char * & o_sPathAfterRoot,
+ const char * i_sPath,
+ const char * i_sDelimiter )
+{
+ if (i_sPath[0] == '.')
+ {
+ switch ( i_sPath[1] )
+ {
+ case '\0': o_sPathAfterRoot = i_sPath + 1;
+ break;
+ case '\\': o_sPathAfterRoot = i_sPath + 2;
+ break;
+ case '/': o_sPathAfterRoot = i_sPath + 2;
+ break;
+ case '.': o_sPathAfterRoot = i_sPath;
+ break;
+ default:
+ o_sPathAfterRoot = 0;
+ return new InvalidRoot;
+ } // end switch (i_sPath[1])
+
+ return new WorkingDir;
+ } // end if (i_sPath[0] == '.')
+
+ switch (*i_sDelimiter)
+ {
+ case '\\': return Create_WindowsRoot(o_sPathAfterRoot, i_sPath);
+ case '/': return Create_UnixRoot(o_sPathAfterRoot, i_sPath);
+ }
+
+ o_sPathAfterRoot = 0;
+ return new InvalidRoot;
+}
+
+
+
+//********************** UnixRootDir ****************************//
+
+
+UnixRootDir::UnixRootDir()
+{
+}
+
+void
+UnixRootDir::Get( ostream & o_rPath ) const
+{
+ o_rPath << '/';
+}
+
+void
+UnixRootDir::Get( bostream & o_rPath ) const
+{
+ o_rPath.write( "/", 1 );
+}
+
+DYN Root *
+UnixRootDir::CreateCopy() const
+{
+ return new UnixRootDir;
+}
+
+const char *
+UnixRootDir::OwnDelimiter() const
+{
+ return "/";
+}
+
+
+//********************** WorkingDir ****************************//
+
+WorkingDir::WorkingDir( const char * i_sDelimiter )
+ : sOwnDelimiter(i_sDelimiter)
+{
+}
+
+void
+WorkingDir::Get( ostream & o_rPath ) const
+{
+ o_rPath << '.' << sOwnDelimiter;
+}
+
+void
+WorkingDir::Get( bostream & o_rPath ) const
+{
+ o_rPath.write( ".", 1 );
+ o_rPath.write( sOwnDelimiter );
+}
+
+DYN Root *
+WorkingDir::CreateCopy() const
+{
+ return new WorkingDir(sOwnDelimiter);
+}
+
+const char *
+WorkingDir::OwnDelimiter() const
+{
+ return sOwnDelimiter;
+}
+
+
+//********************** WinRootDir ****************************//
+
+WinRootDir::WinRootDir()
+{
+}
+
+void
+WinRootDir::Get( ostream & o_rPath ) const
+{
+ o_rPath << '\\';
+}
+
+void
+WinRootDir::Get( bostream & o_rPath ) const
+{
+ o_rPath.write( "\\", 1 );
+}
+
+DYN Root *
+WinRootDir::CreateCopy() const
+{
+ return new WinRootDir;
+}
+
+const char *
+WinRootDir::OwnDelimiter() const
+{
+ return "\\";
+}
+
+
+//********************** WinDrive ****************************//
+
+WinDrive::WinDrive( char i_cDrive )
+ : cDrive(toupper(i_cDrive))
+{
+}
+
+void
+WinDrive::Get( ostream & o_rPath ) const
+{
+ o_rPath << cDrive << ':';
+}
+
+void
+WinDrive::Get( bostream & o_rPath ) const
+{
+ static char buf_[3] = " :";
+ buf_[0] = cDrive;
+ o_rPath.write( &buf_[0], 2 );
+}
+
+DYN Root *
+WinDrive::CreateCopy() const
+{
+ return new WinDrive(cDrive);
+}
+
+const char *
+WinDrive::OwnDelimiter() const
+{
+ return "\\";
+}
+
+
+//********************** WinDriveRootDir ****************************//
+
+WinDriveRootDir::WinDriveRootDir( const char * i_sPath )
+ : cDrive(toupper(*i_sPath))
+{
+ if ( 'A' > cDrive OR 'Z' < cDrive )
+ cDrive = 0;
+}
+
+WinDriveRootDir::WinDriveRootDir( char i_cDrive )
+ : cDrive(i_cDrive)
+{
+}
+
+void
+WinDriveRootDir::Get( ostream & o_rPath ) const
+{
+ o_rPath << cDrive << ":\\";
+}
+
+void
+WinDriveRootDir::Get( bostream & o_rPath ) const
+{
+ static char buf_[4] = " :\\";
+ buf_[0] = cDrive;
+ o_rPath.write( &buf_[0], 3 );
+}
+
+DYN Root *
+WinDriveRootDir::CreateCopy() const
+{
+ return new WinDriveRootDir(cDrive);
+}
+
+const char *
+WinDriveRootDir::OwnDelimiter() const
+{
+ return "\\";
+}
+
+
+//********************** UNCRoot ****************************//
+
+UNCRoot::UNCRoot( const char * i_sPath )
+// : // sComputer,
+ // sEntryPt
+{
+ const char * pRestPath = i_sPath + 2;
+ const char * pDirEnd = strchr(pRestPath, '\\');
+ csv_assert(pDirEnd != 0);
+
+ sComputer = String(pRestPath, pDirEnd - pRestPath);
+ pRestPath = pDirEnd+1;
+ pDirEnd = strchr(pRestPath, '\\');
+
+ if ( pDirEnd != 0 )
+ {
+ sEntryPt = String(pRestPath, pDirEnd - pRestPath);
+ }
+ else
+ {
+ sEntryPt = pRestPath;
+ }
+}
+
+UNCRoot::UNCRoot( const String & i_sComputer,
+ const String & i_sEntryPt )
+ : sComputer(i_sComputer),
+ sEntryPt(i_sEntryPt)
+{
+}
+
+void
+UNCRoot::Get( ostream & o_rPath ) const
+{
+ o_rPath << "\\\\" << sComputer << '\\' << sEntryPt << "\\";
+}
+
+void
+UNCRoot::Get( bostream & o_rPath ) const
+{
+ o_rPath.write( "\\\\", 2 );
+ o_rPath.write( sComputer );
+ o_rPath.write( "\\", 1 );
+ o_rPath.write( sEntryPt );
+ o_rPath.write( "\\", 1 );
+}
+
+DYN Root *
+UNCRoot::CreateCopy() const
+{
+ return new UNCRoot(sComputer,sEntryPt);
+}
+
+const char *
+UNCRoot::OwnDelimiter() const
+{
+ return "\\";
+}
+
+
+
+//********************** InvalidRoot ****************************//
+
+void
+InvalidRoot::Get( ostream & o_rPath ) const
+{
+}
+
+void
+InvalidRoot::Get( bostream & o_rPath ) const
+{
+}
+
+DYN Root *
+InvalidRoot::CreateCopy() const
+{
+ return new InvalidRoot;
+}
+
+const char *
+InvalidRoot::OwnDelimiter() const
+{
+ return 0;
+}
+
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
diff --git a/cosv/source/strings/makefile.mk b/cosv/source/strings/makefile.mk
new file mode 100644
index 000000000000..e7eee899f0a4
--- /dev/null
+++ b/cosv/source/strings/makefile.mk
@@ -0,0 +1,93 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+#
+# 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_strings
+
+ENABLE_EXCEPTIONS=true
+
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.INCLUDE : $(PRJ)$/source$/fullcpp.mk
+
+
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= \
+ $(OBJ)$/str_types.obj \
+ $(OBJ)$/streamstr.obj \
+ $(OBJ)$/string.obj
+
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+
diff --git a/cosv/source/strings/str_types.cxx b/cosv/source/strings/str_types.cxx
new file mode 100644
index 000000000000..60000b70568a
--- /dev/null
+++ b/cosv/source/strings/str_types.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * $RCSfile: str_types.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/str_types.hxx>
+
+
+
+namespace csv
+{
+
+CharOrder_Table::CharOrder_Table( const int * i_pCharWeightsArray )
+{
+ memcpy( cWeights, i_pCharWeightsArray, 256 );
+}
+
+
+} // namespace csv
+
+
diff --git a/cosv/source/strings/streamstr.cxx b/cosv/source/strings/streamstr.cxx
new file mode 100644
index 000000000000..a4153d81e86e
--- /dev/null
+++ b/cosv/source/strings/streamstr.cxx
@@ -0,0 +1,774 @@
+/*************************************************************************
+ *
+ * $RCSfile: streamstr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/streamstr.hxx>
+
+// NOT FULLY DECLARED SERVICES
+#include <string.h>
+#include <stdio.h>
+#if defined(WNT) || defined(LINUX)
+#include <stdarg.h>
+#else
+#include <sys/varargs.h>
+#endif
+#include <cosv/comfunc.hxx>
+#include <cosv/template/swelist.hxx>
+
+
+
+namespace csv
+{
+
+const uintt C_short_max_size = sizeof(short) / 2 + 1;
+const uintt C_int_max_size = sizeof(int) / 2 + 1;
+const uintt C_long_max_size = sizeof(long) / 2 + 1;
+
+
+inline void
+StreamStr::Advance(size_type i_nAddedSize)
+{ pCur += i_nAddedSize; }
+
+
+
+StreamStr::StreamStr( size_type i_nCapacity )
+ : nCapacity1( i_nCapacity + 1 ),
+ dpData( new char [i_nCapacity + 1] ),
+ pEnd(dpData),
+ pCur(dpData),
+ eMode(str::overwrite)
+{
+ *pEnd = '\0';
+}
+
+StreamStr::StreamStr( const char * i_sInitStr,
+ size_type i_nCapacity )
+ : nCapacity1(0),
+ dpData(0),
+ pEnd(0),
+ pCur(0),
+ eMode(str::overwrite)
+{
+ size_type nLength = strlen(i_sInitStr);
+ nCapacity1 = csv::max(nLength, i_nCapacity) + 1;
+ dpData = new char [nCapacity1];
+ strcpy(dpData, i_sInitStr);
+ pCur = dpData + nLength;
+ pEnd = pCur;
+}
+
+StreamStr::StreamStr( size_type i_nGuessedCapacity,
+ const char * str1,
+ const char * str2,
+ ... )
+ : nCapacity1( i_nGuessedCapacity + 1 ),
+ dpData( new char [i_nGuessedCapacity + 1] ),
+ pEnd(dpData),
+ pCur(dpData),
+ eMode(str::overwrite)
+{
+ *pEnd = '\0';
+
+ operator<<(str1);
+ operator<<(str2);
+
+ ::va_list ap;
+
+ va_start(ap, str2);
+ for ( const char * strAdd = va_arg(ap,const char*);
+ strAdd != 0;
+ strAdd = va_arg(ap,const char*) )
+ {
+ size_type nLen = strlen(strAdd);
+ ProvideAddingSize( nLen );
+ memcpy(pCur, strAdd, nLen);
+ Advance(nLen);
+ } // end for
+ va_end(ap);
+}
+
+StreamStr::StreamStr( const self & i_rOther )
+ : nCapacity1( i_rOther.nCapacity1 ),
+ dpData( new char [i_rOther.nCapacity1] ),
+ pEnd( dpData + strlen(i_rOther.dpData) ),
+ pCur( dpData + i_rOther.tellp() ),
+ eMode(i_rOther.eMode)
+{
+ strcpy( dpData, i_rOther.dpData );
+}
+
+StreamStr::~StreamStr()
+{
+ delete [] dpData;
+}
+
+
+StreamStr &
+StreamStr::operator=( const self & i_rOther )
+{
+ delete [] dpData;
+
+ nCapacity1 = i_rOther.nCapacity1;
+ dpData = new char [i_rOther.nCapacity1];
+ pEnd = dpData + strlen(i_rOther.dpData);
+ strcpy( dpData, i_rOther.dpData );
+ pCur = dpData + i_rOther.tellp();
+ eMode = i_rOther.eMode;
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( const char * i_s )
+{
+ size_type nLength = strlen(i_s);
+
+ ProvideAddingSize( nLength );
+ memcpy( pCur, i_s, nLength );
+ Advance(nLength);
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( const String & i_s )
+{
+ size_type nLength = i_s.length();
+
+ ProvideAddingSize( nLength );
+ memcpy( pCur, i_s.c_str(), nLength );
+ Advance(nLength);
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( char i_c )
+{
+ ProvideAddingSize( 1 );
+ *pCur = i_c;
+ Advance(1);
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( unsigned char i_c )
+{
+ return operator<<( char(i_c) );
+}
+
+StreamStr &
+StreamStr::operator<<( signed char i_c )
+{
+ return operator<<( char(i_c) );
+}
+
+StreamStr &
+StreamStr::operator<<( short i_n )
+{
+ char buf[C_short_max_size] = "";
+ sprintf( buf, "%hi", i_n );
+
+ size_type nLength = strlen(buf);
+ ProvideAddingSize( nLength );
+ memcpy( pCur, buf, nLength );
+ Advance( nLength );
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( unsigned short i_n )
+{
+ char buf[C_short_max_size] = "";
+ sprintf( buf, "%hu", i_n );
+
+ size_type nLength = strlen(buf);
+ ProvideAddingSize( nLength );
+ memcpy( pCur, buf, nLength );
+ Advance( nLength );
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( int i_n )
+{
+ char buf[C_int_max_size] = "";
+ sprintf( buf, "%i", i_n );
+
+ size_type nLength = strlen(buf);
+ ProvideAddingSize( nLength );
+ memcpy( pCur, buf, nLength );
+ Advance( nLength );
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( unsigned int i_n )
+{
+ char buf[C_int_max_size] = "";
+ sprintf( buf, "%u", i_n );
+
+ size_type nLength = strlen(buf);
+ ProvideAddingSize( nLength );
+ memcpy( pCur, buf, nLength );
+ Advance( nLength );
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( long i_n )
+{
+ char buf[C_long_max_size] = "";
+ sprintf( buf, "%li", i_n );
+
+ size_type nLength = strlen(buf);
+ ProvideAddingSize( nLength );
+ memcpy( pCur, buf, nLength );
+ Advance( nLength );
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( unsigned long i_n )
+{
+ char buf[C_long_max_size] = "";
+ sprintf( buf, "%lu", i_n );
+
+ size_type nLength = strlen(buf);
+ ProvideAddingSize( nLength );
+ memcpy( pCur, buf, nLength );
+ Advance( nLength );
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( float i_n )
+{
+ const int C_float_max_size = 20;
+ char buf[C_float_max_size] = "";
+ sprintf( buf, "%.*g", C_float_max_size-8, i_n );
+
+ size_type nLength = strlen(buf);
+ ProvideAddingSize( nLength );
+ memcpy( pCur, buf, nLength );
+ Advance( nLength );
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::operator<<( double i_n )
+{
+ const int C_double_max_size = 30;
+ char buf[C_double_max_size] = "";
+ sprintf( buf, "%.*lg", C_double_max_size-8, i_n );
+
+ size_type nLength = strlen(buf);
+ ProvideAddingSize( nLength );
+ memcpy( pCur, buf, nLength );
+ Advance( nLength );
+
+ return *this;
+}
+
+const char &
+StreamStr::operator[]( position_type i_nPosition ) const
+{
+ static const char aNull_ = '\0';
+
+ if ( position_type(pEnd - dpData) > i_nPosition )
+ return dpData[i_nPosition];
+ return aNull_;
+}
+
+char &
+StreamStr::operator[]( position_type i_nPosition )
+{
+ static char aDummy_ = '\0';
+
+ if ( position_type(pEnd - dpData) > i_nPosition )
+ return dpData[i_nPosition];
+ return aDummy_;
+}
+
+void
+StreamStr::resize( size_type i_nMinimumCapacity )
+{
+ if ( i_nMinimumCapacity <= capacity() )
+ return;
+
+ Resize(i_nMinimumCapacity);
+}
+
+StreamStr &
+StreamStr::seekp( seek_type i_nCount,
+ seek_dir i_eDirection )
+{
+ seek_type nLength = seek_type( length() );
+ seek_type nNewPos = tellp();
+
+ switch ( i_eDirection )
+ {
+ case ::csv::beg: nNewPos = i_nCount;
+ break;
+ case ::csv::cur: nNewPos += i_nCount;
+ break;
+ case ::csv::end: nNewPos = nLength + i_nCount;
+ break;
+ }
+
+ if ( in_range<seek_type>(0, nNewPos, nLength + 1) )
+ {
+ pCur = dpData + nNewPos;
+ if (eMode == str::overwrite)
+ {
+ pEnd = pCur;
+ *pEnd = '\0';
+ }
+ }
+
+ return *this;
+}
+
+StreamStr &
+StreamStr::set_insert_mode( insert_mode i_eMode )
+{
+ eMode = i_eMode;
+ return *this;
+}
+
+void
+StreamStr::push_front( const char * i_str )
+{
+ insert_mode eOriginalMode = eMode;
+ char * pOriginalCur = pCur;
+ eMode = str::insert;
+ pCur = dpData;
+
+ operator<<(i_str);
+
+ eMode = eOriginalMode;
+ pCur = pOriginalCur + strlen(i_str);
+}
+
+void
+StreamStr::push_front( char i_c )
+{
+ insert_mode eOriginalMode = eMode;
+ char * pOriginalCur = pCur;
+ eMode = str::insert;
+ pCur = dpData;
+
+ operator<<(i_c);
+
+ eMode = eOriginalMode;
+ pCur = pOriginalCur + 1;
+}
+
+void
+StreamStr::push_back( const char * i_str )
+{
+ insert_mode eOriginalMode = eMode;
+ eMode = str::overwrite;
+
+ operator<<(i_str);
+
+ eMode = eOriginalMode;
+}
+
+void
+StreamStr::push_back( char i_c )
+{
+ insert_mode eOriginalMode = eMode;
+ eMode = str::overwrite;
+
+ operator<<(i_c);
+
+ eMode = eOriginalMode;
+}
+
+void
+StreamStr::pop_front( size_type i_nCount )
+{
+ size_type nCount = min(i_nCount, length());
+
+ MoveData( dpData + nCount, pEnd, -(seek_type(nCount)) );
+
+ pCur -= nCount;
+ pEnd -= nCount;
+ *pEnd = '\0';
+}
+
+void
+StreamStr::pop_back( size_type i_nCount )
+{
+ size_type nCount = min(i_nCount, length());
+ pEnd -= nCount;
+ if (pCur > pEnd)
+ pCur = pEnd;
+ *pEnd = '\0';
+}
+
+void
+StreamStr::replace( position_type i_nStart,
+ size_type i_nSize,
+ Area i_aReplacement )
+{
+ if (i_nStart >= length() OR i_nSize < 1)
+ return;
+
+ insert_mode eOldMode = eMode;
+ eMode = str::insert;
+ pCur = dpData + i_nStart;
+
+ size_type anz = min( length() - i_nStart, i_nSize );
+
+ if ( i_nSize < i_aReplacement.nLength )
+ {
+ ProvideAddingSize( i_aReplacement.nLength - i_nSize );
+ }
+ else if ( i_nSize > i_aReplacement.nLength )
+ {
+ MoveData( dpData + i_nStart,
+ pEnd,
+ - seek_type(i_nSize - i_aReplacement.nLength) );
+ }
+
+ memcpy( dpData + i_nStart, i_aReplacement.sStr, i_aReplacement.nLength );
+ Advance(i_aReplacement.nLength);
+
+ eMode = eOldMode;
+}
+
+void
+StreamStr::replace_all( char i_cCarToSearch,
+ char i_cReplacement )
+{
+ for ( char * p = dpData; p != pEnd; ++p )
+ {
+ if (*p == i_cCarToSearch)
+ *p = i_cReplacement;
+ }
+}
+
+void
+StreamStr::replace_all( Area i_aStrToSearch,
+ Area i_aReplacement )
+{
+ position_type p =0;
+ const char * pSearch = i_aStrToSearch.sStr;
+ size_type nSearch = i_aStrToSearch.nLength;
+ size_type nStop = length();
+ if (nStop > nSearch)
+ nStop -= nSearch;
+
+ while ( p <= nStop )
+ {
+ if ( strncmp(dpData+p, pSearch, nSearch) == 0 )
+ {
+ replace( p, nSearch, i_aReplacement );
+ p += i_aReplacement.nLength;
+ }
+ else
+ {
+ ++p;
+ }
+ } // end while
+}
+
+StreamStr &
+StreamStr::to_lower( position_type i_nStart,
+ size_type i_nLength )
+{
+ static char cLower[128] =
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
+ 112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
+ 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127 };
+
+ if ( i_nStart < length() )
+ {
+ for ( char * pChange = dpData + i_nStart;
+ pChange != pEnd;
+ ++pChange )
+ {
+ *pChange = (*pChange & char(0x80)) == '\0'
+ ? cLower[*pChange]
+ : *pChange;
+ }
+ }
+ return *this;
+}
+
+StreamStr &
+StreamStr::to_upper( position_type i_nStart,
+ size_type i_nLength )
+{
+ static char cUpper[128] =
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123,124,125,126,127 };
+
+ if ( i_nStart < length() )
+ {
+ for ( char * pChange = dpData + i_nStart;
+ pChange != pEnd;
+ ++pChange )
+ {
+ *pChange = (*pChange & char(0x80)) == '\0'
+ ? cUpper[*pChange]
+ : *pChange;
+ }
+ }
+ return *this;
+}
+
+
+StreamStr::size_type
+StreamStr::token_count( char i_cSplit ) const
+{
+ return count_chars(dpData, i_cSplit) + 1;
+}
+
+String
+StreamStr::token( position_type i_nNr,
+ char i_cSplit ) const
+{
+ // Find begin:
+ const char * pTokenBegin = dpData;
+ for ( position_type nNr = i_nNr;
+ nNr > 0;
+ --nNr )
+ {
+ pTokenBegin = strchr(pTokenBegin,i_cSplit);
+ if (pTokenBegin == 0)
+ return String("");
+ ++pTokenBegin;
+ }
+
+ // Find end:
+ const char * pTokenEnd = strchr(pTokenBegin, i_cSplit);
+ if (pTokenEnd == 0)
+ pTokenEnd = pEnd;
+
+ return String(pTokenBegin, size_type(pTokenEnd-pTokenBegin) );
+}
+
+class StreamStrPool
+{
+ public:
+ StreamStrPool();
+ ~StreamStrPool();
+ private:
+ // Interface to:
+ friend class StreamStrLock;
+ static StreamStr & AcquireFromPool_(
+ uintt i_nMinimalSize );
+ static void ReleaseToPool_(
+ DYN StreamStr * let_dpUsedStr );
+
+ // DATA
+ SweList< DYN StreamStr* >
+ aPool;
+};
+
+StreamStrPool::StreamStrPool()
+{
+}
+
+StreamStrPool::~StreamStrPool()
+{
+ for ( SweList< DYN StreamStr* >::iterator it = aPool.begin();
+ it != aPool.end();
+ ++it )
+ {
+ delete (*it);
+ }
+}
+
+namespace
+{
+ static StreamStrPool aPool_;
+}
+
+
+StreamStr &
+StreamStrPool::AcquireFromPool_( uintt i_nMinimalSize )
+{
+ if ( aPool_.aPool.empty() )
+ {
+ return *new StreamStr(i_nMinimalSize);
+ }
+
+ StreamStr & ret = *aPool_.aPool.front();
+ aPool_.aPool.pop_front();
+ ret.resize(i_nMinimalSize);
+ ret.seekp(0);
+ ret.set_insert_mode(str::overwrite);
+ return ret;
+}
+
+void
+StreamStrPool::ReleaseToPool_( DYN StreamStr * let_dpUsedStr )
+{
+ aPool_.aPool.push_back( let_dpUsedStr );
+}
+
+StreamStrLock::StreamStrLock( uintt i_nMinimalSize )
+ : pStr( &StreamStrPool::AcquireFromPool_(i_nMinimalSize) )
+{
+}
+
+StreamStrLock::~StreamStrLock()
+{
+ StreamStrPool::ReleaseToPool_(pStr);
+}
+
+
+UINT32
+StreamStr::do_write( const void * i_pSrc,
+ UINT32 i_nNrofBytes )
+{
+ ProvideAddingSize( i_nNrofBytes );
+ memcpy( pCur, i_pSrc, i_nNrofBytes );
+ Advance(i_nNrofBytes);
+
+ return i_nNrofBytes;
+}
+
+void
+StreamStr::ProvideAddingSize( size_type i_nSize2Add )
+{
+ size_type nLength = length();
+ if ( capacity() - nLength < i_nSize2Add )
+ Resize( nLength + i_nSize2Add );
+
+ pEnd += i_nSize2Add;
+ *pEnd = '\0';
+
+ if (eMode == str::insert AND pCur != pEnd)
+ {
+ MoveData( pCur, pCur + i_nSize2Add, seek_type(i_nSize2Add) );
+ }
+}
+
+void
+StreamStr::Resize( size_type i_nMinimumCapacity )
+{
+ size_type nNewSize = nCapacity1 < 128
+ ? nCapacity1 << 1
+ : (nCapacity1 << 1) - (nCapacity1 >> 1);
+ nCapacity1 = csv::max( nNewSize, i_nMinimumCapacity + 1 );
+
+ char * pNew = new char[nCapacity1];
+ strcpy ( pNew, dpData );
+ pEnd = pNew + (pEnd - dpData);
+ pCur = pNew + (pCur - dpData);
+
+ delete [] dpData;
+ dpData = pNew;
+}
+
+void
+StreamStr::MoveData( char * i_pStart,
+ char * i_pEnd,
+ seek_type i_nDiff )
+{
+ if (i_nDiff > 0)
+ {
+ register const char * pSrc = i_pEnd;
+ register char * pDest = i_pEnd + i_nDiff;
+ for ( ; pSrc != i_pStart; --pSrc, --pDest )
+ {
+ *pDest = *pSrc;
+ }
+ *pDest = *pSrc;
+ }
+ else if (i_nDiff < 0)
+ {
+ register const char * pSrc = i_pStart;
+ register char * pDest = i_pStart + i_nDiff;
+ for ( ; pSrc != i_pEnd; ++pSrc, ++pDest )
+ {
+ *pDest = *pSrc;
+ }
+ }
+}
+
+
+} // namespace csv
+
diff --git a/cosv/source/strings/string.cxx b/cosv/source/strings/string.cxx
new file mode 100644
index 000000000000..f18d47004341
--- /dev/null
+++ b/cosv/source/strings/string.cxx
@@ -0,0 +1,430 @@
+/*************************************************************************
+ *
+ * $RCSfile: string.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/string.hxx>
+
+
+// NOT FULLY DECLARED SERVICES
+#include <string.h>
+#include <cosv/comfunc.hxx>
+
+
+namespace csv
+{
+
+inline const char *
+str_from_StringOffset( const String & i_rStr,
+ str::size i_nOffset )
+{
+ return i_nOffset < i_rStr.size()
+ ? i_rStr.c_str() + i_nOffset
+ : "";
+}
+
+inline const char *
+str_from_ptr( const char * i_str )
+{
+
+ return valid_str(i_str);
+}
+
+
+//********************* String::S_Data **********************//
+
+inline String::
+S_Data::S_Data()
+ : nCount(1)
+{
+}
+
+String::
+S_Data::S_Data( const char * i_sData,
+ size_type i_nValidLength )
+ : aStr( str_from_ptr(i_sData),
+ (i_nValidLength != str::maxsize
+ ? i_nValidLength
+ : strlen(i_sData)) ),
+ nCount(1)
+{
+}
+
+String::
+S_Data::~S_Data()
+{
+ csv_assert( nCount == 0 );
+}
+
+const String::S_Data *
+String::
+S_Data::Acquire() const
+{
+#ifdef CSV_NO_MUTABLE
+ ++ (const_cast< uintt& >(nCount));
+#else
+ ++nCount;
+#endif
+ return this;
+}
+
+void
+String::
+S_Data::Release() const
+{
+#ifdef CSV_NO_MUTABLE
+ -- (const_cast< uintt& >(nCount));
+#else
+ --nCount;
+#endif
+ if (nCount == 0)
+ delete (const_cast< S_Data* >(this));
+}
+
+
+//************************** String **************************//
+
+
+String::String()
+ : pd( String::Null_().pd->Acquire() )
+{
+}
+
+String::String( const char * i_str )
+ : pd( new S_Data(i_str) )
+{
+}
+
+String::String( const char * i_str,
+ size_type i_nLength )
+ : pd( new S_Data(i_str, i_nLength) )
+{
+}
+
+/* The case i_nStartPosition == 0 is not handled specially,
+ because time efficiency seems to be more important than
+ space efficiency in such base functionality classes. If
+ used with care, the case i_nStartPosition==0 will be rare.
+*/
+String::String( const self & i_rStr,
+ position_type i_nStartPosition )
+ : pd( new S_Data(str_from_StringOffset(i_rStr, i_nStartPosition)) )
+{
+}
+
+/* For efficiency see the previous c'tor.
+*/
+String::String( const self & i_rStr,
+ position_type i_nStartPosition,
+ size_type i_nLength )
+ : pd( new S_Data(str_from_StringOffset(i_rStr, i_nStartPosition), i_nLength) )
+{
+}
+
+String::String( const_iterator i_itBegin,
+ const_iterator i_itEnd )
+ : pd( new S_Data(i_itBegin, size_type(i_itEnd - i_itBegin)) )
+{
+}
+
+String::String( const self & i_rStr )
+ : pd( i_rStr.pd->Acquire() )
+{
+}
+
+String::~String()
+{
+ pd->Release();
+}
+
+
+String &
+String::operator=( const self & i_rStr )
+{
+ i_rStr.pd->Acquire();
+ pd->Release();
+ pd = i_rStr.pd;
+
+ return *this;
+}
+
+String &
+String::operator=( const char * i_str )
+{
+ pd->Release();
+ pd = new S_Data(i_str, strlen(i_str));
+
+ return *this;
+}
+
+void
+String::swap( self & i_rStr )
+{
+ const S_Data * pTemp = pd;
+ pd = i_rStr.pd;
+ i_rStr.pd = pTemp;
+}
+
+void
+String::assign( const self & i_rStr,
+ position_type i_nStartPosition )
+{
+ pd->Release();
+ pd = new S_Data( str_from_StringOffset(i_rStr, i_nStartPosition) );
+}
+
+void
+String::assign( const self & i_rStr,
+ position_type i_nStartPosition,
+ size_type i_nLength )
+{
+ pd->Release();
+ pd = new S_Data( str_from_StringOffset(i_rStr, i_nStartPosition), i_nLength );
+}
+
+void
+String::assign( const char * i_str )
+{
+ pd->Release();
+ pd = new S_Data( i_str );
+}
+
+void
+String::assign( const char * i_str,
+ size_type i_nLength )
+{
+ pd->Release();
+ pd = new S_Data( i_str, i_nLength );
+}
+
+void
+String::assign( const_iterator i_itBegin,
+ const_iterator i_itEnd )
+{
+ pd->Release();
+ pd = new S_Data( i_itBegin, size_type(i_itEnd - i_itBegin) );
+}
+
+
+int
+String::compare( const self & i_rStr ) const
+{
+ return strcmp( c_str(), i_rStr.c_str() );
+}
+
+int
+String::compare( const CharOrder_Table & i_rOrder,
+ const self & i_rStr ) const
+{
+ return csv::compare( i_rOrder, c_str(), i_rStr.c_str() );
+}
+
+String
+String::substr( position_type i_nStartPosition,
+ size_type i_nLength ) const
+{
+ size_type nSize = size();
+
+ if ( i_nStartPosition < nSize )
+ {
+ if ( i_nLength == str::maxsize
+ OR i_nLength >= nSize - i_nStartPosition )
+ return String( c_str() + i_nStartPosition );
+ else
+ return String( c_str() + i_nStartPosition,
+ i_nLength );
+ }
+
+ return Null_();
+}
+
+
+const String &
+String::Null_()
+{
+ // Must not use the default constructor! Because that one calls
+ // this function, which would create a circular dependency.
+ static const String aNull_("");
+ return aNull_;
+}
+
+const char &
+String::Nulch_()
+{
+ static const char cNull_ = '\0';
+ return cNull_;
+}
+
+
+int
+compare( const String & i_s1,
+ csv::str::position i_nStartPosition1,
+ const char * i_s2,
+ csv::str::size i_nLength )
+{
+ const char * pS1 = str_from_StringOffset( i_s1, i_nStartPosition1 );
+
+ if ( i_nLength != csv::str::maxsize )
+ return strncmp( pS1,
+ i_s2,
+ i_nLength );
+ else
+ return strcmp( pS1,
+ i_s2 );
+}
+
+int
+compare( const char * i_s1,
+ const String & i_s2,
+ csv::str::position i_nStartPosition2,
+ csv::str::size i_nLength )
+{
+ const char * pS2 = str_from_StringOffset( i_s2, i_nStartPosition2 );
+
+ if ( i_nLength != csv::str::maxsize )
+ return strncmp( i_s1,
+ pS2,
+ i_nLength );
+ else
+ return strcmp( i_s1,
+ pS2 );
+}
+
+int
+compare( const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const char * i_s2 )
+{
+ const char * it1 = i_s1;
+ const char * it2 = i_s2;
+ for ( ; *it1 == *it2 AND *it1 != '\0'; ++it1, ++it2 )
+ {}
+
+ return int( i_rOrder(*it1) - i_rOrder(*it2) );
+}
+
+int
+compare( const CharOrder_Table & i_rOrder,
+ const String & i_s1,
+ csv::str::position i_nStartPosition1,
+ const char * i_s2,
+ csv::str::size i_nLength )
+{
+ const char * pS1 = str_from_StringOffset( i_s1, i_nStartPosition1 );
+
+ if ( i_nLength != csv::str::maxsize )
+ return compare( i_rOrder,
+ pS1,
+ i_s2,
+ i_nLength );
+ else
+ return compare( i_rOrder,
+ pS1,
+ i_s2 );
+}
+
+int
+compare( const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const String & i_s2,
+ csv::str::position i_nStartPosition2,
+ csv::str::size i_nLength )
+{
+ const char * pS2 = str_from_StringOffset( i_s2, i_nStartPosition2 );
+
+ if ( i_nLength != csv::str::maxsize )
+ return compare( i_rOrder,
+ i_s1,
+ pS2,
+ i_nLength );
+ else
+ return compare( i_rOrder,
+ i_s1,
+ pS2 );
+}
+
+int
+compare( const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const char * i_s2,
+ csv::str::size i_nLength )
+{
+ const char * sEnd = i_s1 + i_nLength;
+
+ const char * it1 = i_s1;
+ const char * it2 = i_s2;
+ for ( ; *it1 == *it2 AND *it1 != '\0' AND it1 != sEnd; ++it1, ++it2 )
+ {}
+
+ if ( it1 != sEnd )
+ return int( i_rOrder(*it1) - i_rOrder(*it2) );
+ else
+ return 0;
+}
+
+
+} // namespace csv
+
+
+
+
+
+
+
diff --git a/cosv/source/unittest/file_ut.cxx b/cosv/source/unittest/file_ut.cxx
new file mode 100644
index 000000000000..9e14af854419
--- /dev/null
+++ b/cosv/source/unittest/file_ut.cxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * $RCSfile: file_ut.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/file.hxx>
+
+// NOT FULLY DECLARED SERVICES
+#include <ut.hxx>
+
+using csv::File;
+
+
+/** @file
+ UnitTests for class File.
+*/
+
+FUT_DECL( File, Read );
+FUT_DECL( File, Write );
+FUT_DECL( File, Seek );
+FUT_DECL( File, SeekBack );
+FUT_DECL( File, SeekRelative );
+
+
+bool
+classtest_File()
+{
+ csv::File aFile( "bigfile.txt", csv::CFM_RW, 0 );
+ csv::File & rFile = aFile;
+
+ rFile.Open();
+
+ bool ret = ftest_Read( rFile );
+ ret = ftest_Write( rFile ) AND ret;
+ ret = ftest_SeekBack( rFile ) AND ret;
+ ret = ftest_SeekRelative( rFile ) AND ret;
+
+ rFile.Close();
+
+ return ret;
+}
+
+
+
+FUT_DECL( File, Read )
+{
+ bool ret = true;
+
+ rFile.SeekBack(0);
+ uintt nSourceSize = rFile.Position();
+ rFile.Seek(0);
+
+ char * pBuf = new char[nSourceSize+1];
+ uintt nCount = rFile.Read(pBuf,nSourceSize);
+
+ UT_CHECK( Read, nCount == nSourceSize );
+
+ return ret;
+}
+
+FUT_DECL( File, Write )
+{
+ bool ret = true;
+
+
+
+ return ret;
+}
+
+FUT_DECL( File, Seek )
+{
+ bool ret = true;
+
+
+
+ return ret;
+}
+
+FUT_DECL( File, SeekBack )
+{
+ bool ret = true;
+
+
+
+ return ret;
+}
+
+FUT_DECL( File, SeekRelative )
+{
+ bool ret = true;
+
+
+
+ return ret;
+}
+
+
+
diff --git a/cosv/source/unittest/makefile.mk b/cosv/source/unittest/makefile.mk
new file mode 100644
index 000000000000..8fc5ef4905b6
--- /dev/null
+++ b/cosv/source/unittest/makefile.mk
@@ -0,0 +1,109 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+#
+# 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_unittest
+TARGETTYPE=CUI
+
+# --- Settings -----------------------------------------------------
+
+ENABLE_EXCEPTIONS=true
+PRJINC=$(PRJ)$/source
+
+.INCLUDE : settings.mk
+.INCLUDE : static.mk
+
+.INCLUDE : $(PRJ)$/source$/fullcpp.mk
+
+
+
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= \
+ $(OBJ)$/file_ut.obj \
+ $(OBJ)$/simplestring_ut.obj
+
+
+
+
+APP1TARGET= $(TARGET)
+APP1STACK= 1000000
+APP1OBJS= $(OBJ)$/ut_main.obj
+
+APP1STDLIBS= $(STATIC_LIBS) msvcirt.lib
+
+
+APP1LIBS= $(LB)$/$(TARGET).lib $(LB)$/cosv.lib
+
+
+APP1DEPN= $(LB)$/$(TARGET).lib $(LB)$/cosv.lib
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+
diff --git a/cosv/source/unittest/string_ut.cxx b/cosv/source/unittest/string_ut.cxx
new file mode 100644
index 000000000000..c660d1739096
--- /dev/null
+++ b/cosv/source/unittest/string_ut.cxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * $RCSfile: string_ut.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+#include <cosv/string.hxx>
+
+// NOT FULLY DECLARED SERVICES
+#include <ut.hxx>
+
+using csv::SimpleString;
+
+
+/** @file
+ UnitTests for class String.
+*/
+
+inline bool
+check_value( const String & a, const char * b )
+{
+ return strcmp( a.c_str(), b ) == 0;
+}
+
+
+bool
+classtest_String( csv::SimpleString & rSimpleString )
+{
+ bool ret = true;
+
+ String x1;
+ UT_CHECK( String(), check_value(x1,"") )
+
+ const char * s2a = "";
+ String x2a(s2a);
+ UT_CHECK( String(const char*), check_value(x2a,s2a) )
+
+ const char * s2b = "_zluoadninger prrg chii(/%$##@\\\"'''fh kl";
+ String x2b(s2b);
+ UT_CHECK( String(const char*), check_value(x2b,s2b) )
+
+
+ bool ret = ftest_Read( rSimpleString );
+ ret = ftest_Write( rSimpleString ) AND ret;
+ ret = ftest_SeekBack( rSimpleString ) AND ret;
+ ret = ftest_SeekRelative( rSimpleString ) AND ret;
+
+ rSimpleString.Close();
+
+ return ret;
+}
+
+
+
+
+#if 0
+FUT_DECL( SimpleString, Ctor_Def );
+FUT_DECL( SimpleString, Seek );
+FUT_DECL( SimpleString, SeekBack );
+FUT_DECL( SimpleString, SeekRelative );
+
+
+
+FUT_DECL( SimpleString, Read )
+{
+ bool ret = true;
+
+ rSimpleString.SeekBack(0);
+ uintt nSourceSize = rSimpleString.Position();
+ rSimpleString.Seek(0);
+
+ char * pBuf = new char[nSourceSize+1];
+ uintt nCount = rSimpleString.Read(pBuf,nSourceSize);
+
+ UT_CHECK( Read, nCount == nSourceSize );
+
+ return ret;
+}
+
+FUT_DECL( SimpleString, Write )
+{
+ bool ret = true;
+
+
+
+ return ret;
+}
+
+FUT_DECL( SimpleString, Seek )
+{
+ bool ret = true;
+
+
+
+ return ret;
+}
+
+FUT_DECL( SimpleString, SeekBack )
+{
+ bool ret = true;
+
+
+
+ return ret;
+}
+
+FUT_DECL( SimpleString, SeekRelative )
+{
+ bool ret = true;
+
+
+
+ return ret;
+}
+
+#endif
+
+
diff --git a/cosv/source/unittest/ut.hxx b/cosv/source/unittest/ut.hxx
new file mode 100644
index 000000000000..7695ea73b10c
--- /dev/null
+++ b/cosv/source/unittest/ut.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * $RCSfile: ut.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef COSV_UNITTEST_UT_HXX
+#define COSV_UNITTEST_UT_HXX
+
+
+#define UT_CHECK( fname, cond ) \
+ if ( NOT (cond) ) { std::cerr << "ftest_" << #fname << " " << #cond << endl; \
+ ret = false; }
+
+#define CUT_DECL( nsp, cname ) \
+ bool classtest_##cname()
+#define FUT_DECL( cname, fname ) \
+ bool ftest_##fname( cname & r##cname )
+
+#define UT_RESULT( result ) \
+ if (result ) std::cout << "All unit tests passed successfully." << std::endl; \
+ else std::cout << "Errors in unit tests.\n" << std::endl
+
+
+
+CUT_DECL( csv, File );
+CUT_DECL( csv, String );
+
+#endif
+
+
+
diff --git a/cosv/source/unittest/ut_main.cxx b/cosv/source/unittest/ut_main.cxx
new file mode 100644
index 000000000000..230307bf287d
--- /dev/null
+++ b/cosv/source/unittest/ut_main.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: ut_main.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ *
+ * 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 <precomp.h>
+
+#include <cosv/file.hxx>
+#include <cosv/simplestring.hxx>
+#include "ut.hxx"
+
+
+
+int _cdecl
+main(int argc, char * argv[])
+{
+ bool ret = classtest_File();
+ ret = classtest_SimpleString AND ret;
+
+ UT_RESULT( ret );
+
+ return 0;
+}
+
+
diff --git a/cosv/util/makefile.mk b/cosv/util/makefile.mk
new file mode 100644
index 000000000000..2fcd21b4186b
--- /dev/null
+++ b/cosv/util/makefile.mk
@@ -0,0 +1,92 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+#
+# 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
+
+ENABLE_EXCEPTIONS=true
+
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+
+# --- Files --------------------------------------------------------
+
+LIB1FILES= \
+ $(LB)$/cosv_service.lib \
+ $(LB)$/cosv_storage.lib \
+ $(LB)$/cosv_strings.lib
+
+
+# --- Targets ------------------------------------------------------
+
+LIB1TARGET= $(LB)$/$(TARGET).lib
+LIB1ARCHIV= $(LB)$/a$(TARGET).a
+
+
+.INCLUDE : target.mk
+
+