createBlankArray + destroyBlankArray

This commit is contained in:
Markus Gans 2018-10-20 22:50:35 +02:00
parent 258380ae57
commit 689199efe2
19 changed files with 128 additions and 249 deletions

View File

@ -265,7 +265,6 @@ void FButton::hide()
{
std::size_t s, f, size;
short fg, bg;
char* blank;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -288,18 +287,7 @@ void FButton::hide()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', size);
blank[size] = '\0';
char* blank = createBlankArray(size + 1);
for (std::size_t y = 0; y < getHeight() + s + (f << 1); y++)
{
@ -307,7 +295,7 @@ void FButton::hide()
print (blank);
}
delete[] blank;
destroyBlankArray (blank);
}
//----------------------------------------------------------------------

View File

@ -191,7 +191,6 @@ void FButtonGroup::hide()
{
std::size_t size;
short fg, bg;
char* blank;
FWidget::hide();
FWidget* parent_widget = getParentWidget();
@ -226,18 +225,7 @@ void FButtonGroup::hide()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', size);
blank[size] = '\0';
char* blank = createBlankArray(size + 1);
for (int y = 0; y < int(getHeight()); y++)
{
@ -245,7 +233,7 @@ void FButtonGroup::hide()
print (blank);
}
delete[] blank;
destroyBlankArray (blank);
}
//----------------------------------------------------------------------

View File

@ -243,7 +243,6 @@ void FLabel::hide()
{
short fg, bg;
std::size_t size;
char* blank;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -265,21 +264,10 @@ void FLabel::hide()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', size);
blank[getWidth()] = '\0';
char* blank = createBlankArray(size + 1);
setPrintPos (1, 1);
print (blank);
delete[] blank;
destroyBlankArray (blank);
}
//----------------------------------------------------------------------

View File

@ -283,7 +283,6 @@ void FLineEdit::hide()
{
std::size_t s, size;
short fg, bg;
char* blank;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -306,18 +305,7 @@ void FLineEdit::hide()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', size);
blank[size] = '\0';
char* blank = createBlankArray(size + 1);
for (std::size_t y = 0; y < getHeight() + s; y++)
{
@ -325,7 +313,7 @@ void FLineEdit::hide()
print (blank);
}
delete[] blank;
destroyBlankArray(blank);
if ( label )
label->hide();

View File

@ -169,16 +169,16 @@ void FListBox::showInsideBrackets ( std::size_t index
if ( b == fc::NoBrackets )
return;
int len = int(iter->getText().getLength() + 2);
std::size_t len = iter->getText().getLength() + 2;
if ( len > max_line_width )
{
max_line_width = len;
if ( len >= int(getWidth()) - nf_offset - 3 )
if ( len >= getWidth() - nf_offset - 3 )
{
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4));
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
hbar->setValue (xoffset);
if ( ! hbar->isVisible() )
@ -197,7 +197,7 @@ void FListBox::setGeometry (int x, int y, std::size_t w, std::size_t h, bool adj
if ( isNewFont() )
{
vbar->setGeometry (int(getWidth()), 2, 2, getHeight() - 2);
hbar->setGeometry (1, int(getHeight()), getWidth() - 2 - std::size_t(nf_offset), 1);
hbar->setGeometry (1, int(getHeight()), getWidth() - 2 - nf_offset, 1);
}
else
{
@ -242,9 +242,7 @@ void FListBox::hide()
{
std::size_t n, size;
short fg, bg;
char* blank;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
if ( parent_widget )
@ -265,18 +263,7 @@ void FListBox::hide()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset (blank, ' ', size);
blank[size] = '\0';
char* blank = createBlankArray(size + 1);
for (int y = 0; y < int(getHeight()); y++)
{
@ -284,19 +271,19 @@ void FListBox::hide()
print (blank);
}
delete[] blank;
destroyBlankArray (blank);
}
//----------------------------------------------------------------------
void FListBox::insert (FListBoxItem listItem)
{
int len = int(listItem.text.getLength());
std::size_t len = listItem.text.getLength();
bool has_brackets = bool(listItem.brackets);
recalculateHorizontalBar (len, has_brackets);
itemlist.push_back (listItem);
int element_count = int(getCount());
std::size_t element_count = getCount();
recalculateVerticalBar (element_count);
}
@ -337,7 +324,7 @@ void FListBox::remove (std::size_t item)
while ( iter != itemlist.end() )
{
int len = int(iter->getText().getLength());
std::size_t len = iter->getText().getLength();
if ( len > max_line_width )
max_line_width = len;
@ -345,10 +332,10 @@ void FListBox::remove (std::size_t item)
++iter;
}
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4));
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
if ( hbar->isVisible() && max_line_width < int(getWidth()) - nf_offset - 3 )
if ( hbar->isVisible() && max_line_width < getWidth() - nf_offset - 3 )
hbar->hide();
vbar->setMaximum (int(element_count - getHeight()) + 2);
@ -374,10 +361,7 @@ void FListBox::remove (std::size_t item)
void FListBox::clear()
{
std::size_t size;
char* blank;
itemlist.clear();
current = 0;
xoffset = 0;
yoffset = 0;
@ -400,15 +384,7 @@ void FListBox::clear()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
char* blank = createBlankArray(size + 1);
std::memset (blank, ' ', size);
blank[size] = '\0';
@ -419,7 +395,7 @@ void FListBox::clear()
print (blank);
}
delete[] blank;
destroyBlankArray (blank);
}
//----------------------------------------------------------------------
@ -823,10 +799,10 @@ void FListBox::adjustSize()
vbar->setHeight (getClientHeight(), false);
vbar->resize();
hbar->setMaximum (max_line_width - int(getClientWidth()) + 2);
hbar->setPageSize (max_line_width, int(getClientWidth()) - 2);
hbar->setMaximum (int(max_line_width - getClientWidth() + 2));
hbar->setPageSize (int(max_line_width), int(getClientWidth()) - 2);
hbar->setY (int(getHeight()));
hbar->setWidth (getClientWidth() + std::size_t(nf_offset), false);
hbar->setWidth (getClientWidth() + nf_offset, false);
hbar->resize();
if ( element_count <= getClientHeight() )
@ -834,7 +810,7 @@ void FListBox::adjustSize()
else
vbar->setVisible();
if ( max_line_width < int(getClientWidth()) - 1 )
if ( max_line_width < getClientWidth() - 1 )
hbar->hide();
else
hbar->setVisible();
@ -890,7 +866,7 @@ void FListBox::init()
setTopPadding(1);
setLeftPadding(1);
setBottomPadding(1);
setRightPadding(1 + nf_offset);
setRightPadding(1 + int(nf_offset));
}
//----------------------------------------------------------------------
@ -1043,8 +1019,8 @@ inline void FListBox::drawListLine ( int y
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
bool isFocus = ((flags & fc::focus) != 0);
FString element;
element = getString(iter).mid ( uInt(1 + xoffset)
, uInt(getWidth() - std::size_t(nf_offset) - 4) );
element = getString(iter).mid ( std::size_t(1 + xoffset)
, getWidth() - nf_offset - 4 );
const wchar_t* const& element_str = element.wc_str();
len = element.getLength();
@ -1072,7 +1048,7 @@ inline void FListBox::drawListLine ( int y
i++;
}
for (; i < getWidth() - std::size_t(nf_offset) - 3; i++)
for (; i < getWidth() - nf_offset - 3; i++)
print (' ');
}
@ -1153,11 +1129,11 @@ inline void FListBox::drawListBracketsLine ( int y
printLeftBracket (iter->brackets);
element = getString(iter).mid ( std::size_t(xoffset) + 1
, getWidth() - std::size_t(nf_offset) - 5 );
, getWidth() - nf_offset - 5 );
}
else
element = getString(iter).mid ( std::size_t(xoffset)
, getWidth() - std::size_t(nf_offset) - 4 );
, getWidth() - nf_offset - 4 );
const wchar_t* const& element_str = element.wc_str();
len = element.getLength();
@ -1177,7 +1153,7 @@ inline void FListBox::drawListBracketsLine ( int y
full_length = getString(iter).getLength();
if ( b + i < getWidth() - std::size_t(nf_offset) - 4
if ( b + i < getWidth() - nf_offset - 4
&& std::size_t(xoffset) <= full_length + 1 )
{
if ( serach_mark && i == inc_len )
@ -1194,7 +1170,7 @@ inline void FListBox::drawListBracketsLine ( int y
i++;
}
for (; b + i < getWidth() - std::size_t(nf_offset) - 3; i++)
for (; b + i < getWidth() - nf_offset - 3; i++)
print (' ');
}
@ -1310,7 +1286,7 @@ inline void FListBox::updateDrawing (bool draw_vbar, bool draw_hbar)
}
//----------------------------------------------------------------------
void FListBox::recalculateHorizontalBar (int len, bool has_brackets)
void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets)
{
if ( has_brackets )
len += 2;
@ -1320,10 +1296,10 @@ void FListBox::recalculateHorizontalBar (int len, bool has_brackets)
max_line_width = len;
if ( len >= int(getWidth()) - nf_offset - 3 )
if ( len >= getWidth() - nf_offset - 3 )
{
hbar->setMaximum (max_line_width - int(getWidth()) + nf_offset + 4);
hbar->setPageSize (max_line_width, int(getWidth()) - nf_offset - 4);
hbar->setMaximum (int(max_line_width - getWidth() + nf_offset + 4));
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
hbar->calculateSliderValues();
if ( ! hbar->isVisible() )
@ -1332,13 +1308,13 @@ void FListBox::recalculateHorizontalBar (int len, bool has_brackets)
}
//----------------------------------------------------------------------
void FListBox::recalculateVerticalBar (int element_count)
void FListBox::recalculateVerticalBar (std::size_t element_count)
{
vbar->setMaximum (element_count - int(getHeight()) + 2);
vbar->setPageSize (element_count, int(getHeight()) - 2);
vbar->setMaximum (int(element_count - getHeight() + 2));
vbar->setPageSize (int(element_count), int(getHeight()) - 2);
vbar->calculateSliderValues();
if ( ! vbar->isVisible() && element_count >= int(getHeight()) - 1 )
if ( ! vbar->isVisible() && element_count >= getHeight() - 1 )
vbar->setVisible();
}
@ -1595,16 +1571,16 @@ void FListBox::nextListItem (int distance)
//----------------------------------------------------------------------
void FListBox::scrollToX (int val)
{
static const int padding_space = 2; // 1 leading space + 1 trailing space
int xoffset_end = max_line_width - int(getClientWidth()) + padding_space;
static const std::size_t padding_space = 2; // 1 leading space + 1 trailing space
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
if ( xoffset == val )
return;
xoffset = val;
if ( xoffset > xoffset_end )
xoffset = xoffset_end;
if ( xoffset > int(xoffset_end) )
xoffset = int(xoffset_end);
if ( xoffset < 0 )
xoffset = 0;
@ -1652,15 +1628,15 @@ void FListBox::scrollLeft (int distance)
//----------------------------------------------------------------------
void FListBox::scrollRight (int distance)
{
static const int padding_space = 2; // 1 leading space + 1 trailing space
int xoffset_end = max_line_width - int(getClientWidth()) + padding_space;
static const std::size_t padding_space = 2; // 1 leading space + 1 trailing space
std::size_t xoffset_end = max_line_width - getClientWidth() + padding_space;
xoffset += distance;
if ( xoffset == xoffset_end )
if ( xoffset == int(xoffset_end) )
return;
if ( xoffset > xoffset_end )
xoffset = xoffset_end;
if ( xoffset > int(xoffset_end) )
xoffset = int(xoffset_end);
if ( xoffset < 0 )
xoffset = 0;
@ -1923,7 +1899,7 @@ void FListBox::lazyConvert(listBoxItems::iterator iter, int y)
return;
convertToItem (*iter, source_container, y + yoffset);
int len = int(iter->text.getLength());
std::size_t len = iter->text.getLength();
recalculateHorizontalBar (len, hasBrackets(iter));
if ( hbar->isVisible() )

View File

@ -343,7 +343,7 @@ void FListViewItem::collapse()
// private methods of FListView
//----------------------------------------------------------------------
template<typename Compare>
template <typename Compare>
void FListViewItem::sort (Compare cmp)
{
if ( ! expandable )
@ -1429,7 +1429,7 @@ void FListView::init()
}
//----------------------------------------------------------------------
template<typename Compare>
template <typename Compare>
void FListView::sort (Compare cmp)
{
// Sort the top level
@ -1462,7 +1462,7 @@ std::size_t FListView::getAlignOffset ( fc::text_alignment align
case fc::alignCenter:
if ( txt_length < width )
return std::size_t((width - txt_length) / 2);
return (width - txt_length) / 2;
else
return 0;

View File

@ -64,29 +64,15 @@ void FMenuBar::resetMenu()
void FMenuBar::hide()
{
short fg, bg;
char* blank;
FWindow::hide();
fg = wc.term_fg;
bg = wc.term_bg;
setColor (fg, bg);
screenWidth = getDesktopWidth();
try
{
blank = new char[screenWidth + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', screenWidth);
blank[screenWidth] = '\0';
char* blank = createBlankArray (screenWidth + 1);
setPrintPos (1, 1);
print (blank);
delete[] blank;
destroyBlankArray (blank);
}
//----------------------------------------------------------------------

View File

@ -724,7 +724,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
}
//----------------------------------------------------------------------
template<class T>
template <typename T>
void FMenuItem::passMouseEvent ( T widget, FMouseEvent* ev
, fc::events ev_type )
{

View File

@ -100,7 +100,6 @@ void FProgressbar::hide()
{
std::size_t s, size;
short fg, bg;
char* blank;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -123,18 +122,7 @@ void FProgressbar::hide()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', size);
blank[size] = '\0';
char* blank = createBlankArray(size + 1);
for (std::size_t y = 0; y < getHeight() + s; y++)
{
@ -142,7 +130,7 @@ void FProgressbar::hide()
print (blank);
}
delete[] blank;
destroyBlankArray (blank);
setPrintPos (int(getWidth()) - 4, 0);
print (" "); // hide percentage
}

View File

@ -197,29 +197,15 @@ bool FStatusBar::hasActivatedKey()
void FStatusBar::hide()
{
short fg, bg;
char* blank;
FWindow::hide();
fg = wc.term_fg;
bg = wc.term_bg;
setColor (fg, bg);
screenWidth = getDesktopWidth();
try
{
blank = new char[screenWidth + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', screenWidth);
blank[screenWidth] = '\0';
char* blank = createBlankArray(screenWidth + 1);
setPrintPos (1, 1);
print (blank);
delete[] blank;
destroyBlankArray (blank);
}
//----------------------------------------------------------------------

View File

@ -195,7 +195,6 @@ void FTextView::hide()
{
std::size_t n, size;
short fg, bg;
char* blank;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
@ -218,18 +217,7 @@ void FTextView::hide()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', size);
blank[size] = '\0';
char* blank = createBlankArray(size + 1);
for (std::size_t y = 0; y < getHeight(); y++)
{
@ -237,7 +225,7 @@ void FTextView::hide()
print (blank);
}
delete[] blank;
destroyBlankArray (blank);
flush_out();
}
@ -325,8 +313,6 @@ void FTextView::replaceRange (const FString& str, int from, int to)
void FTextView::clear()
{
std::size_t size;
char* blank;
data.clear();
xoffset = 0;
yoffset = 0;
@ -347,18 +333,7 @@ void FTextView::clear()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', size);
blank[size] = '\0';
char* blank = createBlankArray(size + 1);
for (int y = 0; y < int(getTextHeight()); y++)
{
@ -366,7 +341,7 @@ void FTextView::clear()
print (blank);
}
delete[] blank;
destroyBlankArray (blank);
processChanged();
}

View File

@ -219,9 +219,7 @@ void FToggleButton::hide()
{
std::size_t size;
short fg, bg;
char* blank;
FWidget* parent_widget = getParentWidget();
FWidget::hide();
if ( parent_widget )
@ -241,21 +239,10 @@ void FToggleButton::hide()
if ( size == 0 )
return;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return;
}
std::memset(blank, ' ', size);
blank[size] = '\0';
char* blank = createBlankArray(size + 1);
setPrintPos (1, 1);
print (blank);
delete[] blank;
destroyBlankArray (blank);
}
//----------------------------------------------------------------------

View File

@ -147,9 +147,9 @@ class FListBox : public FWidget
// Constructor
explicit FListBox (FWidget* = 0);
template <class Iterator, class InsertConverter>
template <typename Iterator, typename InsertConverter>
FListBox (Iterator, Iterator, InsertConverter, FWidget* = 0);
template <class Container, class LazyConverter>
template <typename Container, typename LazyConverter>
FListBox (Container, LazyConverter, FWidget* = 0);
// Destructor
@ -192,9 +192,9 @@ class FListBox : public FWidget
// Methods
virtual void hide();
template <class Iterator, class InsertConverter>
template <typename Iterator, typename InsertConverter>
void insert (Iterator, Iterator, InsertConverter);
template <class Container, class LazyConverter>
template <typename Container, typename LazyConverter>
void insert (Container, LazyConverter);
void insert (FListBoxItem);
void insert ( const FString&
@ -254,8 +254,8 @@ class FListBox : public FWidget
void setLineAttributes (int, bool, bool, bool&);
void unsetAttributes();
void updateDrawing (bool, bool);
void recalculateHorizontalBar (int, bool);
void recalculateVerticalBar (int);
void recalculateHorizontalBar (std::size_t, bool);
void recalculateVerticalBar (std::size_t);
void getWidgetFocus();
void multiSelection (std::size_t);
void multiSelectionUpTo (std::size_t);
@ -321,15 +321,15 @@ class FListBox : public FWidget
int xoffset;
int yoffset;
int last_yoffset;
int nf_offset;
int max_line_width;
std::size_t nf_offset;
std::size_t max_line_width;
};
#pragma pack(pop)
// FListBox inline functions
//----------------------------------------------------------------------
template <class Iterator, class InsertConverter>
template <typename Iterator, typename InsertConverter>
inline FListBox::FListBox ( Iterator first
, Iterator last
, InsertConverter convert
@ -368,7 +368,7 @@ inline FListBox::FListBox ( Iterator first
}
//----------------------------------------------------------------------
template <class Container, class LazyConverter>
template <typename Container, typename LazyConverter>
inline FListBox::FListBox ( Container container
, LazyConverter convert
, FWidget* parent )
@ -496,7 +496,7 @@ inline bool FListBox::hasBrackets(listBoxItems::iterator iter) const
{ return bool(iter->brackets > 0); }
//----------------------------------------------------------------------
template <class Iterator, class InsertConverter>
template <typename Iterator, typename InsertConverter>
inline void FListBox::insert ( Iterator first
, Iterator last
, InsertConverter convert )
@ -511,7 +511,7 @@ inline void FListBox::insert ( Iterator first
}
//----------------------------------------------------------------------
template <class Container, class LazyConverter>
template <typename Container, typename LazyConverter>
void FListBox::insert (Container container, LazyConverter convert)
{
conv_type = lazy_convert;
@ -522,7 +522,7 @@ void FListBox::insert (Container container, LazyConverter convert)
if ( size > 0 )
itemlist.resize(size);
recalculateVerticalBar(int(size));
recalculateVerticalBar(size);
}
//----------------------------------------------------------------------

View File

@ -115,7 +115,7 @@ class FListViewItem : public FObject
bool isExpandable() const;
// Methods
template<typename Compare>
template <typename Compare>
void sort (Compare);
FObjectIterator appendItem (FListViewItem*);
void replaceControlCodes();
@ -276,9 +276,9 @@ class FListView : public FWidget
= fc::by_name);
void setColumnSort (int, fc::sorting_order \
= fc::ascending);
template<typename Compare>
template <typename Compare>
void setUserAscendingCompare (Compare);
template<typename Compare>
template <typename Compare>
void setUserDescendingCompare (Compare);
bool setTreeView (bool);
bool setTreeView();
@ -342,7 +342,7 @@ class FListView : public FWidget
// Methods
void init();
template<typename Compare>
template <typename Compare>
void sort (Compare);
std::size_t getAlignOffset ( fc::text_alignment
, std::size_t
@ -465,12 +465,12 @@ inline FListViewItem* FListView::getCurrentItem()
{ return static_cast<FListViewItem*>(*current_iter); }
//----------------------------------------------------------------------
template<typename Compare>
template <typename Compare>
inline void FListView::setUserAscendingCompare (Compare cmp)
{ user_defined_ascending = cmp; }
//----------------------------------------------------------------------
template<typename Compare>
template <typename Compare>
inline void FListView::setUserDescendingCompare (Compare cmp)
{ user_defined_descending = cmp; }

View File

@ -175,7 +175,7 @@ class FMenuItem : public FWidget
void processActivate();
void processDeactivate();
void createDialogList (FMenu*);
template<class T>
template <typename T>
void passMouseEvent (T, FMouseEvent*, fc::events);
// Callback methods

View File

@ -308,7 +308,7 @@ inline const wchar_t& FString::operator [] (IndexT pos) const
}
//----------------------------------------------------------------------
template <class CharT>
template <typename CharT>
inline bool FString::operator < (CharT& s) const
{
const FString tmp(s);
@ -316,7 +316,7 @@ inline bool FString::operator < (CharT& s) const
}
//----------------------------------------------------------------------
template <class CharT>
template <typename CharT>
inline bool FString::operator <= (CharT& s) const
{
const FString tmp(s);
@ -324,7 +324,7 @@ inline bool FString::operator <= (CharT& s) const
}
//----------------------------------------------------------------------
template <class CharT>
template <typename CharT>
inline bool FString::operator == (CharT& s) const
{
const FString tmp(s);
@ -332,7 +332,7 @@ inline bool FString::operator == (CharT& s) const
}
//----------------------------------------------------------------------
template <class CharT>
template <typename CharT>
inline bool FString::operator != (CharT& s) const
{
const FString tmp(s);
@ -340,7 +340,7 @@ inline bool FString::operator != (CharT& s) const
}
//----------------------------------------------------------------------
template <class CharT>
template <typename CharT>
inline bool FString::operator >= (CharT& s) const
{
const FString tmp(s);
@ -348,7 +348,7 @@ inline bool FString::operator >= (CharT& s) const
}
//----------------------------------------------------------------------
template <class CharT>
template <typename CharT>
inline bool FString::operator > (CharT& s) const
{
const FString tmp(s);

View File

@ -65,7 +65,8 @@ class FTermBuffer
virtual ~FTermBuffer();
// Overloaded operators
template<class type> FTermBuffer& operator << (const type&);
template <typename type>
FTermBuffer& operator << (const type&);
// Non-member operators
friend std::vector<charData>& operator << ( std::vector<charData>&
, const FTermBuffer& );
@ -93,7 +94,7 @@ class FTermBuffer
// FTermBuffer inline functions
//----------------------------------------------------------------------
template<class type>
template <typename type>
inline FTermBuffer& FTermBuffer::operator << (const type& s)
{
std::wostringstream outstream;

View File

@ -120,7 +120,8 @@ class FVTerm : public FTerm
virtual ~FVTerm();
// Overloaded operators
template<class type> FVTerm& operator << (const type&);
template <typename type>
FVTerm& operator << (const type&);
FVTerm& operator << (const std::vector<charData>&);
// Accessors
@ -503,7 +504,7 @@ struct FVTerm::term_area // define virtual terminal character properties
// FVTerm inline functions
//----------------------------------------------------------------------
template<class type>
template <typename type>
inline FVTerm& FVTerm::operator << (const type& s)
{
std::wostringstream outstream;

View File

@ -932,6 +932,33 @@ const wchar_t CHECKED_RADIO_BUTTON[4] =
'\0'
};
// non-member functions
//----------------------------------------------------------------------
inline char* createBlankArray (std::size_t size)
{
char* blank;
try
{
blank = new char[size + 1];
}
catch (const std::bad_alloc& ex)
{
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
return 0;
}
std::memset(blank, ' ', size);
blank[size] = '\0';
return blank;
}
//----------------------------------------------------------------------
inline void destroyBlankArray (char blank[])
{
delete[] blank;
}
} // namespace finalcut
#endif // FWIDGET_H