binary read write to speed up in localsession
This commit is contained in:
parent
393461fd91
commit
87d61bd874
6 changed files with 208 additions and 40 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: filehelper.hxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: lla $ $Date: 2001-04-11 11:40:45 $
|
||||
* last change: $Author: lla $ $Date: 2001-05-14 12:06:26 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -88,7 +88,13 @@ namespace configmgr
|
|||
|
||||
rtl::OUString createOSLErrorString(osl::FileBase::RC eError);
|
||||
|
||||
bool fileExist(rtl::OUString const& _aFileURL);
|
||||
bool directoryExist(rtl::OUString const& _aDirexURL);
|
||||
|
||||
rtl::OUString splitDirectoryOff(rtl::OUString const& _sFilename);
|
||||
inline const sal_Unicode getFileDelimiter() { return sal_Unicode('/'); }
|
||||
|
||||
TimeValue getFileModificationStamp(rtl::OUString const& _aNormalizedFilename) throw (io::IOException);
|
||||
}
|
||||
} // namespace configmgr
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: typeconverter.hxx,v $
|
||||
*
|
||||
* $Revision: 1.5 $
|
||||
* $Revision: 1.6 $
|
||||
*
|
||||
* last change: $Author: jb $ $Date: 2001-04-05 09:19:18 $
|
||||
* last change: $Author: lla $ $Date: 2001-05-14 12:06:26 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -104,9 +104,6 @@ namespace configmgr
|
|||
return isList ? toListType(_rsSimpleType) : toType(_rsSimpleType);
|
||||
}
|
||||
|
||||
inline uno::Type getBinaryType() { return ::getCppuType(static_cast<uno::Sequence<sal_Int8> const*>(0)); }
|
||||
inline uno::Type getAnyType() { return ::getCppuType(static_cast<uno::Any const*>(0)); }
|
||||
|
||||
// template names
|
||||
::rtl::OUString toTemplateName(const uno::Type& _rType);
|
||||
::rtl::OUString toTemplateName(const uno::TypeClass& _rBasicType, bool bList = false);
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: filehelper.cxx,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: hro $ $Date: 2001-05-14 11:35:39 $
|
||||
* last change: $Author: lla $ $Date: 2001-05-14 12:06:26 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -143,6 +143,87 @@ void FileHelper::tryToRemoveFile(const rtl::OUString& _aURL) throw (io::IOExcept
|
|||
throw io::IOException(sError, NULL);
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
bool FileHelper::fileExist(rtl::OUString const& _aFileURL)
|
||||
{
|
||||
DirectoryItem aItem;
|
||||
FileBase::RC eError = DirectoryItem::get(_aFileURL, aItem);
|
||||
if (eError != osl_File_E_None)
|
||||
{
|
||||
// IF not exists
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
bool FileHelper::directoryExist(rtl::OUString const& _aDirexURL)
|
||||
{
|
||||
bool bDirectoryExist;
|
||||
Directory aDirex(_aDirexURL);
|
||||
FileBase::RC eError = aDirex.open();
|
||||
if (eError != osl_File_E_None)
|
||||
{
|
||||
bDirectoryExist = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bDirectoryExist = true;
|
||||
}
|
||||
|
||||
aDirex.close();
|
||||
return bDirectoryExist;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
rtl::OUString FileHelper::splitDirectoryOff(rtl::OUString const& _sFilename)
|
||||
{
|
||||
// split off the directory
|
||||
// there is no test, if last string after '/' is a directory, it will cut off
|
||||
|
||||
// evtl. should a test like: check if the last string contain a dot '.'
|
||||
// help to test it.
|
||||
|
||||
sal_Int32 nIdx = _sFilename.lastIndexOf(FileHelper::getFileDelimiter(), _sFilename.getLength());
|
||||
rtl::OUString sDirex = _sFilename.copy(0,nIdx);
|
||||
return sDirex;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
// return a TimeValue at which time the given file is modified
|
||||
|
||||
TimeValue FileHelper::getFileModificationStamp(rtl::OUString const& _aNormalizedFilename) throw (io::IOException)
|
||||
{
|
||||
TimeValue aTime = {0,0};
|
||||
|
||||
DirectoryItem aItem;
|
||||
osl::FileBase::RC eError = DirectoryItem::get(_aNormalizedFilename, aItem);
|
||||
if (eError != osl::FileBase::E_None)
|
||||
{
|
||||
rtl::OUString aUStr = FileHelper::createOSLErrorString(eError);
|
||||
throw io::IOException(aUStr, NULL);
|
||||
}
|
||||
|
||||
FileStatus aStatus(osl_FileStatus_Mask_ModifyTime|osl_FileStatus_Mask_Type);
|
||||
eError = aItem.getFileStatus(aStatus);
|
||||
if (eError != osl::FileBase::E_None)
|
||||
{
|
||||
return aTime;
|
||||
rtl::OUString aUStr = FileHelper::createOSLErrorString(eError);
|
||||
throw io::IOException(aUStr, NULL);
|
||||
}
|
||||
if (aStatus.isValid(osl_FileStatus_Mask_Type))
|
||||
{
|
||||
FileStatus::Type eType = aStatus.getFileType();
|
||||
volatile int dummy = 0;
|
||||
}
|
||||
|
||||
if (aStatus.isValid(osl_FileStatus_Mask_ModifyTime))
|
||||
{
|
||||
aTime = aStatus.getModifyTime();
|
||||
}
|
||||
return aTime;
|
||||
}
|
||||
|
||||
// ------------------ Create a string from FileBase::RC Error ------------------
|
||||
rtl::OUString FileHelper::createOSLErrorString(FileBase::RC eError)
|
||||
{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#
|
||||
# $RCSfile: makefile.mk,v $
|
||||
#
|
||||
# $Revision: 1.9 $
|
||||
# $Revision: 1.10 $
|
||||
#
|
||||
# last change: $Author: lla $ $Date: 2001-03-23 12:44:26 $
|
||||
# last change: $Author: lla $ $Date: 2001-05-14 12:06:26 $
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# either of the following licenses
|
||||
|
@ -98,10 +98,14 @@ SLOFILES=\
|
|||
$(SLO)$/updatehandler.obj \
|
||||
$(SLO)$/updatetree.obj \
|
||||
$(SLO)$/namehelper.obj \
|
||||
$(SLO)$/binarywritehandler.obj \
|
||||
$(SLO)$/writesubtreeasbinaryhandler.obj \
|
||||
$(SLO)$/binarywriter.obj \
|
||||
$(SLO)$/binaryreader.obj \
|
||||
$(SLO)$/simpletypehelper.obj \
|
||||
$(SLO)$/binarydecide.obj \
|
||||
$(SLO)$/pathhelper.obj \
|
||||
|
||||
# $(SLO)$/binaryhandler.obj \
|
||||
# $(SLO)$/binarywriter.obj \
|
||||
# $(SLO)$/binaryreader.obj \
|
||||
|
||||
# --- Targets ---
|
||||
|
||||
|
|
92
configmgr/source/xml/simpletypehelper.cxx
Normal file
92
configmgr/source/xml/simpletypehelper.cxx
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: simpletypehelper.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: lla $ $Date: 2001-05-14 12:06:27 $
|
||||
*
|
||||
* 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 "simpletypehelper.hxx"
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
|
||||
#include <com/sun/star/uno/Any.hxx>
|
||||
#endif
|
||||
|
||||
namespace configmgr
|
||||
{
|
||||
namespace uno = com::sun::star::uno;
|
||||
namespace SimpleTypeHelper
|
||||
{
|
||||
|
||||
uno::Type getBooleanType() { return ::getBooleanCppuType(); }
|
||||
|
||||
uno::Type getByteType() { return ::getCppuType(static_cast<sal_Int8 const*>(0)); }
|
||||
uno::Type getShortType() { return ::getCppuType(static_cast<sal_Int16 const*>(0)); }
|
||||
uno::Type getIntType() { return ::getCppuType(static_cast<sal_Int32 const*>(0)); }
|
||||
uno::Type getLongType() { return ::getCppuType(static_cast<sal_Int64 const*>(0)); }
|
||||
|
||||
uno::Type getDoubleType() { return ::getCppuType(static_cast<double const*>(0)); }
|
||||
|
||||
uno::Type getStringType() { return ::getCppuType(static_cast<rtl::OUString const*>(0)); }
|
||||
|
||||
uno::Type getBinaryType() { return ::getCppuType(static_cast<uno::Sequence<sal_Int8> const*>(0)); }
|
||||
uno::Type getAnyType() { return ::getCppuType(static_cast<uno::Any const*>(0)); }
|
||||
}
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: typeconverter.cxx,v $
|
||||
*
|
||||
* $Revision: 1.12 $
|
||||
* $Revision: 1.13 $
|
||||
*
|
||||
* last change: $Author: pl $ $Date: 2001-05-11 19:25:44 $
|
||||
* last change: $Author: lla $ $Date: 2001-05-14 12:06:27 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -88,6 +88,8 @@
|
|||
#include <osl/diagnose.h>
|
||||
#endif
|
||||
|
||||
#include "simpletypehelper.hxx"
|
||||
|
||||
namespace uno = ::com::sun::star::uno;
|
||||
namespace script = ::com::sun::star::script;
|
||||
namespace lang = ::com::sun::star::lang;
|
||||
|
@ -205,19 +207,6 @@ namespace configmgr
|
|||
}
|
||||
|
||||
// *************************************************************************
|
||||
namespace
|
||||
{
|
||||
|
||||
inline uno::Type getBooleanType() { return ::getBooleanCppuType(); }
|
||||
|
||||
inline uno::Type getShortType() { return ::getCppuType(static_cast<sal_Int16 const*>(0)); }
|
||||
inline uno::Type getIntType() { return ::getCppuType(static_cast<sal_Int32 const*>(0)); }
|
||||
inline uno::Type getLongType() { return ::getCppuType(static_cast<sal_Int64 const*>(0)); }
|
||||
|
||||
inline uno::Type getDoubleType() { return ::getCppuType(static_cast<double const*>(0)); }
|
||||
|
||||
inline uno::Type getStringType() { return ::getCppuType(static_cast<rtl::OUString const*>(0)); }
|
||||
|
||||
// *************************************************************************
|
||||
/*
|
||||
::rtl::OUString findXMLTypeName(const uno::Type& _rType)
|
||||
|
@ -270,27 +259,26 @@ namespace configmgr
|
|||
return aRet;
|
||||
}
|
||||
*/
|
||||
} // unamed namespace
|
||||
// *************************************************************************
|
||||
|
||||
uno::Type toType(const ::rtl::OUString& _rType)
|
||||
{
|
||||
uno::Type aRet;
|
||||
|
||||
if (_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("boolean"))) aRet = getBooleanType();
|
||||
if (_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("boolean"))) aRet = SimpleTypeHelper::getBooleanType();
|
||||
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("short"))) aRet = getShortType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("int"))) aRet = getIntType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("integer"))) aRet = getIntType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("long"))) aRet = getLongType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("short"))) aRet = SimpleTypeHelper::getShortType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("int"))) aRet = SimpleTypeHelper::getIntType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("integer"))) aRet = SimpleTypeHelper::getIntType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("long"))) aRet = SimpleTypeHelper::getLongType();
|
||||
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("double"))) aRet = getDoubleType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("double"))) aRet = SimpleTypeHelper::getDoubleType();
|
||||
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("string"))) aRet = getStringType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("binary"))) aRet = getBinaryType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("string"))) aRet = SimpleTypeHelper::getStringType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("binary"))) aRet = SimpleTypeHelper::getBinaryType();
|
||||
// else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("sequence"))) aRet = uno::TypeClass_SEQUENCE;
|
||||
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("any"))) aRet = getAnyType();
|
||||
else if(_rType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("any"))) aRet = SimpleTypeHelper::getAnyType();
|
||||
else
|
||||
{
|
||||
::rtl::OString aStr("Unknown type! ");
|
||||
|
@ -372,7 +360,7 @@ namespace configmgr
|
|||
uno::Type getBasicType(uno::Type const& rType, bool& bSequence)
|
||||
{
|
||||
bSequence = rType.getTypeClass() == uno::TypeClass_SEQUENCE &&
|
||||
rType != getBinaryType();
|
||||
rType != SimpleTypeHelper::getBinaryType();
|
||||
|
||||
if (!bSequence)
|
||||
return rType;
|
||||
|
|
Loading…
Reference in a new issue