summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cosv/inc/cosv/dirchain.hxx10
-rw-r--r--cosv/inc/cosv/ploc.hxx8
-rw-r--r--cosv/inc/cosv/std_outp.hxx25
-rw-r--r--cosv/inc/cosv/streamstr.hxx6
-rw-r--r--cosv/inc/cosv/string.hxx18
-rw-r--r--cosv/inc/cosv/stringdata.hxx6
-rw-r--r--cosv/source/service/comfunc.cxx36
-rw-r--r--cosv/source/service/std_outp.cxx20
-rw-r--r--cosv/source/storage/ploc_dir.cxx5
-rw-r--r--cosv/source/strings/str_types.cxx6
-rw-r--r--cosv/source/strings/streamstr.cxx67
-rw-r--r--cosv/source/strings/string.cxx28
12 files changed, 130 insertions, 105 deletions
diff --git a/cosv/inc/cosv/dirchain.hxx b/cosv/inc/cosv/dirchain.hxx
index e7556ee0348f..b3e0884dad0d 100644
--- a/cosv/inc/cosv/dirchain.hxx
+++ b/cosv/inc/cosv/dirchain.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dirchain.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: np $ $Date: 2002-03-08 14:25:38 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,6 +105,9 @@ class DirectoryChain
DirectoryChain & operator+=(
const DirectoryChain &
i_rDC );
+ DirectoryChain & operator-=(
+ uintt i_nLevelsUp );
+
// OPERATIONS
void Set(
const char * i_sPath,
@@ -162,6 +165,9 @@ DirectoryChain::operator+=( const String & i_sName )
inline DirectoryChain &
DirectoryChain::operator+=( const DirectoryChain & i_rDC )
{ PushBack(i_rDC); return *this; }
+inline DirectoryChain &
+DirectoryChain::operator-=( uintt i_nLevelsUp )
+ { PopBack(i_nLevelsUp); return *this; }
inline uintt
DirectoryChain::Size() const
{ return aPath.size(); }
diff --git a/cosv/inc/cosv/ploc.hxx b/cosv/inc/cosv/ploc.hxx
index d242a2f302e9..e9a7bb5c6903 100644
--- a/cosv/inc/cosv/ploc.hxx
+++ b/cosv/inc/cosv/ploc.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ploc.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -116,10 +116,10 @@ class Path
bool IsFile() const { return sFile.length() > 0; }
/// Directories have a delimiter at the end, files not.
- virtual void Get(
+ void Get(
ostream & o_rPath ) const;
/// Directories have a delimiter at the end, files not.
- virtual void Get(
+ void Get(
bostream & o_rPath ) const;
// ACCESS
DirectoryChain & DirChain() { return aPath; }
diff --git a/cosv/inc/cosv/std_outp.hxx b/cosv/inc/cosv/std_outp.hxx
index ac1b193f4e3b..c84d7f8f2219 100644
--- a/cosv/inc/cosv/std_outp.hxx
+++ b/cosv/inc/cosv/std_outp.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: std_outp.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,6 +74,7 @@
namespace csv
{
+#ifdef CSV_NO_IOSTREAMS
class redirect_out : public ostream
{
public:
@@ -104,16 +105,18 @@ class redirect_out : public ostream
static redirect_out *
pStdErr_;
};
-
+#endif // defined(CSV_NO_IOSTREAMS)
inline ostream &
Cout()
{
+
#ifndef CSV_NO_IOSTREAMS
- return redirect_out::useme_()
- ? (ostream&)( redirect_out::std_() )
- : (ostream&)( std::cout );
+// return redirect_out::useme_()
+// ? (ostream&)( redirect_out::std_() )
+// : (ostream&)( std::cout );
+ return (ostream&)( std::cout );
#else
csv_assert( redirect_out::useme_() );
return redirect_out::std_();
@@ -124,9 +127,10 @@ inline ostream &
Cerr()
{
#ifndef CSV_NO_IOSTREAMS
- return redirect_out::useme_()
- ? (ostream&)( redirect_out::err_() )
- : (ostream&)( std::cerr );
+// return redirect_out::useme_()
+// ? (ostream&)( redirect_out::err_() )
+// : (ostream&)( std::cerr );
+ return (ostream&)( std::cerr );
#else
csv_assert( redirect_out::useme_() );
return redirect_out::err_();
@@ -151,7 +155,8 @@ operator<<( csv::ostream & io_rStream,
csv::F_FLUSHING_FUNC i_fFlushingFunc )
{
#ifndef CSV_NO_IOSTREAMS
- (*i_fFlushingFunc)( io_rStream, csv::redirect_out::useme_(), 0 );
+// (*i_fFlushingFunc)( io_rStream, csv::redirect_out::useme_(), 0 );
+ (*i_fFlushingFunc)( io_rStream, false, 0 );
#else
csv_assert( csv::redirect_out::useme_() );
(*i_fFlushingFunc)( io_rStream, true, 0 );
diff --git a/cosv/inc/cosv/streamstr.hxx b/cosv/inc/cosv/streamstr.hxx
index 419f025927f7..88f60ff81355 100644
--- a/cosv/inc/cosv/streamstr.hxx
+++ b/cosv/inc/cosv/streamstr.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: streamstr.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: np $ $Date: 2002-05-14 08:08:45 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -231,6 +231,8 @@ class StreamStr : public bostream
self & operator_add_token(
const char * i_sText,
char i_cDelimiter );
+ self & operator_read_line(
+ bstream & i_src );
//*********** Not yet implemented *********************//
void strip_front(
diff --git a/cosv/inc/cosv/string.hxx b/cosv/inc/cosv/string.hxx
index 39767fa99861..00568a85ef76 100644
--- a/cosv/inc/cosv/string.hxx
+++ b/cosv/inc/cosv/string.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: string.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: np $ $Date: 2002-06-25 15:15:46 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -111,9 +111,6 @@ class String
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().
*/
@@ -163,9 +160,6 @@ class String
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().
*/
@@ -287,6 +281,9 @@ class String
inline int compare(
const String & i_s1,
+ const String & i_s2 );
+inline int compare(
+ const String & i_s1,
const char * i_s2 );
inline int compare(
const char * i_s1,
@@ -481,6 +478,11 @@ String::end() const
//****************** global compare-functions ********************//
inline int
+compare( const String & i_s1,
+ const String & i_s2 )
+{ return i_s1.compare(i_s2); }
+
+inline int
compare( const String & i_s1,
const char * i_s2 )
{ return strcmp(i_s1.c_str(), i_s2); }
diff --git a/cosv/inc/cosv/stringdata.hxx b/cosv/inc/cosv/stringdata.hxx
index 9d08933a363d..84144a09a210 100644
--- a/cosv/inc/cosv/stringdata.hxx
+++ b/cosv/inc/cosv/stringdata.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: stringdata.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -153,7 +153,7 @@ StringData<CHAR>::Data() const
}
template <class CHAR>
-StringData<CHAR>::size_type
+typename StringData<CHAR>::size_type
StringData<CHAR>::Size() const
{
return nSize;
diff --git a/cosv/source/service/comfunc.cxx b/cosv/source/service/comfunc.cxx
index d045d421a975..884a405a5202 100644
--- a/cosv/source/service/comfunc.cxx
+++ b/cosv/source/service/comfunc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: comfunc.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: np $ $Date: 2002-03-08 14:25:39 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -124,23 +124,23 @@ 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';
+ buf[0] = static_cast<char>(day/10 + '0');
+ buf[1] = static_cast<char>(day%10 + '0');
+ buf[3] = static_cast<char>(month/10 + '0');
+ buf[4] = static_cast<char>(month%10 + '0');
if (year < 100)
{
- buf[6] = char(year/10) + '0';
- buf[7] = char(year%10) + '0';
+ buf[6] = static_cast<char>(year/10 + '0');
+ buf[7] = static_cast<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';
+ buf[6] = static_cast<char>(year/1000 + '0');
+ buf[7] = static_cast<char>(year%1000/100 + '0');
+ buf[8] = static_cast<char>(year%100/10 + '0');
+ buf[9] = static_cast<char>(year%10 + '0');
}
out_Str = buf;
}
@@ -172,12 +172,12 @@ 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';
+ buf[0] = static_cast<char>(hour/10 + '0');
+ buf[1] = static_cast<char>(hour%10 + '0');
+ buf[3] = static_cast<char>(min/10 + '0');
+ buf[4] = static_cast<char>(min%10 + '0');
+ buf[6] = static_cast<char>(sec/10 + '0');
+ buf[7] = static_cast<char>(sec%10 + '0');
out_Str = buf;
}
diff --git a/cosv/source/service/std_outp.cxx b/cosv/source/service/std_outp.cxx
index e7f315298709..f0def78e87ea 100644
--- a/cosv/source/service/std_outp.cxx
+++ b/cosv/source/service/std_outp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: std_outp.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: vg $ $Date: 2002-08-21 08:27:38 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,30 +69,32 @@
namespace csv
{
+#ifdef CSV_NO_IOSTREAMS
redirect_out * redirect_out::pStdOut_ = 0;
redirect_out * redirect_out::pStdErr_ = 0;
+#endif // defined(CSV_NO_IOSTREAMS)
void
Endl( ostream & io_rStream, bool bUseRedirect, int* )
{
#ifndef CSV_NO_IOSTREAMS
- if (NOT bUseRedirect)
+// if (NOT bUseRedirect)
io_rStream << std::endl;
- else
+// else
#endif
- static_cast< redirect_out& >(io_rStream).re_endl();
+// static_cast< redirect_out& >(io_rStream).re_endl();
}
void
Flush( ostream & io_rStream, bool bUseRedirect, int* )
{
#ifndef CSV_NO_IOSTREAMS
- if (NOT bUseRedirect)
+// if (NOT bUseRedirect)
io_rStream << std::flush;
- else
+// else
#endif
- static_cast< redirect_out& >(io_rStream).re_flush();
+// static_cast< redirect_out& >(io_rStream).re_flush();
}
void
@@ -103,7 +105,7 @@ PerformAssertion(const char * condition, const char * file, unsigned line)
<< " in file: "
<< file
<< " at line: "
- << __LINE__
+ << line
<< Endl;
exit(3);
diff --git a/cosv/source/storage/ploc_dir.cxx b/cosv/source/storage/ploc_dir.cxx
index 3b8e805bf940..cf41a2746243 100644
--- a/cosv/source/storage/ploc_dir.cxx
+++ b/cosv/source/storage/ploc_dir.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ploc_dir.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: np $ $Date: 2002-05-02 12:35:10 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -307,7 +307,6 @@ Directory::GetContainedFiles( StringVector & o_rResult,
DIR * pDir = opendir( StrPath() );
dirent * pEntry = 0;
- char * sEnding = "";
struct stat aEntryStatus;
while ( (pEntry = readdir(pDir)) != 0 )
diff --git a/cosv/source/strings/str_types.cxx b/cosv/source/strings/str_types.cxx
index 60000b70568a..355fcdf7048c 100644
--- a/cosv/source/strings/str_types.cxx
+++ b/cosv/source/strings/str_types.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: str_types.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,7 +69,7 @@ namespace csv
CharOrder_Table::CharOrder_Table( const int * i_pCharWeightsArray )
{
- memcpy( cWeights, i_pCharWeightsArray, 256 );
+ memcpy( cWeights, i_pCharWeightsArray, 256 * sizeof(int) );
}
diff --git a/cosv/source/strings/streamstr.cxx b/cosv/source/strings/streamstr.cxx
index d1c24cded003..b3c4e2ca64c0 100644
--- a/cosv/source/strings/streamstr.cxx
+++ b/cosv/source/strings/streamstr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: streamstr.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: hr $ $Date: 2002-08-16 16:27:05 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -515,6 +515,32 @@ StreamStr::operator_add_token( const char * i_sText,
return *this;
}
+StreamStr &
+StreamStr::operator_read_line( bstream & i_src )
+{
+ char c = 0;
+ intt nCount = 0;
+ for ( nCount = i_src.read(&c, 1);
+ nCount == 1 AND c >= 32;
+ nCount = i_src.read(&c, 1) )
+ {
+ operator<<(c);
+ }
+
+ bool bEndOfStream = nCount == 0;
+ // Check for line-end:
+ if ( NOT bEndOfStream AND c != 0 )
+ {
+ char oldc = c;
+ if (i_src.read(&c, 1) == 1)
+ {
+ if (c >= 32 OR c == oldc)
+ i_src.seek(-1,::csv::cur);
+ }
+ }
+ return *this;
+}
+
void
StreamStr::replace( position_type i_nStart,
size_type i_nSize,
@@ -529,15 +555,15 @@ StreamStr::replace( position_type i_nStart,
size_type anz = min( length() - i_nStart, i_nSize );
- if ( i_nSize < i_aReplacement.nLength )
+ if ( anz < i_aReplacement.nLength )
{
- ProvideAddingSize( i_aReplacement.nLength - i_nSize );
+ ProvideAddingSize( i_aReplacement.nLength - anz );
}
- else if ( i_nSize > i_aReplacement.nLength )
+ else if ( anz > i_aReplacement.nLength )
{
- seek_type nMove = seek_type(i_nSize - i_aReplacement.nLength);
+ seek_type nMove = seek_type(anz - i_aReplacement.nLength);
- MoveData( dpData + i_nStart + i_nSize,
+ MoveData( dpData + i_nStart + anz,
pEnd,
-nMove );
pEnd -= nMove;
@@ -565,14 +591,11 @@ void
StreamStr::replace_all( Area i_aStrToSearch,
Area i_aReplacement )
{
- position_type p =0;
+ 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 < length() )
+ while ( p <= length() - nSearch )
{
if ( strncmp(dpData+p, pSearch, nSearch) == 0 )
{
@@ -602,8 +625,11 @@ StreamStr::to_lower( position_type i_nStart,
if ( i_nStart < length() )
{
- for ( char * pChange = dpData + i_nStart;
- pChange != pEnd;
+ char * pStop = i_nStart + i_nLength < length()
+ ? dpData + i_nStart + i_nLength
+ : pEnd;
+ for ( char * pChange = dpData + i_nStart;
+ pChange != pStop;
++pChange )
{
*pChange = (*pChange & char(0x80)) == '\0'
@@ -611,7 +637,7 @@ StreamStr::to_lower( position_type i_nStart,
: *pChange;
}
}
- return *this;
+ return *this;
}
StreamStr &
@@ -630,8 +656,11 @@ StreamStr::to_upper( position_type i_nStart,
if ( i_nStart < length() )
{
- for ( char * pChange = dpData + i_nStart;
- pChange != pEnd;
+ char * pStop = i_nStart + i_nLength < length()
+ ? dpData + i_nStart + i_nLength
+ : pEnd;
+ for ( char * pChange = dpData + i_nStart;
+ pChange != pStop;
++pChange )
{
*pChange = (*pChange & char(0x80)) == '\0'
@@ -639,7 +668,7 @@ StreamStr::to_upper( position_type i_nStart,
: *pChange;
}
}
- return *this;
+ return *this;
}
@@ -777,7 +806,7 @@ StreamStr::Resize( size_type i_nMinimumCapacity )
size_type nNewSize = nCapacity1 < 128
? nCapacity1 << 1
: (nCapacity1 << 1) - (nCapacity1 >> 1);
- nCapacity1 = csv::max( nNewSize, i_nMinimumCapacity + 1 );
+ nCapacity1 = csv::max( nNewSize, size_type(i_nMinimumCapacity + 1) );
char * pNew = new char[nCapacity1];
strcpy ( pNew, dpData );
diff --git a/cosv/source/strings/string.cxx b/cosv/source/strings/string.cxx
index f18d47004341..7d7e17b3e52e 100644
--- a/cosv/source/strings/string.cxx
+++ b/cosv/source/strings/string.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: string.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: np $ $Date: 2002-03-08 14:25:40 $
+ * last change: $Author: np $ $Date: 2002-11-01 12:18:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -158,17 +158,6 @@ String::String( const char * i_str,
{
}
-/* 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,
@@ -224,14 +213,6 @@ String::swap( self & i_rStr )
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 )
{
@@ -354,9 +335,8 @@ compare( const CharOrder_Table & i_rOrder,
{
const char * it1 = i_s1;
const char * it2 = i_s2;
- for ( ; *it1 == *it2 AND *it1 != '\0'; ++it1, ++it2 )
+ for ( ; i_rOrder(*it1) == i_rOrder(*it2) AND *it1 != '\0'; ++it1, ++it2 )
{}
-
return int( i_rOrder(*it1) - i_rOrder(*it2) );
}
@@ -410,7 +390,7 @@ compare( const CharOrder_Table & i_rOrder,
const char * it1 = i_s1;
const char * it2 = i_s2;
- for ( ; *it1 == *it2 AND *it1 != '\0' AND it1 != sEnd; ++it1, ++it2 )
+ for ( ; i_rOrder(*it1) == i_rOrder(*it2) AND *it1 != '\0' AND it1 != sEnd; ++it1, ++it2 )
{}
if ( it1 != sEnd )