diff options
-rw-r--r-- | soltools/testSHL/inc/tlog.hxx | 99 | ||||
-rw-r--r-- | soltools/testSHL/inc/tstMgr.hxx | 75 | ||||
-rw-r--r-- | soltools/testSHL/inc/tutil.hxx | 52 | ||||
-rw-r--r-- | soltools/testSHL/makefile.mk | 52 | ||||
-rw-r--r-- | soltools/testSHL/testshl.cxx | 96 | ||||
-rw-r--r-- | soltools/testSHL/util/makefile.mk | 45 | ||||
-rw-r--r-- | soltools/testSHL/util/tlog.cxx | 109 | ||||
-rw-r--r-- | soltools/testSHL/util/tstMgr.cxx | 163 | ||||
-rw-r--r-- | soltools/testSHL/util/tutil.cxx | 149 |
9 files changed, 0 insertions, 840 deletions
diff --git a/soltools/testSHL/inc/tlog.hxx b/soltools/testSHL/inc/tlog.hxx deleted file mode 100644 index fa38483efd38..000000000000 --- a/soltools/testSHL/inc/tlog.hxx +++ /dev/null @@ -1,99 +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. - * - ************************************************************************/ -#ifndef _SOLTOOLS_TESTSHL_TLOG_HXX__ -#define _SOLTOOLS_TESTSHL_TLOG_HXX__ - -#include <osl/file.hxx> -#include <rtl/tres.hxx> - -#include "tutil.hxx" - -#include <iostream> - -using namespace std; - -namespace tstutl { - -class tLog { - - // <private_members> - ::osl::File* m_logfile; // fileobject - ::rtl::OUString m_logname; // name of log - // </private_members> - - // <private_methods> - void initialize( const ::rtl::OString& name ); - // </private_methods> - -public: - - // <public_ctors> - tLog() : m_logfile( 0 ) { - } - - tLog( const sal_Char* name ) { - if( name ) { - initialize( name ); - } - else { - m_logfile = 0; - } - - } - // </public_ctors> - - // <dtor> - virtual ~tLog() { - if ( m_logfile ) { - m_logfile->close(); - delete( m_logfile ); - } - } // </dtor> - - // <public_methods> - inline ::rtl::OUString& getName() { return m_logname; } - inline ::osl::File* getFile() { return m_logfile; } - - // open logfile for overwrite (default) or append - ::osl::FileBase::RC open( sal_Bool append = sal_False ); - ::osl::FileBase::RC close(); - - ::osl::FileBase::RC writeRes( ::rtl::TestResult& oRes, sal_Bool v = sal_False , - sal_Bool xml = sal_False ); - - // write methods without (default) or with echo on display - ::osl::FileBase::RC write( const sal_Char* buf, sal_Bool v = sal_False ); - // </public_methods> - -}; // </class_tLog> - -} // </namespace_tstutl> - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/soltools/testSHL/inc/tstMgr.hxx b/soltools/testSHL/inc/tstMgr.hxx deleted file mode 100644 index cbb8474b68af..000000000000 --- a/soltools/testSHL/inc/tstMgr.hxx +++ /dev/null @@ -1,75 +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. - * - ************************************************************************/ -#ifndef _SOLTOOLS_TESTSHL_TSTMGR_HXX__ -#define _SOLTOOLS_TESTSHL_TSTMGR_HXX__ - -#include <sal/types.h> - -#include <vector> - -using namespace std; - -// <namespace_tstutl> -namespace tstutl { - -// <class_tstMgr> -class tstMgr { - - // <private_members> - struct tstMgr_Impl; - tstMgr_Impl* pImpl; - // </private_members> - - // <private_methods> - void cleanup(); - // </private_methods> - -public: - tstMgr() : pImpl(0) {} - // <dtor> - ~tstMgr(){ - cleanup(); - } // </dtor> - - - // <public_methods> - sal_Bool initialize( sal_Char* moduleName, sal_Bool boom = sal_False ); - sal_Bool test_Entry( sal_Char* entry, sal_Char* logName = 0 ); - sal_Bool test_Entries( vector< sal_Char* > entries, sal_Char* logName = 0 ); - sal_Bool test_EntriesFromFile( sal_Char* fName, sal_Char* logName = 0 ); - // </public_methods> - -}; // </class_tstMgr> - -} // </namespace_tstutl> - -#endif - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/soltools/testSHL/inc/tutil.hxx b/soltools/testSHL/inc/tutil.hxx deleted file mode 100644 index 76c12b314548..000000000000 --- a/soltools/testSHL/inc/tutil.hxx +++ /dev/null @@ -1,52 +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. - * - ************************************************************************/ -#ifndef _SOLTOOLS_TESTSHL_TUTIL_HXX_ -#define _SOLTOOLS_TESTSHL_TUTIL_HXX__ - -#include <osl/file.hxx> - -using namespace std; - -#include <vector> - -// <namespace_tstutl> -namespace tstutl { - -sal_uInt32 getEntriesFromFile( sal_Char* fName, vector< sal_Char* >& entries ); -::rtl::OUString cnvrtPth( ::rtl::OString sysPth ); - -// string copy, cat, len methods -sal_Char* cpy( sal_Char** dest, const sal_Char* src ); -sal_Char* cat( const sal_Char* str1, const sal_Char* str2 ); -sal_uInt32 ln( const sal_Char* str ); - -} // </namespace_tstutl> - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/soltools/testSHL/makefile.mk b/soltools/testSHL/makefile.mk deleted file mode 100644 index 0377137b2274..000000000000 --- a/soltools/testSHL/makefile.mk +++ /dev/null @@ -1,52 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* -PRJ=.. - -PRJNAME=soltools -TARGET=testshl -TARGETTYPE=CUI - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk -.INCLUDE : settings.mk - -UWINAPILIB=$(0) -LIBSALCPPRT=$(0) - -# ------------------------------------------------------------------ - -APP1TARGET= $(TARGET) -APP1OBJS= $(OBJ)$/$(TARGET).obj -APP1STDLIBS=$(SALLIB)\ - $(SALHELPERLIB) -APP1DEPN= $(LB)$/tstutil.lib -APP1LIBS= $(LB)$/tstutil.lib - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/soltools/testSHL/testshl.cxx b/soltools/testSHL/testshl.cxx deleted file mode 100644 index c66a238effa6..000000000000 --- a/soltools/testSHL/testshl.cxx +++ /dev/null @@ -1,96 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_soltools.hxx" - -#include <stdio.h> - -#include "inc/tlog.hxx" - -#include "inc/tstMgr.hxx" - -using namespace tstutl; - -void usage(); -void test_shl( vector< sal_Char* > cmdln, sal_Bool boom ); - -#if (defined UNX) -int main( int argc, char* argv[] ) -#else -int _cdecl main( int argc, char* argv[] ) -#endif -{ - if ( argc < 3 ) { - usage(); - } - sal_Bool boom = sal_False; - vector< sal_Char* > cmdln; - - sal_Int32 i; - for ( i = 1; i < argc; i++ ) { - sal_Char* ptr = argv[i]; - if ( ptr[0] == '-' ) { - boom = sal_True; - } - else { - cmdln.push_back( ptr ); - } - } - if ( cmdln.size() < 3 ) { - cmdln.push_back( 0 ); - } - if ( ! cmdln[0] || ! cmdln[1] ) { - usage(); - } - - test_shl( cmdln, boom ); - - return(0); -} - -void test_shl( vector< sal_Char*> cmdln, sal_Bool boom ) { - - tstMgr tst; - - if ( tst.initialize( cmdln[0], boom )) { - tst.test_EntriesFromFile( cmdln[1], cmdln[2] ); - } - else { - sal_Char* msg = "could not find module\n"; - fprintf( stdout, "%s\n", msg ); - } -} - -void usage(){ - fprintf( stdout, - "USAGE: testSHL shlname scename [logname] [-boom]\n" ); - exit(0); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/soltools/testSHL/util/makefile.mk b/soltools/testSHL/util/makefile.mk deleted file mode 100644 index a2582f9c1abd..000000000000 --- a/soltools/testSHL/util/makefile.mk +++ /dev/null @@ -1,45 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=soltools -TARGET=tstutil - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -OBJFILES =\ - $(OBJ)$/tlog.obj \ - $(OBJ)$/tutil.obj \ - $(OBJ)$/tstMgr.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/soltools/testSHL/util/tlog.cxx b/soltools/testSHL/util/tlog.cxx deleted file mode 100644 index 65982ae978ec..000000000000 --- a/soltools/testSHL/util/tlog.cxx +++ /dev/null @@ -1,109 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_soltools.hxx" - -#include "tlog.hxx" - -using namespace std; - -// <namespace_tstutl> -namespace tstutl { - -// <method_initialize> -void tLog::initialize( const ::rtl::OString& name ) { - m_logname = cnvrtPth( name ); - m_logfile = new ::osl::File( m_logname ); -} // </method_initialize> - -// <method_open> -::osl::FileBase::RC tLog::open( sal_Bool append ) { - - if ( m_logfile ) { - ::osl::FileBase::RC ret; - - if ( ! append ) { - ret = ::osl::File::remove( m_logname ); - } - - if( m_logfile->open( osl_File_OpenFlag_Write ) == ::osl::FileBase::E_NOENT ) { - ret = m_logfile->open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ); - } - else { - ret = m_logfile->setPos( osl_Pos_End, 0 ); - } - return ret; - } - return ( ::osl::FileBase::E_INVAL ); -} // </method_open> - -// <method_close> -::osl::FileBase::RC tLog::close() { - if ( m_logfile ) { - return m_logfile->close(); - } - return ( ::osl::FileBase::E_INVAL ); -} // </method_close> - -// <method_writeRes> -::osl::FileBase::RC tLog::writeRes( ::rtl::TestResult& oRes, sal_Bool v, sal_Bool xml ) { - ::osl::FileBase::RC ret; - - sal_Char* ptr = oRes.getName(); - ptr = cat( ptr, ";" ); - ptr = cat( ptr, oRes.getResult() ); - ret = write( cat( ptr, "\n" ), v ); - delete [] ptr; - - return( ret ); -} // </method_writeRes> - -// <method_write> -::osl::FileBase::RC tLog::write( const sal_Char* buf, sal_Bool v ) { - - if ( ! m_logfile ) { - fprintf( stderr, "%s", buf ); - return ( ::osl::FileBase::E_NOENT ); - } - sal_uInt64 uBytes=0; - sal_uInt32 len = ln( buf ); - - if ( v ) { - fprintf( stderr, "%s", buf ); - } - return m_logfile->write( buf, len , uBytes ); -} // </method_write> - -} // </namespace_tstutl> - - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/soltools/testSHL/util/tstMgr.cxx b/soltools/testSHL/util/tstMgr.cxx deleted file mode 100644 index 7fa2bd7e40ad..000000000000 --- a/soltools/testSHL/util/tstMgr.cxx +++ /dev/null @@ -1,163 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_soltools.hxx" -#include "tstMgr.hxx" -#include <osl/module.hxx> -#include <rtl/tres.hxx> - -#include "tlog.hxx" - -#include "tutil.hxx" - -using namespace rtl; - -// <namespace_tstutl> -namespace tstutl { - -typedef void* ( tstFunc )( TestResult* ); -void test_Entry_Impl( ::osl::Module& oMod, TestResult* oRes ); - -// <private_members> -struct tstMgr::tstMgr_Impl { - ::osl::Module m_tstmodule; - sal_Bool m_boom; -}; -// </private_members> - -// <method_initialize> -sal_Bool tstMgr::initialize( sal_Char* modName, sal_Bool boom ) { - - ::rtl::OUString tstMod( ::rtl::OUString::createFromAscii( modName ) ); - pImpl = new tstMgr_Impl; - pImpl->m_boom = boom; - return ( pImpl->m_tstmodule.load( tstMod ) ); -} // <method_initialize> - -// <method_test_Entries> -sal_Bool tstMgr::test_Entries( vector< sal_Char* > entries, - sal_Char* logName ) { - - sal_Bool bOK = sal_False; - if ( ! entries.empty() ) { - - bOK = sal_True; - vector< sal_Char* >::iterator iter = entries.begin(); - - tLog log( logName ); - // open testLog - log.open(); - while ( iter != entries.end() ) { - if ( *iter[0] != '#' ) { - ::rtl::TestResult oRes( *iter, pImpl->m_boom ); - test_Entry_Impl( pImpl->m_tstmodule, &oRes ); - bOK &= oRes.getState(); - log.writeRes( oRes ); - } - ++iter; - } - log.close(); - } - return ( bOK ); -} // </method_test_Entries> - -// <method_test_Entry> -sal_Bool tstMgr::test_Entry( sal_Char* entry, sal_Char* logName ) { - - tLog log( logName ); - // open testLog - log.open(); - ::rtl::TestResult oRes( entry, pImpl->m_boom ); - test_Entry_Impl( pImpl->m_tstmodule, &oRes ); - log.writeRes( oRes, sal_True ); - log.close(); - return ( oRes.getState() ); -} // </method_test_Entry> - -// <method_test_EntriesFromFile> -sal_Bool tstMgr::test_EntriesFromFile( sal_Char* fName, sal_Char* logName ) { - - sal_Bool bOK = sal_False; - vector< sal_Char* > entries; - - if ( getEntriesFromFile( fName, entries ) ) { - sal_Bool bOK = test_Entries( entries, logName ); - - vector< sal_Char* >::iterator iter = entries.begin(); - while ( iter != entries.end() ) { - if ( *iter ) { - delete [] *iter; - } - ++iter; - } - } - else { - bOK = test_Entry( fName ); - } - return ( bOK ); - -} // </method_test_EntriesFromFile> - -// <method_cleanup> -void tstMgr::cleanup() { - if ( pImpl ) { - delete pImpl; - } -} // </method_cleanup> - - -// <function_test_Entry_Impl> -void test_Entry_Impl( ::osl::Module& oMod, ::rtl::TestResult* oRes ) { - - tstFunc* pFunc; // entry pointer - ::rtl::OString entryName( "test_" ); // entryname prefix - - // prefix entryname - entryName += oRes->getName(); - - // get entry pointer - pFunc = (tstFunc*) oMod.getSymbol( - ::rtl::OUString::createFromAscii( entryName.getStr() ) ); - - if ( pFunc ) { - // call entry - pFunc( oRes ); - oRes->end(); - } - else { - oRes->end("symbol not found"); - } - // return - return; - -} // </function_test_Entry_Impl> - -} // </namespace_tstutl> - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/soltools/testSHL/util/tutil.cxx b/soltools/testSHL/util/tutil.cxx deleted file mode 100644 index 81d068917101..000000000000 --- a/soltools/testSHL/util/tutil.cxx +++ /dev/null @@ -1,149 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_soltools.hxx" -#include "tutil.hxx" - -// <namespace_tstutl> -namespace tstutl { - -// getcwd hack is deprecated as soon as normalizePath works as intend -#ifdef WNT -#define _getcwd getcwd -#include <direct.h> // _getcwd -#else -#include <unistd.h> // getcwd -#endif - -// <function_cnvrtPth> -::rtl::OUString cnvrtPth( ::rtl::OString sysPth ) { - - using ::osl::FileBase; - using ::rtl::OUString; - using ::rtl::OString; - - ::rtl::OUString ret; - sysPth = sysPth.replace( '\\','/' ); - OUString pth( OUString::createFromAscii( sysPth.getStr() ) ); - - if ( sysPth.indexOf("..") != -1 ) { - - // <hack> for osl_normalizePath() can't handle relatives - char buffer[256]; - OString curPth(getcwd(buffer,256)); - // </hack> - OUString nrmCurPth; - FileBase::normalizePath( OUString::createFromAscii( curPth ) , - nrmCurPth ); - FileBase::getAbsolutePath( nrmCurPth, pth, ret ); - } - else { - FileBase::normalizePath( pth, ret ); - } - return ret; - -} // </function_cnvrtPth> - -// <function_getEntriesFromFile> -sal_uInt32 getEntriesFromFile( sal_Char* fName, - vector< sal_Char* >& entries ) { - - ::osl::File inFile( cnvrtPth( fName ) ); - if ( inFile.open( osl_File_OpenFlag_Read ) == ::osl::FileBase::E_None) { - ::rtl::ByteSequence byteSeq; - inFile.readLine( byteSeq ); - while ( byteSeq.getLength() ) { - sal_uInt32 len = byteSeq.getLength(); - sal_uInt32 i; - sal_Char* pEnt = new sal_Char[ len+1 ]; - sal_Char* bsPtr = (sal_Char*)byteSeq.getArray(); - for ( i=0; i<len; i++ ) { - pEnt[i] = bsPtr[i]; - } - pEnt[len] = '\0'; - entries.push_back( pEnt ); - - inFile.readLine( byteSeq ); - } - } - return ( entries.size() ); - -} // </function_getEntriesFromFile> - -// <function_cpy> -sal_Char* cpy( sal_Char** dest, const sal_Char* src ) { - - *dest = new sal_Char[ ln(src)+1 ]; - // set pointer - sal_Char* pdest = *dest; - const sal_Char* psrc = src; - - // copy string by char - while( *pdest++ = *psrc++ ); - - return ( *dest ); - -} // </function_cpy> - -// <function_cat> -sal_Char* cat( const sal_Char* str1, const sal_Char* str2 ) { - - // allocate memory for destination string - sal_Char* dest = new sal_Char[ ln(str1)+ln(str2)+1 ]; - - // set pointers - sal_Char* pdest = dest; - const sal_Char* psrc = str1; - - // copy string1 by char to dest - while( *pdest++ = *psrc++ ); - pdest--; - psrc = str2; - while( *pdest++ = *psrc++ ); - - return ( dest ); - -} // </function_cat> - -// <function_ln> -sal_uInt32 ln( const sal_Char* str ) { - - sal_uInt32 len = 0; - const sal_Char* ptr = str; - - if( ptr ) { - while( *ptr++ ) len++; - } - - return(len); -} // <function_ln> - -} // </namespace_tstutl> - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |