Formattingt fixes

This commit is contained in:
Marian Krivos
2015-08-22 22:02:41 +02:00
parent 0887b56cad
commit 81e495150c
6 changed files with 109 additions and 63 deletions

View File

@@ -1,14 +1,21 @@
///
/// \package metamodel
/// \file XMLStreamException.h
///
/// \author Marian Krivos <marian.krivos@rsys.sk>
/// \date Aug 21, 2015 - 6:52:24 PM
/// \brief definicia typu
///
/// (C) Copyright 2015 R-SYS,s.r.o
/// All rights reserved.
///
//
// XMLStreamParserException.h
//
// $Id$
//
// Library: XML
// Package: XML
// Module: XMLStreamParserException
//
// Definition of the XMLStreamParserException class.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#ifndef POCO_XML_XMLSTREAMPARSEREXCEPTION_H_
#define POCO_XML_XMLSTREAMPARSEREXCEPTION_H_
@@ -26,9 +33,7 @@ public Poco::XML::XMLException
{
public:
XMLStreamParserException(const std::string& name, Poco::UInt64 line, Poco::UInt64 column, const std::string& description);
XMLStreamParserException(const XMLStreamParser&, const std::string& description);
virtual ~XMLStreamParserException() throw ();
const char* name() const throw();

View File

@@ -1,13 +1,13 @@
//
// XMLStreamParser.h
// XMLStreamSerializer.h
//
// $Id$
//
// Library: XML
// Package: XML
// Module: XMLStreamParser
// Module: XMLStreamSerializer
//
// Definition of the XMLStreamParser class.
// Definition of the XMLStreamSerializer class.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
@@ -17,8 +17,8 @@
// license : MIT; see accompanying LICENSE file
#ifndef POCO_XML_XMLSERIALIZER_H
#define POCO_XML_XMLSERIALIZER_H
#ifndef POCO_XML_XMLSERIALIZER_Included
#define POCO_XML_XMLSERIALIZER_Included
#include "QName.h"
@@ -119,8 +119,8 @@ private:
void handleError(genxStatus);
std::ostream& _outputStream;
std::ostream::iostate _osState_;// Original exception state.
const std::string _oname;
std::ostream::iostate _lastStreamState;// Original exception state.
const std::string _outputName;
genxWriter _writer;
genxSender _sender;

View File

@@ -1,14 +1,21 @@
///
/// \package metamodel
/// \file XMLStreamException.h
///
/// \author Marian Krivos <marian.krivos@rsys.sk>
/// \date Aug 21, 2015 - 6:52:24 PM
/// \brief definicia typu
///
/// (C) Copyright 2015 R-SYS,s.r.o
/// All rights reserved.
///
//
// XMLStreamSerializerException.h
//
// $Id$
//
// Library: XML
// Package: XML
// Module: XMLStreamSerializerException
//
// Definition of the XMLStreamSerializerException class.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#ifndef POCO_XML_XMLSTREAMSERIALIZEREXCEPTION_H_
#define POCO_XML_XMLSTREAMSERIALIZEREXCEPTION_H_
@@ -24,10 +31,9 @@ class XMLStreamSerializer;
struct XML_API XMLStreamSerializerException:
public Poco::XML::XMLException
{
virtual ~XMLStreamSerializerException() throw ();
XMLStreamSerializerException(const std::string& name, const std::string& description);
XMLStreamSerializerException(const XMLStreamSerializer&, const std::string& description);
virtual ~XMLStreamSerializerException() throw ();
const char* name() const throw ();
const std::string& description() const;

View File

@@ -1,14 +1,21 @@
///
/// \package metamodel
/// \file XMLStreamException.cpp
///
/// \author Marian Krivos <marian.krivos@rsys.sk>
/// \date Aug 21, 2015 - 6:52:24 PM
/// \brief definicia typu
///
/// (C) Copyright 2015 R-SYS,s.r.o
/// All rights reserved.
///
//
// XMLStreamParserException.cpp
//
// $Id$
//
// Library: XML
// Package: XML
// Module: XMLStreamParserException
//
// Definition of the XMLStreamParserException class.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#include "Poco/XML/XMLStreamParserException.h"
#include "Poco/XML/XMLStreamParser.h"

View File

@@ -1,20 +1,37 @@
// file : xml/XMLStreamSerializer.cxx
//
// XMLStreamSerializer.cpp
//
// $Id$
//
// Library: XML
// Package: XML
// Module: XMLStreamSerializer
//
// Definition of the XMLStreamSerializer class.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#include "Poco/XML/XMLStreamSerializer.h"
#include "Poco/XML/XMLStreamSerializerException.h"
#include <new> // std::bad_alloc
#include <cstring> // std::strlen
using namespace std;
namespace Poco
{
namespace XML
{
extern "C" genxStatus genx_write(void* p, constUtf8 us)
{
// It would have been easier to throw the exception directly,
@@ -52,8 +69,11 @@ XMLStreamSerializer::~XMLStreamSerializer()
}
XMLStreamSerializer::XMLStreamSerializer(ostream& os, const string& oname, unsigned short ind)
: _outputStream(os), _osState_(os.exceptions()), _oname(oname), _depth(0)
XMLStreamSerializer::XMLStreamSerializer(ostream& os, const string& oname, unsigned short ind) :
_outputStream(os),
_lastStreamState(os.exceptions()),
_outputName(oname),
_depth(0)
{
// Temporarily disable exceptions on the stream.
//
@@ -97,10 +117,10 @@ void XMLStreamSerializer::handleError(genxStatus e)
// configure the stream to throw), then fall back to the
// serialiation exception.
//
_outputStream.exceptions(_osState_);
_outputStream.exceptions(_lastStreamState);
// Fall through.
default:
throw XMLStreamSerializerException(_oname, genxGetErrorMessage(_writer, e));
throw XMLStreamSerializerException(_outputName, genxGetErrorMessage(_writer, e));
}
}
@@ -128,7 +148,7 @@ void XMLStreamSerializer::endElement()
// Also restore the original exception state on the stream.
//
_outputStream.exceptions(_osState_);
_outputStream.exceptions(_lastStreamState);
}
}
@@ -149,7 +169,7 @@ void XMLStreamSerializer::startAttribute(const string& ns, const string& name)
const std::string& XMLStreamSerializer::outputName() const
{
return _oname;
return _outputName;
}
@@ -208,5 +228,6 @@ bool XMLStreamSerializer::lookupNamespacePrefix(const string& ns, string& p)
return true;
}
}
}

View File

@@ -1,14 +1,21 @@
///
/// \package metamodel
/// \file XMLStreamException.cpp
///
/// \author Marian Krivos <marian.krivos@rsys.sk>
/// \date Aug 21, 2015 - 6:52:24 PM
/// \brief definicia typu
///
/// (C) Copyright 2015 R-SYS,s.r.o
/// All rights reserved.
///
//
// XMLStreamSerializerException.cpp
//
// $Id$
//
// Library: XML
// Package: XML
// Module: XMLStreamSerializerException
//
// Definition of the XMLStreamSerializerException class.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#include "Poco/XML/XMLStreamParserException.h"
#include "Poco/XML/XMLStreamSerializer.h"