Added --use-stl to cnfigure, wxUSE_STL to setup0.h
Moved wx/datetime.inl contents to wx/datetime.h and removed inline redefinition hack. Implemented STL-like interface on top of wxList/wxArray, when wxUSE_STL=0. Implemented wxList-like and wxArray interfaces on top of std::list and std::vector, when wxUSE_STL=1. Added arrstr.h, moved wxArrayString declaration there; string.h #includes arrstr.h only if WXWIN_COMPATIBILITY_2_4 is enabled. Added WX_CLEAR_HASH_MAP, WX_CLEAR_HASH_TABLE, WX_CLEAR_LIST macros, to clear a wxHashMap, wxHashTable, wxList containing pointers: deletes pointers and makes container zero-sized. When wxUSE_STL=1, wxStringList works like a std::list<wxString>. Made wxBase compile when wxUSE_STL=1. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21768 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/arrstr.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
@@ -96,18 +97,18 @@ public:
|
||||
// ---------
|
||||
|
||||
// get the number of lines in the buffer
|
||||
size_t GetLineCount() const { return m_aLines.Count(); }
|
||||
size_t GetLineCount() const { return m_aLines.size(); }
|
||||
|
||||
// the returned line may be modified (but don't add CR/LF at the end!)
|
||||
wxString& GetLine(size_t n) const { return m_aLines[n]; }
|
||||
wxString& operator[](size_t n) const { return m_aLines[n]; }
|
||||
wxString& GetLine(size_t n) const { return (wxString&)m_aLines[n]; }
|
||||
wxString& operator[](size_t n) const { return (wxString&)m_aLines[n]; }
|
||||
|
||||
// the current line has meaning only when you're using
|
||||
// GetFirstLine()/GetNextLine() functions, it doesn't get updated when
|
||||
// you're using "direct access" i.e. GetLine()
|
||||
size_t GetCurrentLine() const { return m_nCurLine; }
|
||||
void GoToLine(size_t n) { m_nCurLine = n; }
|
||||
bool Eof() const { return (m_aLines.Count() == 0 || m_nCurLine == m_aLines.Count() - 1); }
|
||||
bool Eof() const { return (m_aLines.size() == 0 || m_nCurLine == m_aLines.size() - 1); }
|
||||
|
||||
// these methods allow more "iterator-like" traversal of the list of
|
||||
// lines, i.e. you may write something like:
|
||||
@@ -120,7 +121,7 @@ public:
|
||||
wxString& GetPrevLine() /* const */
|
||||
{ wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; }
|
||||
wxString& GetLastLine() /* const */
|
||||
{ return m_aLines[m_nCurLine = m_aLines.Count() - 1]; }
|
||||
{ return m_aLines[m_nCurLine = m_aLines.size() - 1]; }
|
||||
|
||||
// get the type of the line (see also GetEOL)
|
||||
wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; }
|
||||
@@ -136,17 +137,25 @@ public:
|
||||
|
||||
// add a line to the end
|
||||
void AddLine(const wxString& str, wxTextFileType type = typeDefault)
|
||||
{ m_aLines.Add(str); m_aTypes.Add(type); }
|
||||
{ m_aLines.push_back(str); m_aTypes.push_back(type); }
|
||||
// insert a line before the line number n
|
||||
void InsertLine(const wxString& str,
|
||||
size_t n,
|
||||
wxTextFileType type = typeDefault)
|
||||
{ m_aLines.Insert(str, n); m_aTypes.Insert(type, n); }
|
||||
{
|
||||
m_aLines.insert(m_aLines.begin() + n, str);
|
||||
m_aTypes.insert(m_aTypes.begin()+n, type);
|
||||
}
|
||||
|
||||
// delete one line
|
||||
void RemoveLine(size_t n) { m_aLines.RemoveAt(n); m_aTypes.RemoveAt(n); }
|
||||
void RemoveLine(size_t n)
|
||||
{
|
||||
m_aLines.erase(m_aLines.begin() + n);
|
||||
m_aTypes.erase(m_aTypes.begin() + n);
|
||||
}
|
||||
|
||||
// remove all lines
|
||||
void Clear() { m_aLines.Clear(); m_nCurLine = 0; }
|
||||
void Clear() { m_aLines.clear(); m_nCurLine = 0; }
|
||||
|
||||
// change the buffer (default argument means "don't change type")
|
||||
// possibly in another format
|
||||
|
Reference in New Issue
Block a user