New data type FStringList introduced
This commit is contained in:
parent
c97511a6cc
commit
b3e9a0bba1
|
@ -1,3 +1,6 @@
|
|||
2017-09-20 Markus Gans <guru.mail@muenster.de>
|
||||
* New data type FStringList introduced
|
||||
|
||||
2017-09-19 Markus Gans <guru.mail@muenster.de>
|
||||
* FString has now got its own streaming functionality for
|
||||
inbound and outbound type conversion
|
||||
|
|
|
@ -19,7 +19,7 @@ automake --add-missing --copy
|
|||
#autoreconf -v --install --force
|
||||
|
||||
echo
|
||||
echo 'run "./configure ; make"'
|
||||
echo 'run "./configure --prefix=/usr && make"'
|
||||
echo
|
||||
|
||||
# Generate Makefile from Makefile.in
|
||||
|
|
|
@ -111,7 +111,7 @@ Listview::Listview (FWidget* parent)
|
|||
|
||||
for (int i = 0; i <= lastItem; i++)
|
||||
{
|
||||
std::vector<FString> line (&weather[i][0], &weather[i][0] + 5);
|
||||
FStringList line (&weather[i][0], &weather[i][0] + 5);
|
||||
listView->insert (line);
|
||||
}
|
||||
|
||||
|
|
|
@ -321,8 +321,8 @@ int main (int, char**)
|
|||
FString split_str = "a,b,c,d";
|
||||
std::cout << " split: \""
|
||||
<< split_str << "\" into substrings ->";
|
||||
std::vector <FString> parts = split_str.split(",");
|
||||
std::vector<FString>::iterator it, end;
|
||||
FStringList parts = split_str.split(",");
|
||||
FStringList::iterator it, end;
|
||||
end = parts.end();
|
||||
|
||||
for (it = parts.begin(); it != end; ++it)
|
||||
|
|
|
@ -76,14 +76,14 @@ Treeview::Treeview (FWidget* parent)
|
|||
|
||||
for (int i = 0; i <= lastItem; i++)
|
||||
{
|
||||
std::vector<FString> line (&continent[i][0], &continent[i][0] + 3);
|
||||
FStringList line (&continent[i][0], &continent[i][0] + 3);
|
||||
listView->insert (line);
|
||||
}
|
||||
|
||||
|
||||
FObjectIterator iter_africa = listView->beginOfList();
|
||||
std::string egypt[3] = { "Egypt", "94,666,000", "87" };
|
||||
std::vector<FString> egypt_line (&egypt[0], &egypt[0] + 3);
|
||||
FStringList egypt_line (&egypt[0], &egypt[0] + 3);
|
||||
//FObjectIterator iter_africa = listView->insert (egypt_line);
|
||||
listView->insert (egypt_line, iter_africa);
|
||||
|
||||
|
|
|
@ -105,9 +105,6 @@ class FLabel : public FWidget
|
|||
void cb_accel_widget_destroyed (FWidget*, data_ptr);
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
typedef std::vector<FString> multiLineText;
|
||||
|
||||
// Disable copy constructor
|
||||
FLabel (const FLabel&);
|
||||
|
||||
|
@ -124,7 +121,7 @@ class FLabel : public FWidget
|
|||
void draw();
|
||||
|
||||
// Data Members
|
||||
multiLineText multiline_text;
|
||||
FStringList multiline_text;
|
||||
bool multiline;
|
||||
FString text;
|
||||
fc::text_alignment alignment;
|
||||
|
|
|
@ -54,7 +54,7 @@ class FListViewItem : public FObject
|
|||
// Constructor
|
||||
FListViewItem (const FListViewItem&); // copy constructor
|
||||
explicit FListViewItem (FObjectIterator);
|
||||
FListViewItem ( const std::vector<FString>&
|
||||
FListViewItem ( const FStringList&
|
||||
, FWidget::data_ptr
|
||||
, FObjectIterator );
|
||||
|
||||
|
@ -92,7 +92,7 @@ class FListViewItem : public FObject
|
|||
int getVisibleLines();
|
||||
|
||||
// Data Member
|
||||
std::vector<FString> column_list;
|
||||
FStringList column_list;
|
||||
FWidget::data_ptr data_pointer;
|
||||
int visible_lines;
|
||||
bool expandable;
|
||||
|
@ -160,11 +160,11 @@ class FListView : public FWidget
|
|||
virtual int addColumn (const FString&, int = USE_MAX_SIZE);
|
||||
FObjectIterator insert (FListViewItem*);
|
||||
FObjectIterator insert (FListViewItem*, FObjectIterator);
|
||||
FObjectIterator insert ( const std::vector<FString>&
|
||||
FObjectIterator insert ( const FStringList&
|
||||
, data_ptr = 0 );
|
||||
FObjectIterator insert ( const std::vector<FString>&
|
||||
FObjectIterator insert ( const FStringList&
|
||||
, FObjectIterator );
|
||||
FObjectIterator insert ( const std::vector<FString>&
|
||||
FObjectIterator insert ( const FStringList&
|
||||
, data_ptr
|
||||
, FObjectIterator );
|
||||
FObjectIterator insert ( const std::vector<long>&
|
||||
|
@ -306,12 +306,12 @@ inline FObject::FObjectIterator FListView::insert (FListViewItem* item)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline FObject::FObjectIterator
|
||||
FListView::insert ( const std::vector<FString>& cols, data_ptr d )
|
||||
FListView::insert ( const FStringList& cols, data_ptr d )
|
||||
{ return insert (cols, d, root); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FObject::FObjectIterator
|
||||
FListView::insert ( const std::vector<FString>& cols
|
||||
FListView::insert ( const FStringList& cols
|
||||
, FObjectIterator parent_iter )
|
||||
{ return insert (cols, 0, parent_iter); }
|
||||
|
||||
|
|
|
@ -122,9 +122,6 @@ class FMessageBox : public FDialog
|
|||
void cb_processClick (FWidget*, data_ptr);
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
typedef std::vector<FString> textLines;
|
||||
|
||||
// Methods
|
||||
void init (int, int, int);
|
||||
void calculateDimensions();
|
||||
|
@ -136,7 +133,7 @@ class FMessageBox : public FDialog
|
|||
FString headline_text;
|
||||
FString text;
|
||||
FString* text_components;
|
||||
textLines text_split;
|
||||
FStringList text_split;
|
||||
uInt max_line_width;
|
||||
bool center_text;
|
||||
short emphasis_color;
|
||||
|
|
|
@ -33,6 +33,11 @@
|
|||
|
||||
#include "final/ftypes.h"
|
||||
|
||||
// class forward declaration
|
||||
class FString;
|
||||
|
||||
// Global typedef
|
||||
typedef std::vector<FString> FStringList;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FString
|
||||
|
@ -230,13 +235,13 @@ class FString
|
|||
FString mid (int, int) const;
|
||||
FString mid (uInt, uInt) const;
|
||||
|
||||
std::vector<FString> split (const FString&);
|
||||
std::vector<FString> split (const std::wstring&);
|
||||
std::vector<FString> split (const wchar_t*);
|
||||
std::vector<FString> split (const std::string&);
|
||||
std::vector<FString> split (const char*);
|
||||
std::vector<FString> split (const wchar_t);
|
||||
std::vector<FString> split (const char);
|
||||
FStringList split (const FString&);
|
||||
FStringList split (const std::wstring&);
|
||||
FStringList split (const wchar_t*);
|
||||
FStringList split (const std::string&);
|
||||
FStringList split (const char*);
|
||||
FStringList split (const wchar_t);
|
||||
FStringList split (const char);
|
||||
|
||||
FString& setString (const wchar_t*);
|
||||
FString& setString (const char*);
|
||||
|
@ -390,27 +395,27 @@ inline wchar_t FString::back() const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline std::vector<FString> FString::split (const std::wstring& s)
|
||||
inline FStringList FString::split (const std::wstring& s)
|
||||
{ return split(FString(s)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline std::vector<FString> FString::split (const wchar_t* s)
|
||||
inline FStringList FString::split (const wchar_t* s)
|
||||
{ return split(FString(s)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline std::vector<FString> FString::split (const std::string& s)
|
||||
inline FStringList FString::split (const std::string& s)
|
||||
{ return split(FString(s)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline std::vector<FString> FString::split (const char* s)
|
||||
inline FStringList FString::split (const char* s)
|
||||
{ return split(FString(s)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline std::vector<FString> FString::split (const wchar_t c)
|
||||
inline FStringList FString::split (const wchar_t c)
|
||||
{ return split(FString(c)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline std::vector<FString> FString::split (const char c)
|
||||
inline FStringList FString::split (const char c)
|
||||
{ return split(FString(c)); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -50,9 +50,6 @@ class FTextView : public FWidget
|
|||
// Using-declarations
|
||||
using FWidget::setGeometry;
|
||||
|
||||
// Typedef
|
||||
typedef std::vector<FString> stringLines;
|
||||
|
||||
// Constructor
|
||||
explicit FTextView (FWidget* = 0);
|
||||
|
||||
|
@ -64,7 +61,7 @@ class FTextView : public FWidget
|
|||
uInt getColumns() const;
|
||||
uInt getRows() const;
|
||||
const FString getText() const;
|
||||
const stringLines& getLines() const;
|
||||
const FStringList& getLines() const;
|
||||
|
||||
// Mutators
|
||||
void setGeometry (int, int, int, int, bool = true);
|
||||
|
@ -111,7 +108,7 @@ class FTextView : public FWidget
|
|||
void cb_HBarChange (FWidget*, data_ptr);
|
||||
|
||||
// Data Members
|
||||
stringLines data;
|
||||
FStringList data;
|
||||
FScrollbar* vbar;
|
||||
FScrollbar* hbar;
|
||||
int xoffset;
|
||||
|
@ -136,7 +133,7 @@ inline uInt FTextView::getRows() const
|
|||
{ return uInt(data.size()); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const FTextView::stringLines& FTextView::getLines() const
|
||||
inline const FStringList& FTextView::getLines() const
|
||||
{ return data; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -71,9 +71,6 @@ class FToolTip : public FWindow
|
|||
void onMouseDown (FMouseEvent*);
|
||||
|
||||
private:
|
||||
// Typedef
|
||||
typedef std::vector<FString> textLines;
|
||||
|
||||
// Disable copy constructor
|
||||
FToolTip (const FToolTip&);
|
||||
|
||||
|
@ -88,7 +85,7 @@ class FToolTip : public FWindow
|
|||
// Data Members
|
||||
FString text;
|
||||
FString* text_components;
|
||||
textLines text_split;
|
||||
FStringList text_split;
|
||||
uInt max_line_width;
|
||||
uInt text_num_lines;
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ FListViewItem::FListViewItem (FObjectIterator parent_iter)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FListViewItem::FListViewItem ( const std::vector<FString>& cols
|
||||
FListViewItem::FListViewItem ( const FStringList& cols
|
||||
, FWidget::data_ptr data
|
||||
, FObjectIterator parent_iter )
|
||||
: FObject(0)
|
||||
|
@ -195,7 +195,7 @@ FObject::FObjectIterator FListViewItem::appendItem (FListViewItem* child)
|
|||
void FListViewItem::replaceControlCodes()
|
||||
{
|
||||
// Replace the control codes characters
|
||||
std::vector<FString>::iterator iter = column_list.begin();
|
||||
FStringList::iterator iter = column_list.begin();
|
||||
|
||||
while ( iter != column_list.end() )
|
||||
{
|
||||
|
@ -432,7 +432,7 @@ FObject::FObjectIterator FListView::insert ( FListViewItem* item
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FObject::FObjectIterator FListView::insert ( const std::vector<FString>& cols
|
||||
FObject::FObjectIterator FListView::insert ( const FStringList& cols
|
||||
, data_ptr d
|
||||
, FObjectIterator parent_iter )
|
||||
{
|
||||
|
@ -464,7 +464,7 @@ FObject::FObjectIterator FListView::insert ( const std::vector<long>& cols
|
|||
, FObjectIterator parent_iter )
|
||||
{
|
||||
FObjectIterator item_iter;
|
||||
std::vector<FString> str_cols;
|
||||
FStringList str_cols;
|
||||
|
||||
if ( ! cols.empty() )
|
||||
{
|
||||
|
|
|
@ -1154,27 +1154,27 @@ FString FString::mid (uInt pos, uInt len) const
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
std::vector<FString> FString::split (const FString& delimiter)
|
||||
FStringList FString::split (const FString& delimiter)
|
||||
{
|
||||
wchar_t* rest;
|
||||
wchar_t* token;
|
||||
FString s(string);
|
||||
std::vector<FString> stringList;
|
||||
FStringList string_list;
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! (string && *string) )
|
||||
return stringList;
|
||||
return string_list;
|
||||
|
||||
rest = 0;
|
||||
token = extractToken(&rest, s.string, delimiter.wc_str());
|
||||
|
||||
while ( token )
|
||||
{
|
||||
stringList.push_back (FString(token));
|
||||
string_list.push_back (FString(token));
|
||||
token = extractToken (&rest, 0, delimiter.wc_str());
|
||||
}
|
||||
|
||||
return stringList;
|
||||
return string_list;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2217,7 +2217,7 @@ FString FString::replaceControlCodes() const
|
|||
FString FString::expandTabs (int tabstop) const
|
||||
{
|
||||
uLong last;
|
||||
std::vector<FString> tab_split;
|
||||
FStringList tab_split;
|
||||
FString instr(string);
|
||||
FString outstr;
|
||||
|
||||
|
|
|
@ -2722,16 +2722,16 @@ char* FTerm::parseSecDA (char*& current_termtype)
|
|||
// remove the last byte ("c")
|
||||
temp.remove(temp.getLength() - 1, 1);
|
||||
// split into components
|
||||
std::vector<FString> sec_da_split = temp.split(';');
|
||||
FStringList sec_da_list = temp.split(';');
|
||||
|
||||
num_components = sec_da_split.size();
|
||||
num_components = sec_da_list.size();
|
||||
|
||||
if ( num_components == 3 )
|
||||
sec_da_supported = true;
|
||||
|
||||
if ( num_components >= 2 )
|
||||
{
|
||||
const FString* sec_da_components = &sec_da_split[0];
|
||||
const FString* sec_da_components = &sec_da_list[0];
|
||||
|
||||
if ( ! sec_da_components[0].isEmpty() )
|
||||
{
|
||||
|
|
|
@ -182,8 +182,8 @@ void FTextView::append (const FString& str)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::insert (const FString& str, int pos)
|
||||
{
|
||||
stringLines::iterator iter;
|
||||
stringLines text_split;
|
||||
FStringList::iterator iter;
|
||||
FStringList text_split;
|
||||
FString s;
|
||||
uLong num;
|
||||
|
||||
|
@ -241,7 +241,7 @@ void FTextView::insert (const FString& str, int pos)
|
|||
//----------------------------------------------------------------------
|
||||
void FTextView::replaceRange (const FString& str, int from, int to)
|
||||
{
|
||||
stringLines::iterator iter;
|
||||
FStringList::iterator iter;
|
||||
|
||||
if ( from > to )
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue