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 // XMLStreamParserException.h
/// \file XMLStreamException.h //
/// // $Id$
/// \author Marian Krivos <marian.krivos@rsys.sk> //
/// \date Aug 21, 2015 - 6:52:24 PM // Library: XML
/// \brief definicia typu // Package: XML
/// // Module: XMLStreamParserException
/// (C) Copyright 2015 R-SYS,s.r.o //
/// All rights reserved. // 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_ #ifndef POCO_XML_XMLSTREAMPARSEREXCEPTION_H_
#define POCO_XML_XMLSTREAMPARSEREXCEPTION_H_ #define POCO_XML_XMLSTREAMPARSEREXCEPTION_H_
@@ -26,9 +33,7 @@ public Poco::XML::XMLException
{ {
public: public:
XMLStreamParserException(const std::string& name, Poco::UInt64 line, Poco::UInt64 column, const std::string& description); XMLStreamParserException(const std::string& name, Poco::UInt64 line, Poco::UInt64 column, const std::string& description);
XMLStreamParserException(const XMLStreamParser&, const std::string& description); XMLStreamParserException(const XMLStreamParser&, const std::string& description);
virtual ~XMLStreamParserException() throw (); virtual ~XMLStreamParserException() throw ();
const char* name() const throw(); const char* name() const throw();

View File

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

View File

@@ -1,14 +1,21 @@
/// //
/// \package metamodel // XMLStreamSerializerException.h
/// \file XMLStreamException.h //
/// // $Id$
/// \author Marian Krivos <marian.krivos@rsys.sk> //
/// \date Aug 21, 2015 - 6:52:24 PM // Library: XML
/// \brief definicia typu // Package: XML
/// // Module: XMLStreamSerializerException
/// (C) Copyright 2015 R-SYS,s.r.o //
/// All rights reserved. // 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_ #ifndef POCO_XML_XMLSTREAMSERIALIZEREXCEPTION_H_
#define POCO_XML_XMLSTREAMSERIALIZEREXCEPTION_H_ #define POCO_XML_XMLSTREAMSERIALIZEREXCEPTION_H_
@@ -24,10 +31,9 @@ class XMLStreamSerializer;
struct XML_API XMLStreamSerializerException: struct XML_API XMLStreamSerializerException:
public Poco::XML::XMLException public Poco::XML::XMLException
{ {
virtual ~XMLStreamSerializerException() throw ();
XMLStreamSerializerException(const std::string& name, const std::string& description); XMLStreamSerializerException(const std::string& name, const std::string& description);
XMLStreamSerializerException(const XMLStreamSerializer&, const std::string& description); XMLStreamSerializerException(const XMLStreamSerializer&, const std::string& description);
virtual ~XMLStreamSerializerException() throw ();
const char* name() const throw (); const char* name() const throw ();
const std::string& description() const; const std::string& description() const;

View File

@@ -1,14 +1,21 @@
/// //
/// \package metamodel // XMLStreamParserException.cpp
/// \file XMLStreamException.cpp //
/// // $Id$
/// \author Marian Krivos <marian.krivos@rsys.sk> //
/// \date Aug 21, 2015 - 6:52:24 PM // Library: XML
/// \brief definicia typu // Package: XML
/// // Module: XMLStreamParserException
/// (C) Copyright 2015 R-SYS,s.r.o //
/// All rights reserved. // 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/XMLStreamParserException.h"
#include "Poco/XML/XMLStreamParser.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 // copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file // license : MIT; see accompanying LICENSE file
#include "Poco/XML/XMLStreamSerializer.h" #include "Poco/XML/XMLStreamSerializer.h"
#include "Poco/XML/XMLStreamSerializerException.h" #include "Poco/XML/XMLStreamSerializerException.h"
#include <new> // std::bad_alloc #include <new> // std::bad_alloc
#include <cstring> // std::strlen #include <cstring> // std::strlen
using namespace std; using namespace std;
namespace Poco namespace Poco
{ {
namespace XML namespace XML
{ {
extern "C" genxStatus genx_write(void* p, constUtf8 us) extern "C" genxStatus genx_write(void* p, constUtf8 us)
{ {
// It would have been easier to throw the exception directly, // 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) XMLStreamSerializer::XMLStreamSerializer(ostream& os, const string& oname, unsigned short ind) :
: _outputStream(os), _osState_(os.exceptions()), _oname(oname), _depth(0) _outputStream(os),
_lastStreamState(os.exceptions()),
_outputName(oname),
_depth(0)
{ {
// Temporarily disable exceptions on the stream. // 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 // configure the stream to throw), then fall back to the
// serialiation exception. // serialiation exception.
// //
_outputStream.exceptions(_osState_); _outputStream.exceptions(_lastStreamState);
// Fall through. // Fall through.
default: 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. // 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 const std::string& XMLStreamSerializer::outputName() const
{ {
return _oname; return _outputName;
} }
@@ -208,5 +228,6 @@ bool XMLStreamSerializer::lookupNamespacePrefix(const string& ns, string& p)
return true; return true;
} }
} }
} }

View File

@@ -1,14 +1,21 @@
/// //
/// \package metamodel // XMLStreamSerializerException.cpp
/// \file XMLStreamException.cpp //
/// // $Id$
/// \author Marian Krivos <marian.krivos@rsys.sk> //
/// \date Aug 21, 2015 - 6:52:24 PM // Library: XML
/// \brief definicia typu // Package: XML
/// // Module: XMLStreamSerializerException
/// (C) Copyright 2015 R-SYS,s.r.o //
/// All rights reserved. // 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/XMLStreamParserException.h"
#include "Poco/XML/XMLStreamSerializer.h" #include "Poco/XML/XMLStreamSerializer.h"