diff options
-rw-r--r-- | cosv/inc/cosv/datetime.hxx | 6 | ||||
-rw-r--r-- | cosv/inc/cosv/ploc.hxx | 16 | ||||
-rw-r--r-- | cosv/inc/cosv/streamstr.hxx | 25 | ||||
-rw-r--r-- | cosv/inc/cosv/string.hxx | 17 | ||||
-rw-r--r-- | cosv/source/service/commandline.cxx | 345 | ||||
-rw-r--r-- | cosv/source/service/datetime.cxx | 28 | ||||
-rw-r--r-- | cosv/source/storage/ploc.cxx | 17 | ||||
-rw-r--r-- | cosv/source/strings/streamstr.cxx | 37 | ||||
-rw-r--r-- | cosv/source/strings/string.cxx | 60 |
9 files changed, 0 insertions, 551 deletions
diff --git a/cosv/inc/cosv/datetime.hxx b/cosv/inc/cosv/datetime.hxx index a430b47f8163..ad7f2c3a9bdf 100644 --- a/cosv/inc/cosv/datetime.hxx +++ b/cosv/inc/cosv/datetime.hxx @@ -38,7 +38,6 @@ namespace csv class Date { public: - Date(); Date( unsigned i_nDay, unsigned i_nMonth, @@ -48,8 +47,6 @@ class Date unsigned Month() const { return (nData & 0x00FF0000) >> 16; } unsigned Year() const { return nData & 0x0000FFFF; } - static const Date & Null_(); - private: UINT32 nData; }; @@ -57,7 +54,6 @@ class Date class Time { public: - Time(); Time( unsigned i_nHour, unsigned i_nMinutes, @@ -69,8 +65,6 @@ class Time unsigned Seconds() const { return (nData & 0x0000FF00) >> 8; } unsigned Seconds100() const { return nData & 0x000000FF; } - static const Time & Null_(); - private: UINT32 nData; }; diff --git a/cosv/inc/cosv/ploc.hxx b/cosv/inc/cosv/ploc.hxx index c082951b33cd..a67cbe1ca2d8 100644 --- a/cosv/inc/cosv/ploc.hxx +++ b/cosv/inc/cosv/ploc.hxx @@ -85,9 +85,6 @@ class Path /// Directories have a delimiter at the end, files not. void Get( - ostream & o_rPath ) const; - /// Directories have a delimiter at the end, files not. - void Get( bostream & o_rPath ) const; // ACCESS DirectoryChain & DirChain() { return aPath; } @@ -104,17 +101,6 @@ class Path } // namespace ploc } // namespace csv - - -/// Directories produce a delimiter at the end, files not. -inline csv::ostream & -operator<<( csv::ostream & o_rOut, - const csv::ploc::Path & i_rPath ) -{ - i_rPath.Get(o_rOut); - return o_rOut; -} - /// Directories produce a delimiter at the end, files not. inline csv::bostream & operator<<( csv::bostream & o_rOut, @@ -124,8 +110,6 @@ operator<<( csv::bostream & o_rOut, return o_rOut; } - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cosv/inc/cosv/streamstr.hxx b/cosv/inc/cosv/streamstr.hxx index c27d504451cd..ef71a637dce2 100644 --- a/cosv/inc/cosv/streamstr.hxx +++ b/cosv/inc/cosv/streamstr.hxx @@ -268,20 +268,6 @@ class StreamStrLock StreamStr * pStr; }; -/** Splits a string into tokens by whitespace. - - The tokens are added to the end of o_list. -*/ -void Split( - std::vector<String> & - o_list, - const char * i_text ); -inline void Join( - StreamStr & o_text, - std::vector<String> & - i_list, - const char * i_sLink = " "); - // IMPLEMENTATION inline const char * @@ -330,17 +316,6 @@ inline StreamStr::iterator StreamStr::end() { return pEnd; } -inline void -Join( StreamStr & o_text, - std::vector<String> & i_list, - const char * i_sLink ) -{ - o_text.operator_join(i_list.begin(),i_list.end(),i_sLink); -} - - - - } // namespace csv #endif diff --git a/cosv/inc/cosv/string.hxx b/cosv/inc/cosv/string.hxx index 4a57dd143d45..84329f27fda2 100644 --- a/cosv/inc/cosv/string.hxx +++ b/cosv/inc/cosv/string.hxx @@ -228,11 +228,6 @@ int compare( csv::str::position i_nStartPosition1, const char * i_s2, csv::str::size i_nLength ); -int compare( - const char * i_s1, - const String & i_s2, - csv::str::position i_nStartPosition2, - csv::str::size i_nLength ); inline int compare( const char * i_s1, const char * i_s2, @@ -257,18 +252,6 @@ int compare( 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 ); -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 ); -int compare( - const CharOrder_Table & i_rOrder, const char * i_s1, const char * i_s2, csv::str::size i_nLength ); diff --git a/cosv/source/service/commandline.cxx b/cosv/source/service/commandline.cxx deleted file mode 100644 index cfaf01d9a416..000000000000 --- a/cosv/source/service/commandline.cxx +++ /dev/null @@ -1,345 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <precomp.h> -#include <cosv/commandline.hxx> - -// NOT FULLY DECLARED SERVICES -#include <cosv/file.hxx> - - -namespace csv -{ - -namespace -{ - -const intt C_nNoOption = -1; - -const char * sIncludeOptionShort = "-A:"; -const char * sIncludeOptionLong = "--Arguments:"; -const uintt nIncludeOptionShort_Length = strlen(sIncludeOptionShort); -const uintt nIncludeOptionLong_Length = strlen(sIncludeOptionLong); - - -/** Analyses, if an option is the one to include a file with - further command line arguments. -*/ -bool IsIncludeOption( - const String & i_option ); - -/** Gets the file name from an include-arguments-option. -*/ -String IncludeFile_fromIncludeOption( - const String & i_option ); - - -bool -IsIncludeOption(const String & i_option) -{ - return strncmp(i_option, sIncludeOptionShort, nIncludeOptionShort_Length) == 0 - OR - strncmp(i_option, sIncludeOptionLong, nIncludeOptionLong_Length) == 0; -} - -String -IncludeFile_fromIncludeOption(const String & i_option) -{ - if ( strncmp(i_option, sIncludeOptionShort, nIncludeOptionShort_Length) - == 0 ) - { - return String(i_option, nIncludeOptionShort_Length, str::maxsize); - } - else - if ( strncmp(i_option, sIncludeOptionLong, nIncludeOptionLong_Length) - == 0 ) - { - return String(i_option, nIncludeOptionLong_Length, str::maxsize); - } - return String::Null_(); -} - - -} // end anonymous namespace - - - - -/** Local helper class for searching a possible option name in a vector of - ->OptionDescription. -*/ -struct CommandLine:: -FindOptionByText -{ - bool operator()( - const CommandLine::OptionDescription & - i_option ) - { return i_option.sText == sOption; } - - /// @param i_searchText [i_searchText != ""] - FindOptionByText( - const String & i_option ) - : sOption(i_option) { } - private: - const String sOption; -}; - - -typedef std::vector<StringVector::const_iterator> StringCIteratorList; -typedef std::vector<intt> OptionIdList; - -bool -CommandLine::Interpret( int argc, - char * argv[] ) -{ - Get_Arguments(argc,argv); - csv_assert(aOptionPoints.size() == aOptionIds.size()); - - StringVector::const_iterator - itNext = aCommandLine.begin(); - ++itNext; // Move 1 forward from program name. - StringVector::const_iterator - itEnd = aCommandLine.end(); - StringCIteratorList::const_iterator - itOptPtsEnd = aOptionPoints.end(); - - OptionIdList::const_iterator - itOptIds = aOptionIds.begin(); - for ( StringCIteratorList::const_iterator itOptPts = aOptionPoints.begin(); - itOptPts != itOptPtsEnd AND bIsOk; - ++itOptPts, ++itOptIds ) - { - // May be, there are arguments which do not belong to the last option: - // itNext != *is - Handle_FreeArguments(itNext, *itOptPts); - - itNext = do_HandleOption( *itOptIds, - *itOptPts + 1, - itOptPts+1 == itOptPtsEnd ? itEnd : *(itOptPts+1) ); - csv_assert(itNext <= itEnd); - } // end for (is) - Handle_FreeArguments(itNext, itEnd); - - return bIsOk; -} - -CommandLine::CommandLine() - : aOptions(), - aCommandLine(), - bIsOk(false) -{ -} - -void -CommandLine::Add_Option( intt i_id, - String i_text ) -{ - aOptions.push_back(OptionDescription( i_id, - i_text )); -} - -void -CommandLine::Get_Arguments( int argc, - char * argv[] ) -{ - aCommandLine.erase(aCommandLine.begin(),aCommandLine.end()); - aCommandLine.reserve(argc); - - char ** pArgEnd = argv + argc; - for ( char ** pArg = &argv[0]; - pArg != pArgEnd; - ++pArg ) - { - Store_Argument(*pArg); - } // end for - Find_OptionPoints(); - bIsOk = true; -} - -intt -CommandLine::Find_Option( const String & i_text ) const -{ - if (i_text.empty()) - return C_nNoOption; - - FindOptionByText aSearch(i_text); - OptionList::const_iterator - itFound = std::find_if( aOptions.begin(), - aOptions.end(), - aSearch ); - if (itFound != aOptions.end()) - { - return (*itFound).nId; - } - return C_nNoOption; -} - -bool -CommandLine::Store_Argument( const String & i_arg ) -{ - if ( NOT IsIncludeOption(i_arg) ) - { - aCommandLine.push_back(i_arg); - return true; - } - - return Try2Include_Options(i_arg); -} - -void -CommandLine::Find_OptionPoints() -{ - StringVector::const_iterator itEnd = aCommandLine.end(); - for ( StringVector::const_iterator it = aCommandLine.begin() + 1; - it != itEnd; - ++it ) - { - intt nOption = Find_Option(*it); - if (nOption != C_nNoOption) - { - aOptionPoints.push_back(it); - aOptionIds.push_back(nOption); - } - } // end for (i) -} - -void -CommandLine::Handle_FreeArguments( StringVector::const_iterator i_begin, - StringVector::const_iterator i_end ) -{ - for ( StringVector::const_iterator it = i_begin; - it != i_end AND bIsOk; - ++it ) - { - do_HandleFreeArgument(*it); - } -} - -bool -CommandLine::Try2Include_Options(const String & i_includeOption) -{ - static StringVector - aIncludedOptionFiles_; - - const String - aOptionFile(IncludeFile_fromIncludeOption(i_includeOption)); - - // Avoid recursion deadlock 1 - if ( std::find( aIncludedOptionFiles_.begin(), - aIncludedOptionFiles_.end(), - aOptionFile ) - != aIncludedOptionFiles_.end() ) - { - Cerr() << "\nError: Self inclusion of option file " - << aOptionFile - << ".\n" - << Endl(); - return false; - } - - // Avoid recursion deadlock 2 - aIncludedOptionFiles_.push_back(aOptionFile); - - bool ok = Include_Options(aOptionFile); - - // Avoid recursion deadlock 3 - aIncludedOptionFiles_.pop_back(); - - return ok; -} - -bool -CommandLine::Include_Options( const String & i_optionsFile ) -{ - StreamStr - aIncludedText(500); - bool ok = Load_Options(aIncludedText, i_optionsFile); - if (NOT ok) - return false; - - StringVector - aIncludedOptions; - Split(aIncludedOptions, aIncludedText.c_str()); - - StringVector::const_iterator itEnd = aIncludedOptions.end(); - for ( StringVector::const_iterator it = aIncludedOptions.begin(); - it != itEnd; - ++it ) - { - Store_Argument(*it); - } // end for - - return true; -} - -bool -CommandLine::Load_Options( StreamStr & o_text, - const String & i_optionsFile ) -{ - if (i_optionsFile.empty()) - return false; - - File - aOptionsFile(i_optionsFile, CFM_READ); - OpenCloseGuard - aOFGuard(aOptionsFile); - if (NOT aOFGuard) - { - Cerr() << "\nError: Options file " - << i_optionsFile - << " not found.\n" - << Endl(); - return false; - } - - StreamStr - aLoad(aOptionsFile); - o_text.swap(aLoad); - return true; -} - - - - -/****************** OptionDescription ***********************/ - - -CommandLine:: -OptionDescription::OptionDescription( intt i_id, - String i_text ) - : nId(i_id), - sText(i_text) -{ -} - - - - -} // namespace csv - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cosv/source/service/datetime.cxx b/cosv/source/service/datetime.cxx index 277197ab0fa6..8204ca09a655 100644 --- a/cosv/source/service/datetime.cxx +++ b/cosv/source/service/datetime.cxx @@ -37,12 +37,6 @@ namespace csv { - -Date::Date() - : nData( 0 ) -{ -} - Date::Date( unsigned i_nDay, unsigned i_nMonth, unsigned i_nYear ) @@ -50,19 +44,6 @@ Date::Date( unsigned i_nDay, { } -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, @@ -71,15 +52,6 @@ Time::Time( unsigned i_nHour, { } -const Time & -Time::Null_() -{ - static const Time C_TimeNull_(0,0); - return C_TimeNull_; -} - - - } // namespace csv diff --git a/cosv/source/storage/ploc.cxx b/cosv/source/storage/ploc.cxx index a4c3ad274352..614fae82ae3f 100644 --- a/cosv/source/storage/ploc.cxx +++ b/cosv/source/storage/ploc.cxx @@ -113,20 +113,6 @@ Path::IsValid() const } 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()) @@ -139,9 +125,6 @@ Path::Get( bostream & o_rPath ) const o_rPath.write( sFile ); } - - - } // namespace ploc } // namespace csv diff --git a/cosv/source/strings/streamstr.cxx b/cosv/source/strings/streamstr.cxx index 68a04355c3a2..7fe0d35cefae 100644 --- a/cosv/source/strings/streamstr.cxx +++ b/cosv/source/strings/streamstr.cxx @@ -654,43 +654,6 @@ c_str() // Does nothing. } - - -void -Split( std::vector<String> & o_list, - const char * i_text ) -{ - const char * - pCurrentToken = 0; - bool - white = false; - for (const char * p = i_text; *p != '\0'; ++p) - { - white = UINT8(*p) > 32; - if (pCurrentToken != 0) - { - if (white) - { - o_list.push_back(String(pCurrentToken, p)); - pCurrentToken = 0; - } - } - else - { - if ( NOT white) - pCurrentToken = p; - } // endif (bInToken) else - } // end for - - if (pCurrentToken != 0) - { - o_list.push_back(String(pCurrentToken)); - } -} - - - - } // namespace csv /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cosv/source/strings/string.cxx b/cosv/source/strings/string.cxx index f5ada3e4f8f0..dbc804d3e44f 100644 --- a/cosv/source/strings/string.cxx +++ b/cosv/source/strings/string.cxx @@ -223,23 +223,6 @@ compare( const String & i_s1, } 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 ) @@ -252,46 +235,6 @@ compare( const CharOrder_Table & i_rOrder, } 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, @@ -310,9 +253,6 @@ compare( const CharOrder_Table & i_rOrder, return 0; } - - - } // namespace csv /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |