wxwidgets.cfg: Add container configuration for wxString (#2109)

This commit is contained in:
Sebastian 2019-08-23 19:10:49 +02:00 committed by GitHub
parent 9cbdc262f6
commit 7f50642090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 91 additions and 0 deletions

View File

@ -4457,6 +4457,62 @@
<smart-pointer class-name="wxWindowPtr"/>
<smart-pointer class-name="wxScopedTiedPtr"/>
<smart-pointer class-name="wxTrackable"/>
<!-- ########## wxWidgets containers ########## -->
<!-- wxString https://docs.wxwidgets.org/3.0/classwx_string.html -->
<container id="wxString" startPattern="wxString" endPattern="" opLessAllowed="true" itEndPattern=":: iterator|const_iterator|reverse_iterator|const_reverse_iterator">
<type string="std-like"/>
<size>
<function name="resize" action="resize"/>
<function name="clear" action="clear"/>
<function name="Clear" action="clear"/>
<function name="Empty" action="clear"/>
<function name="size" yields="size"/>
<function name="length" yields="size"/>
<function name="Length" yields="size"/>
<function name="Len" yields="size"/>
<function name="empty" yields="empty"/>
<function name="IsEmpty" yields="empty"/>
<function name="IsNull" yields="empty"/>
<function name="erase" action="erase"/>
<function name="insert" action="insert"/>
<function name="swap" action="change"/>
<function name="assign" action="change"/>
<function name="append" action="change"/>
<function name="Append" action="change"/>
<function name="Prepend" action="change"/>
<function name="replace" action="change"/>
<function name="Replace" action="change"/>
<function name="reserve" action="change-internal"/>
<function name="shrink_to_fit" action="change-internal"/>
<function name="Shrink" action="change-internal"/>
<function name="Alloc" action="change-internal"/>
<function name="Strip" action="change"/>
<function name="Trim" action="change"/>
<function name="Truncate" action="change"/>
<function name="Remove" action="change"/>
<function name="RemoveLast" action="change"/>
<function name="Pad" action="change"/>
</size>
<access indexOperator="array-like">
<function name="begin" yields="start-iterator"/>
<function name="rbegin" yields="start-iterator"/>
<function name="end" yields="end-iterator"/>
<function name="rend" yields="end-iterator"/>
<function name="at" yields="at_index"/>
<function name="data" yields="buffer"/>
<function name="c_str" yields="buffer-nt"/>
<function name="wx_str" yields="buffer-nt"/>
<function name="wc_str" yields="buffer-nt"/>
<function name="find" action="find"/>
<function name="Find" action="find"/>
<function name="First" action="find"/>
<function name="rfind" action="find"/>
<function name="find_last_of" action="find"/>
<function name="find_last_not_of" action="find"/>
<function name="find_first_of" action="find"/>
<function name="find_first_not_of" action="find"/>
</access>
</container>
<!-- http://docs.wxwidgets.org/trunk/classwx_string.html#addd9ccfa3ae2b7ab2d66bcbf034d0be0 -->
<!-- static wxString wxString::Format(const wxString & format, ...) -->
<function name="wxString::Format">

View File

@ -22,6 +22,7 @@
#include <wx/menu.h>
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/string.h>
void validCode()
{
@ -277,3 +278,37 @@ void deprecatedFunctions(wxApp &a,
calenderCtrl.EnableYearChange(/*default=yes*/);
#endif
}
void wxString_test1(wxString s)
{
for (int i = 0; i <= s.size(); ++i) {
// cppcheck-suppress stlOutOfBounds
s[i] = 'x';
}
}
void wxString_test2()
{
wxString s;
// cppcheck-suppress containerOutOfBounds
s[1] = 'a';
s.append("abc");
s[1] = 'B';
printf("%s", static_cast<const char*>(s.c_str()));
wxPrintf("%s", s);
wxPrintf("%s", s.c_str());
s.Clear();
}
wxString::iterator wxString_test3()
{
wxString wxString1;
wxString wxString2;
// cppcheck-suppress iterators2
for (wxString::iterator it = wxString1.begin(); it != wxString2.end(); ++it)
{}
wxString::iterator it = wxString1.begin();
// cppcheck-suppress returnDanglingLifetime
return it;
}