Commit 6e26de1f authored by Gustavo Carneiro's avatar Gustavo Carneiro

Move HistoryType class to a new file.

parent 88ed01d6
......@@ -82,6 +82,7 @@ set(konsoleprivate_SRCS ${sessionadaptors_SRCS}
CompactHistoryBlockList.cpp
CompactHistoryLine.cpp
CompactHistoryScroll.cpp
HistoryType.cpp
HistorySizeDialog.cpp
widgets/HistorySizeWidget.cpp
widgets/IncrementalSearchBar.cpp
......
......@@ -60,15 +60,6 @@ using namespace Konsole;
at constant costs.
*/
//////////////////////////////////////////////////////////////////////
// History Types
//////////////////////////////////////////////////////////////////////
HistoryType::HistoryType() = default;
HistoryType::~HistoryType() = default;
//////////////////////////////
HistoryTypeNone::HistoryTypeNone() = default;
bool HistoryTypeNone::isEnabled() const
......
......@@ -41,6 +41,7 @@
#include "CompactHistoryBlockList.h"
#include "CompactHistoryLine.h"
#include "CompactHistoryScroll.h"
#include "HistoryType.h"
// Konsole
#include "Character.h"
......@@ -53,40 +54,6 @@ namespace Konsole {
// where history lines are allocated in (avoids heap fragmentation)
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// History type
//////////////////////////////////////////////////////////////////////
class KONSOLEPRIVATE_EXPORT HistoryType
{
public:
HistoryType();
virtual ~HistoryType();
/**
* Returns true if the history is enabled ( can store lines of output )
* or false otherwise.
*/
virtual bool isEnabled() const = 0;
/**
* Returns the maximum number of lines which this history type
* can store or -1 if the history can store an unlimited number of lines.
*/
virtual int maximumLineCount() const = 0;
/**
* Converts from one type of HistoryScroll to another or if given the
* same type, returns it.
*/
virtual HistoryScroll *scroll(HistoryScroll *) const = 0;
/**
* Returns true if the history size is unlimited.
*/
bool isUnlimited() const
{
return maximumLineCount() == -1;
}
};
class KONSOLEPRIVATE_EXPORT HistoryTypeNone : public HistoryType
{
public:
......
/*
This file is part of Konsole, an X terminal.
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#include "HistoryType.h"
using namespace Konsole;
HistoryType::HistoryType() = default;
HistoryType::~HistoryType() = default;
bool HistoryType::isUnlimited() const
{
return maximumLineCount() == -1;
}
/*
This file is part of Konsole, an X terminal.
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#ifndef HISTORYTYPE_H
#define HISTORYTYPE_H
#include "HistoryScroll.h"
#include "konsoleprivate_export.h"
namespace Konsole
{
class KONSOLEPRIVATE_EXPORT HistoryType
{
public:
HistoryType();
virtual ~HistoryType();
/**
* Returns true if the history is enabled ( can store lines of output )
* or false otherwise.
*/
virtual bool isEnabled() const = 0;
/**
* Returns the maximum number of lines which this history type
* can store or -1 if the history can store an unlimited number of lines.
*/
virtual int maximumLineCount() const = 0;
/**
* Converts from one type of HistoryScroll to another or if given the
* same type, returns it.
*/
virtual HistoryScroll *scroll(HistoryScroll *) const = 0;
/**
* Returns true if the history size is unlimited.
*/
bool isUnlimited() const;
};
}
#endif
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