summaryrefslogtreecommitdiff
path: root/tools/inc
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-04-11 19:13:16 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-04-11 19:13:16 +0000
commit6d7686370b8bf5e267c2761e73d6adeb7a20fe1b (patch)
tree6db29294de64d7309634cbb4c4f9b04e40b7e1a3 /tools/inc
parentfc8bdf6136531bfd34c41b352f1156bd68844077 (diff)
INTEGRATION: CWS hedaburemove01 (1.1.2); FILE ADDED
2006/12/12 16:24:47 vg 1.1.2.1: #i72503# gathered global includes in one place
Diffstat (limited to 'tools/inc')
-rw-r--r--tools/inc/tools/inetstrm.hxx291
-rw-r--r--tools/inc/tools/iparser.hxx157
-rw-r--r--tools/inc/tools/isofallback.hxx51
3 files changed, 499 insertions, 0 deletions
diff --git a/tools/inc/tools/inetstrm.hxx b/tools/inc/tools/inetstrm.hxx
new file mode 100644
index 000000000000..240066260bfe
--- /dev/null
+++ b/tools/inc/tools/inetstrm.hxx
@@ -0,0 +1,291 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: inetstrm.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-04-11 20:12:57 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 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
+ *
+ ************************************************************************/
+#ifndef _TOOLS_INETSTRM_HXX
+#define _TOOLS_INETSTRM_HXX
+
+#ifndef INCLUDED_TOOLSDLLAPI_H
+#include "tools/toolsdllapi.h"
+#endif
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+class INetMessage;
+class INetMIMEMessage;
+class INetHTTPMessage;
+class SvMemoryStream;
+class SvStream;
+
+/*=========================================================================
+ *
+ * INetStream Interface.
+ *
+ *=======================================================================*/
+enum INetStreamStatus
+{
+ INETSTREAM_STATUS_LOADED = -4,
+ INETSTREAM_STATUS_WOULDBLOCK = -3,
+ INETSTREAM_STATUS_OK = -2,
+ INETSTREAM_STATUS_ERROR = -1
+};
+
+/*
+ * INetIStream.
+ */
+class TOOLS_DLLPUBLIC INetIStream
+{
+ // Not implemented.
+ INetIStream (const INetIStream& rStrm);
+ INetIStream& operator= (const INetIStream& rStrm);
+
+protected:
+ virtual int GetData (sal_Char *pData, ULONG nSize) = 0;
+
+public:
+ INetIStream ();
+ virtual ~INetIStream (void);
+
+ int Read (sal_Char *pData, ULONG nSize);
+
+ static void Decode64 (SvStream& rIn, SvStream& rOut);
+ static void Encode64 (SvStream& rIn, SvStream& rOut);
+};
+
+/*
+ * INetOStream.
+ */
+class INetOStream
+{
+ // Not implemented.
+ INetOStream (const INetOStream& rStrm);
+ INetOStream& operator= (const INetOStream& rStrm);
+
+protected:
+ virtual int PutData (
+ const sal_Char *pData, ULONG nSize) = 0;
+
+public:
+ INetOStream ();
+ virtual ~INetOStream (void);
+
+ int Write (const sal_Char *pData, ULONG nSize);
+};
+
+/*
+ * INetIOStream.
+ */
+class INetIOStream : public INetIStream, public INetOStream
+{
+ // Not implemented.
+ INetIOStream (const INetIOStream& rStrm);
+ INetIOStream& operator= (const INetIOStream& rStrm);
+
+public:
+ INetIOStream (ULONG nIBufferSize = 0, ULONG nOBufferSize = 0);
+ virtual ~INetIOStream (void);
+};
+
+/*=========================================================================
+ *
+ * INetMessageStream Interface.
+ *
+ *=======================================================================*/
+enum INetMessageStreamState
+{
+ INETMSG_EOL_BEGIN,
+ INETMSG_EOL_DONE,
+ INETMSG_EOL_SCR,
+ INETMSG_EOL_FCR,
+ INETMSG_EOL_FLF,
+ INETMSG_EOL_FSP,
+ INETMSG_EOL_FESC
+};
+
+/*
+ * INetMessageIStream (Message Generator) Interface.
+ */
+class INetMessageIStream : public INetIStream
+{
+ INetMessage *pSourceMsg;
+ BOOL bHeaderGenerated;
+
+ ULONG nBufSiz;
+ sal_Char *pBuffer;
+ sal_Char *pRead;
+ sal_Char *pWrite;
+
+ SvStream *pMsgStrm;
+ SvMemoryStream *pMsgBuffer;
+ sal_Char *pMsgRead;
+ sal_Char *pMsgWrite;
+
+ virtual int GetData (sal_Char *pData, ULONG nSize);
+
+ // Not implemented.
+ INetMessageIStream (const INetMessageIStream& rStrm);
+ INetMessageIStream& operator= (const INetMessageIStream& rStrm);
+
+protected:
+ virtual int GetMsgLine (sal_Char *pData, ULONG nSize);
+
+public:
+ INetMessageIStream (ULONG nBufferSize = 2048);
+ virtual ~INetMessageIStream (void);
+
+ INetMessage *GetSourceMessage (void) const { return pSourceMsg; }
+ void SetSourceMessage (INetMessage *pMsg) { pSourceMsg = pMsg; }
+
+ void GenerateHeader (BOOL bGen = TRUE) { bHeaderGenerated = !bGen; }
+ BOOL IsHeaderGenerated (void) const { return bHeaderGenerated; }
+};
+
+/*
+ * INetMessageOStream (Message Parser) Interface.
+ */
+class INetMessageOStream : public INetOStream
+{
+ INetMessage *pTargetMsg;
+ BOOL bHeaderParsed;
+
+ INetMessageStreamState eOState;
+
+ SvMemoryStream *pMsgBuffer;
+
+ virtual int PutData (const sal_Char *pData, ULONG nSize);
+
+ // Not implemented.
+ INetMessageOStream (const INetMessageOStream& rStrm);
+ INetMessageOStream& operator= (const INetMessageOStream& rStrm);
+
+protected:
+ virtual int PutMsgLine (const sal_Char *pData, ULONG nSize);
+
+public:
+ INetMessageOStream (void);
+ virtual ~INetMessageOStream (void);
+
+ INetMessage *GetTargetMessage (void) const { return pTargetMsg; }
+ void SetTargetMessage (INetMessage *pMsg) { pTargetMsg = pMsg; }
+
+ void ParseHeader (BOOL bParse = TRUE) { bHeaderParsed = !bParse; }
+ BOOL IsHeaderParsed (void) const { return bHeaderParsed; }
+};
+
+/*
+ * INetMessageIOStream Interface.
+ */
+class INetMessageIOStream
+ : public INetMessageIStream,
+ public INetMessageOStream
+{
+ // Not implemented.
+ INetMessageIOStream (const INetMessageIOStream& rStrm);
+ INetMessageIOStream& operator= (const INetMessageIOStream& rStrm);
+
+public:
+ INetMessageIOStream (ULONG nBufferSize = 2048);
+ virtual ~INetMessageIOStream (void);
+};
+
+/*=========================================================================
+ *
+ * INetMIMEMessageStream Interface.
+ *
+ *=======================================================================*/
+enum INetMessageEncoding
+{
+ INETMSG_ENCODING_7BIT,
+ INETMSG_ENCODING_8BIT,
+ INETMSG_ENCODING_BINARY,
+ INETMSG_ENCODING_QUOTED,
+ INETMSG_ENCODING_BASE64
+};
+
+class TOOLS_DLLPUBLIC INetMIMEMessageStream : public INetMessageIOStream
+{
+ int eState;
+
+ ULONG nChildIndex;
+ INetMIMEMessageStream *pChildStrm;
+
+ INetMessageEncoding eEncoding;
+ INetMessageIStream *pEncodeStrm;
+ INetMessageOStream *pDecodeStrm;
+
+ SvMemoryStream *pMsgBuffer;
+
+ static INetMessageEncoding GetMsgEncoding (
+ const String& rContentType);
+
+ // Not implemented.
+ INetMIMEMessageStream (const INetMIMEMessageStream& rStrm);
+ INetMIMEMessageStream& operator= (const INetMIMEMessageStream& rStrm);
+
+protected:
+ virtual int GetMsgLine (sal_Char *pData, ULONG nSize);
+ virtual int PutMsgLine (const sal_Char *pData, ULONG nSize);
+
+public:
+ INetMIMEMessageStream (ULONG nBufferSize = 2048);
+ virtual ~INetMIMEMessageStream (void);
+
+ using INetMessageIStream::SetSourceMessage;
+ void SetSourceMessage (INetMIMEMessage *pMsg)
+ {
+ INetMessageIStream::SetSourceMessage ((INetMessage *)pMsg);
+ }
+ INetMIMEMessage *GetSourceMessage (void) const
+ {
+ return ((INetMIMEMessage *)INetMessageIStream::GetSourceMessage());
+ }
+
+ using INetMessageOStream::SetTargetMessage;
+ void SetTargetMessage (INetMIMEMessage *pMsg)
+ {
+ INetMessageOStream::SetTargetMessage ((INetMessage *)pMsg);
+ }
+ INetMIMEMessage *GetTargetMessage (void) const
+ {
+ return ((INetMIMEMessage *)INetMessageOStream::GetTargetMessage());
+ }
+};
+
+#endif /* !_TOOLS_INETSTRM_HXX */
+
diff --git a/tools/inc/tools/iparser.hxx b/tools/inc/tools/iparser.hxx
new file mode 100644
index 000000000000..97f5b5fc2370
--- /dev/null
+++ b/tools/inc/tools/iparser.hxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: iparser.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-04-11 20:13:06 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 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
+ *
+ ************************************************************************/
+#ifndef IPARSER_HXX
+#define IPARSER_HXX
+
+#include <tools/string.hxx>
+#include <tools/link.hxx>
+#include <tools/stream.hxx>
+#ifndef INCLUDED_TOOLSDLLAPI_H
+#include "tools/toolsdllapi.h"
+#endif
+
+// forwards
+class Dir;
+class GenericInformation;
+class GenericInformationList;
+
+//
+// class InformationParser
+//
+
+/******************************************************************************
+Purpose: reads generic information files into a simple structure in memory
+******************************************************************************/
+
+// information files used by this parser have following format:
+
+/*
+
+key [value]
+{
+ key [value]
+ key [value]
+ {
+ key [value]
+ ...
+ ...
+ }
+}
+key [value]
+...
+...
+
+*/
+
+#define DEF_STAND_LST "\\\\dev4\\data1\\b_server\\config\\stand.lst"
+
+// error codes:
+
+#define IP_NO_ERROR 0x0000
+#define IP_UNEXPECTED_EOF 0x0001
+
+#define REPLACE_VARIABLES TRUE
+
+class TOOLS_DLLPUBLIC InformationParser
+{
+private:
+ BOOL bRecover;
+ ByteString sOldLine;
+
+ ByteString sCurrentComment;
+
+ BOOL bReplaceVariables; // meaning %UPD and %VERSION
+ USHORT nLevel;
+ ByteString sUPD;
+ ByteString sVersion;
+
+ Link aStatusLink;
+ SvStream *pActStream;
+ UniString sStreamName;
+
+ USHORT nErrorCode;
+ ULONG nErrorLine;
+ ByteString sErrorText;
+ ULONG nActLine;
+
+ // methods
+ TOOLS_DLLPRIVATE ByteString &ReadLine();
+ TOOLS_DLLPRIVATE GenericInformation *ReadKey( GenericInformationList *pExistingList );
+ inline void Recover();
+
+protected:
+ BOOL Save( SvStream &rOutStream,
+ const GenericInformationList *pSaveList, USHORT nLevel, BOOL bStripped );
+ GenericInformationList *Execute( SvStream &rSourceStream,
+ GenericInformationList *pExistingList );
+ virtual void PrintStatus( ByteString &rStatus )
+ { if ( aStatusLink.IsSet()) aStatusLink.Call( &rStatus ); }
+
+public:
+ InformationParser( BOOL bReplace = FALSE );
+ virtual ~InformationParser();
+
+ // the following methods return NULL if any errors are detected
+
+ // reads a information file and stores the data in a
+ // GenericInformationList
+ GenericInformationList *Execute( SvMemoryStream &rSourceStream,
+ GenericInformationList *pExistingList = NULL );
+ GenericInformationList *Execute( SvFileStream &rSourceStream,
+ GenericInformationList *pExistingList = NULL );
+ GenericInformationList *Execute( UniString &rSourceFile,
+ GenericInformationList *pExistingList = NULL );
+ // reads all information files in the dir and stores the data in a
+ // GenericInformationList => first key is the filename
+ GenericInformationList *Execute( Dir &rDir,
+ GenericInformationList *pExistingList = NULL );
+
+ // save the InfrormationList to rSourceFile
+ // returns FALSE on error
+ BOOL Save( SvFileStream &rSourceStream,
+ const GenericInformationList *pSaveList );
+ BOOL Save( SvMemoryStream &rSourceStream,
+ const GenericInformationList *pSaveList );
+ BOOL Save( const UniString &rSourceFile,
+ const GenericInformationList *pSaveList );
+
+ USHORT GetErrorCode();
+ ByteString &GetErrorText();
+
+ void SetStatusHdl( const Link &rHdl ) { aStatusLink = rHdl; }
+};
+
+#endif
+
diff --git a/tools/inc/tools/isofallback.hxx b/tools/inc/tools/isofallback.hxx
new file mode 100644
index 000000000000..4ff8654e484f
--- /dev/null
+++ b/tools/inc/tools/isofallback.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: isofallback.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-04-11 20:13:16 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 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
+ *
+ ************************************************************************/
+
+#ifndef _ISOFALLBACK_HXX
+#define _ISOFALLBACK_HXX
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+#ifndef INCLUDED_TOOLSDLLAPI_H
+#include "tools/toolsdllapi.h"
+#endif
+
+// Return true if valid fallback found
+TOOLS_DLLPUBLIC sal_Bool GetIsoFallback( ByteString& rLanguage );
+
+#endif //_ISOFALLBACK_HXX
+