Kaydet (Commit) 71baf727 authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: remove unused OutputWithDepth

This was only used by doctok.

Change-Id: Ic8f853a02af4915e3d5984a626daa7147c47d16f
üst 0f95b244
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_OUTPUT_WITH_DEPTH
#define INCLUDED_OUTPUT_WITH_DEPTH
#include <vector>
#include <iostream>
namespace writerfilter
{
using namespace ::std;
template <typename T>
class OutputWithDepth
{
typedef ::std::vector<T> Group_t;
Group_t mGroup;
unsigned int mnCurrentDepth;
unsigned int mnGroupDepth;
T mOpenTag;
T mCloseTag;
protected:
virtual void output(const T & aItem) const = 0;
void outputGroup();
void finalize();
public:
OutputWithDepth(const T & aOpenTag, const T & aCloseTag);
virtual ~OutputWithDepth();
void openGroup();
void closeGroup();
void addItem(const T & aItem);
void setDepth(unsigned int nDepth);
};
template <typename T>
OutputWithDepth<T>::OutputWithDepth(const T & aOpenTag, const T & aEndTag)
: mnCurrentDepth(0)
, mnGroupDepth(0)
, mOpenTag(aOpenTag)
, mCloseTag(aEndTag)
{
}
template <typename T>
OutputWithDepth<T>::~OutputWithDepth()
{
}
template <typename T>
void OutputWithDepth<T>::finalize()
{
outputGroup();
}
template <typename T>
void OutputWithDepth<T>::openGroup()
{
outputGroup();
mnGroupDepth = 0;
}
template <typename T>
void OutputWithDepth<T>::closeGroup()
{
if (mnGroupDepth > mnCurrentDepth)
for (unsigned int i = 0; i < mnGroupDepth - mnCurrentDepth; ++i)
output(mOpenTag);
else if (mnGroupDepth < mnCurrentDepth)
for (unsigned int i = 0; i < mnCurrentDepth - mnGroupDepth; ++i)
output(mCloseTag);
outputGroup();
mnCurrentDepth = mnGroupDepth;
}
template <typename T>
void OutputWithDepth<T>::addItem(const T & aItem)
{
mGroup.push_back(aItem);
}
template <typename T>
void OutputWithDepth<T>::setDepth(unsigned int nDepth)
{
mnGroupDepth = nDepth;
}
template <typename T>
void OutputWithDepth<T>::outputGroup()
{
typename Group_t::iterator aItEnd = mGroup.end();
for (typename Group_t::iterator aIt = mGroup.begin(); aIt != aItEnd; aIt++)
{
output(*aIt);
}
mGroup.clear();
}
}
#endif // INCLUDED_OUTPUT_WITH_DEPTH
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <ctype.h> #include <ctype.h>
#include "exceptions.hxx" #include "exceptions.hxx"
#include <WriterFilterDllApi.hxx> #include <WriterFilterDllApi.hxx>
#include <resourcemodel/OutputWithDepth.hxx>
namespace writerfilter { namespace writerfilter {
using namespace ::std; using namespace ::std;
...@@ -36,10 +35,6 @@ using namespace ::std; ...@@ -36,10 +35,6 @@ using namespace ::std;
template <class T> template <class T>
class SubSequence; class SubSequence;
template <typename T>
void dumpLine(OutputWithDepth<string> & o, SubSequence<T> & rSeq,
sal_uInt32 nOffset, sal_uInt32 nStep);
template <class T> template <class T>
class SubSequence class SubSequence
{ {
...@@ -185,44 +180,6 @@ public: ...@@ -185,44 +180,6 @@ public:
o << "</sequence>" << endl; o << "</sequence>" << endl;
} }
void dump(OutputWithDepth<string> & o)
{
{
char sBuffer[256];
snprintf(sBuffer, sizeof(sBuffer),
"<sequence id='%p' offset='%" SAL_PRIxUINT32 "' count='%" SAL_PRIxUINT32 "'>",
mpSequence.get(), mnOffset, mnCount);
o.addItem(sBuffer);
}
sal_uInt32 n = 0;
sal_uInt32 nStep = 16;
try
{
sal_uInt32 nCount = getCount();
while (n < nCount)
{
sal_uInt32 nBytes = nCount - n;
if (nBytes > nStep)
nBytes = nStep;
SubSequence<T> aSeq(*this, n, nBytes);
dumpLine(o, aSeq, n, nStep);
n += nBytes;
}
}
catch (...)
{
o.addItem("<exception/>");
}
o.addItem("</sequence>");
}
string toString() const string toString() const
{ {
sal_uInt32 n = 0; sal_uInt32 n = 0;
...@@ -283,61 +240,6 @@ public: ...@@ -283,61 +240,6 @@ public:
} }
}; };
template <typename T>
void dumpLine(OutputWithDepth<string> & o, SubSequence<T> & rSeq,
sal_uInt32 nOffset, sal_uInt32 nStep)
{
sal_uInt32 nCount = rSeq.getCount();
char sBuffer[256];
string tmpStr = "<line>";
snprintf(sBuffer, 255, "%08" SAL_PRIxUINT32 ": ", nOffset);
tmpStr += sBuffer;
for (sal_uInt32 i = 0; i < nStep; i++)
{
if (i < nCount)
{
snprintf(sBuffer, 255, "%02x ", rSeq[i]);
tmpStr += sBuffer;
}
else
tmpStr += " ";
if (i % 8 == 7)
tmpStr += " ";
}
{
for (sal_uInt32 i = 0; i < nStep; i++)
{
if (i < nCount)
{
unsigned char c =
static_cast<unsigned char>(rSeq[i]);
if (c=='&')
tmpStr += "&amp;";
else if (c=='<')
tmpStr += "&lt;";
else if (c=='>')
tmpStr += "&gt;";
else if (c < 128 && isprint(c))
tmpStr += c;
else
tmpStr += ".";
}
}
}
tmpStr += "</line>";
o.addItem(tmpStr);
}
} }
#endif // INCLUDED_SUB_SEQUENCE_HXX #endif // INCLUDED_SUB_SEQUENCE_HXX
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Any.hxx>
#include <WriterFilterDllApi.hxx> #include <WriterFilterDllApi.hxx>
#include <resourcemodel/OutputWithDepth.hxx>
/** /**
@file WW8ResourceModel.hxx @file WW8ResourceModel.hxx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment