Kaydet (Commit) 46af0a5e authored tarafından sz's avatar sz

commenting stuff

üst 7fa303ad
/*************************************************************************
*
* $RCSfile: tlog.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: sz $ $Date: 2001-04-12 10:55:26 $
*
* 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 _SOLTOOLS_TESTSHL_TLOG_HXX__
#define _SOLTOOLS_TESTSHL_TLOG_HXX__
#ifndef _OSL_FILE_HXX_
#include <osl/file.hxx>
#endif
#ifndef _RTL_TRES_HXX_
#include <rtl/tres.hxx>
#endif
#ifndef _SOLTOOLS_TESTSHL_TUTIL_HXX_
#include "tutil.hxx"
#endif
#include <iostream>
using namespace std;
// <namespace_tstutl>
namespace tstutl {
// <class_tLog>
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::tRes& 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
/*************************************************************************
*
* $RCSfile: tstMgr.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: sz $ $Date: 2001-04-12 10:55:26 $
*
* 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 _SOLTOOLS_TESTSHL_TSTMGR_HXX__
#define _SOLTOOLS_TESTSHL_TSTMGR_HXX__
#ifndef _SAL_TYPES_H_
#include <sal/types.h>
#endif
#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:
// <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
/*************************************************************************
*
* $RCSfile: tutil.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: sz $ $Date: 2001-04-12 10:55:26 $
*
* 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 _SOLTOOLS_TESTSHL_TUTIL_HXX_
#define _SOLTOOLS_TESTSHL_TUTIL_HXX__
#ifndef _OSL_FILE_HXX_
#include <osl/file.hxx>
#endif
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
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: sz $ $Date: 2001-04-12 10:55:57 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
PRJ=..
PRJNAME=soltools
TARGET=testshl
TARGETTYPE=CUI
#USE_LDUMP2=TRUE
#LDUMP2=LDUMP3
# --- Settings -----------------------------------------------------
.INCLUDE : svpre.mk
.INCLUDE : settings.mk
.INCLUDE : sv.mk
# ------------------------------------------------------------------
APP1TARGET= $(TARGET)
APP1OBJS= $(OBJ)$/$(TARGET).obj
APP1STDLIBS=$(SALLIB)\
$(SALHELPERLIB)
APP1DEPN= $(LB)$/tstutil.lib
APP1LIBS= $(LB)$/tstutil.lib \
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: testshl.cxx,v $ * $RCSfile: testshl.cxx,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: sz $ $Date: 2001-04-12 06:18:13 $ * last change: $Author: sz $ $Date: 2001-04-12 10:55:57 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
#include "inc/tstmgr.hxx" #include "inc/tstmgr.hxx"
#endif #endif
using namespace tstutl;
void usage(); void usage();
void test_shl( vector< sal_Char* > cmdln, sal_Bool boom ); void test_shl( vector< sal_Char* > cmdln, sal_Bool boom );
......
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: sz $ $Date: 2001-04-12 10:54:54 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJNAME=soltools
TARGET=tstutil
# --- Settings -----------------------------------------------------
.INCLUDE : svpre.mk
.INCLUDE : settings.mk
.INCLUDE : sv.mk
# ------------------------------------------------------------------
OBJFILES =\
$(OBJ)$/tlog.obj \
$(OBJ)$/tutil.obj \
$(OBJ)$/tstmgr.obj
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
/*************************************************************************
*
* $RCSfile: tlog.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: sz $ $Date: 2001-04-12 10:54:54 $
*
* 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 "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( OpenFlag_Write ) == ::osl::FileBase::E_NOENT ) {
ret = m_logfile->open( OpenFlag_Write | OpenFlag_Create );
}
else {
ret = m_logfile->setPos( 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::tRes& 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 );
const sal_Char* ptr = buf;
if ( v ) {
fprintf( stderr, "%s", buf );
}
return m_logfile->write( buf, len , uBytes );
} // </method_write>
} // </namespace_tstutl>
/*************************************************************************
*
* $RCSfile: tstMgr.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: sz $ $Date: 2001-04-12 10:54:54 $
*
* 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 "tstmgr.hxx"
#ifndef _OSL_MODULE_HXX_
#include <osl/module.hxx>
#endif
#ifndef _RTL_TRES_HXX_
#include <rtl/tres.hxx>
#endif
#ifndef _SOLTOOLS_TESTSHL_TLOG_HXX_
#include "tlog.hxx"
#endif
#ifndef _SOLTOOLS_TESTSHL_TUTIL_HXX_
#include "tutil.hxx"
#endif
using namespace rtl;
// <namespace_tstutl>
namespace tstutl {
typedef void* ( tstFunc )( tRes* );
void test_Entry_Impl( ::osl::Module& oMod, tRes* 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::tRes 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::tRes 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::tRes* 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>
/*************************************************************************
*
* $RCSfile: tutil.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: sz $ $Date: 2001-04-12 10:54:54 $
*
* 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 "tutil.hxx"
// <namespace_tstutl>
namespace tstutl {
// _getcwd hack is deprecated as soon as normalizePath works as intend
#include <direct.h> // _getcwd
// <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( 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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment