trunk: sync from 1.4.3

make & cmake fixes
This commit is contained in:
Marian Krivos
2012-02-04 17:03:09 +00:00
parent 0afd04898b
commit 8b70c37260
55 changed files with 2797 additions and 2229 deletions

View File

@@ -1,124 +1,142 @@
//
// ApacheStream.h
//
// $Id: //poco/Main/ApacheConnector/src/ApacheStream.cpp#9 $
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// All rights reserved.
//
// This is unpublished proprietary source code of Applied Informatics.
// The contents of this file may not be disclosed to third parties,
// copied or duplicated in any form, in whole or in part.
//
#include "ApacheStream.h"
#include "ApacheConnector.h"
#include "Poco/Exception.h"
using Poco::BufferedStreamBuf;
//
// ApacheStreamBuf
//
ApacheStreamBuf::ApacheStreamBuf(ApacheRequestRec* pApacheRequest, bool haveData):
BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in | std::ios::out),
_pApacheRequest(pApacheRequest),
_haveData(haveData)
{
}
ApacheStreamBuf::~ApacheStreamBuf()
{
}
int ApacheStreamBuf::readFromDevice(char* buffer, std::streamsize len)
{
if (_haveData)
return _pApacheRequest->readRequest(buffer, static_cast<int>(len));
else
return 0;
}
int ApacheStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
{
_pApacheRequest->writeResponse(buffer, length);
return length;
}
//
// ApacheIOS
//
ApacheIOS::ApacheIOS(ApacheRequestRec* pApacheRequest, bool haveData):
_buf(pApacheRequest, haveData)
{
poco_ios_init(&_buf);
}
ApacheIOS::~ApacheIOS()
{
try
{
_buf.sync();
}
catch (...)
{
}
}
ApacheStreamBuf* ApacheIOS::rdbuf()
{
return &_buf;
}
void ApacheIOS::close()
{
_buf.sync();
}
//
// ApacheOutputStream
//
ApacheOutputStream::ApacheOutputStream(ApacheRequestRec* pApacheRequest):
ApacheIOS(pApacheRequest),
std::ostream(&_buf)
{
}
ApacheOutputStream::~ApacheOutputStream()
{
}
//
// ApacheInputStream
//
ApacheInputStream::ApacheInputStream(ApacheRequestRec* pApacheRequest):
ApacheIOS(pApacheRequest, pApacheRequest->haveRequestBody()),
std::istream(&_buf)
{
}
ApacheInputStream::~ApacheInputStream()
{
}
//
// ApacheStream.h
//
// $Id: //poco/1.4/ApacheConnector/src/ApacheStream.cpp#2 $
//
// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#include "ApacheStream.h"
#include "ApacheConnector.h"
#include "Poco/Exception.h"
using Poco::BufferedStreamBuf;
//
// ApacheStreamBuf
//
ApacheStreamBuf::ApacheStreamBuf(ApacheRequestRec* pApacheRequest, bool haveData):
BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in | std::ios::out),
_pApacheRequest(pApacheRequest),
_haveData(haveData)
{
}
ApacheStreamBuf::~ApacheStreamBuf()
{
}
int ApacheStreamBuf::readFromDevice(char* buffer, std::streamsize len)
{
if (_haveData)
return _pApacheRequest->readRequest(buffer, static_cast<int>(len));
else
return 0;
}
int ApacheStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
{
_pApacheRequest->writeResponse(buffer, length);
return length;
}
//
// ApacheIOS
//
ApacheIOS::ApacheIOS(ApacheRequestRec* pApacheRequest, bool haveData):
_buf(pApacheRequest, haveData)
{
poco_ios_init(&_buf);
}
ApacheIOS::~ApacheIOS()
{
try
{
_buf.sync();
}
catch (...)
{
}
}
ApacheStreamBuf* ApacheIOS::rdbuf()
{
return &_buf;
}
void ApacheIOS::close()
{
_buf.sync();
}
//
// ApacheOutputStream
//
ApacheOutputStream::ApacheOutputStream(ApacheRequestRec* pApacheRequest):
ApacheIOS(pApacheRequest),
std::ostream(&_buf)
{
}
ApacheOutputStream::~ApacheOutputStream()
{
}
//
// ApacheInputStream
//
ApacheInputStream::ApacheInputStream(ApacheRequestRec* pApacheRequest):
ApacheIOS(pApacheRequest, pApacheRequest->haveRequestBody()),
std::istream(&_buf)
{
}
ApacheInputStream::~ApacheInputStream()
{
}