Remove wx own wxStringImpl implementation
Always use std::basic_string<> as wxStringImpl. Closes #22883.
This commit is contained in:
parent
222cf952f4
commit
2c0c727f49
21 changed files with 69 additions and 1613 deletions
19
Makefile.in
19
Makefile.in
|
|
@ -538,7 +538,6 @@ ALL_BASE_HEADERS = \
|
|||
wx/strconv.h \
|
||||
wx/stream.h \
|
||||
wx/string.h \
|
||||
wx/stringimpl.h \
|
||||
wx/stringops.h \
|
||||
wx/strvararg.h \
|
||||
wx/sysopt.h \
|
||||
|
|
@ -725,7 +724,6 @@ ALL_PORTS_BASE_HEADERS = \
|
|||
wx/strconv.h \
|
||||
wx/stream.h \
|
||||
wx/string.h \
|
||||
wx/stringimpl.h \
|
||||
wx/stringops.h \
|
||||
wx/strvararg.h \
|
||||
wx/sysopt.h \
|
||||
|
|
@ -891,7 +889,6 @@ ALL_BASE_SOURCES = \
|
|||
src/common/strconv.cpp \
|
||||
src/common/stream.cpp \
|
||||
src/common/string.cpp \
|
||||
src/common/stringimpl.cpp \
|
||||
src/common/stringops.cpp \
|
||||
src/common/strvararg.cpp \
|
||||
src/common/sysopt.cpp \
|
||||
|
|
@ -1084,7 +1081,6 @@ MONODLL_OBJECTS = \
|
|||
monodll_strconv.o \
|
||||
monodll_stream.o \
|
||||
monodll_string.o \
|
||||
monodll_stringimpl.o \
|
||||
monodll_stringops.o \
|
||||
monodll_strvararg.o \
|
||||
monodll_sysopt.o \
|
||||
|
|
@ -1231,7 +1227,6 @@ MONOLIB_OBJECTS = \
|
|||
monolib_strconv.o \
|
||||
monolib_stream.o \
|
||||
monolib_string.o \
|
||||
monolib_stringimpl.o \
|
||||
monolib_stringops.o \
|
||||
monolib_strvararg.o \
|
||||
monolib_sysopt.o \
|
||||
|
|
@ -1362,7 +1357,6 @@ BASEDLL_OBJECTS = \
|
|||
basedll_strconv.o \
|
||||
basedll_stream.o \
|
||||
basedll_string.o \
|
||||
basedll_stringimpl.o \
|
||||
basedll_stringops.o \
|
||||
basedll_strvararg.o \
|
||||
basedll_sysopt.o \
|
||||
|
|
@ -1475,7 +1469,6 @@ BASELIB_OBJECTS = \
|
|||
baselib_strconv.o \
|
||||
baselib_stream.o \
|
||||
baselib_string.o \
|
||||
baselib_stringimpl.o \
|
||||
baselib_stringops.o \
|
||||
baselib_strvararg.o \
|
||||
baselib_sysopt.o \
|
||||
|
|
@ -14804,9 +14797,6 @@ monodll_stream.o: $(srcdir)/src/common/stream.cpp $(MONODLL_ODEP)
|
|||
monodll_string.o: $(srcdir)/src/common/string.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/string.cpp
|
||||
|
||||
monodll_stringimpl.o: $(srcdir)/src/common/stringimpl.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/stringimpl.cpp
|
||||
|
||||
monodll_stringops.o: $(srcdir)/src/common/stringops.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/stringops.cpp
|
||||
|
||||
|
|
@ -19571,9 +19561,6 @@ monolib_stream.o: $(srcdir)/src/common/stream.cpp $(MONOLIB_ODEP)
|
|||
monolib_string.o: $(srcdir)/src/common/string.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/string.cpp
|
||||
|
||||
monolib_stringimpl.o: $(srcdir)/src/common/stringimpl.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/stringimpl.cpp
|
||||
|
||||
monolib_stringops.o: $(srcdir)/src/common/stringops.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/stringops.cpp
|
||||
|
||||
|
|
@ -24338,9 +24325,6 @@ basedll_stream.o: $(srcdir)/src/common/stream.cpp $(BASEDLL_ODEP)
|
|||
basedll_string.o: $(srcdir)/src/common/string.cpp $(BASEDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/string.cpp
|
||||
|
||||
basedll_stringimpl.o: $(srcdir)/src/common/stringimpl.cpp $(BASEDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/stringimpl.cpp
|
||||
|
||||
basedll_stringops.o: $(srcdir)/src/common/stringops.cpp $(BASEDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/stringops.cpp
|
||||
|
||||
|
|
@ -24827,9 +24811,6 @@ baselib_stream.o: $(srcdir)/src/common/stream.cpp $(BASELIB_ODEP)
|
|||
baselib_string.o: $(srcdir)/src/common/string.cpp $(BASELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/string.cpp
|
||||
|
||||
baselib_stringimpl.o: $(srcdir)/src/common/stringimpl.cpp $(BASELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/stringimpl.cpp
|
||||
|
||||
baselib_stringops.o: $(srcdir)/src/common/stringops.cpp $(BASELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/stringops.cpp
|
||||
|
||||
|
|
|
|||
|
|
@ -547,7 +547,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||
src/common/strconv.cpp
|
||||
src/common/stream.cpp
|
||||
src/common/string.cpp
|
||||
src/common/stringimpl.cpp
|
||||
src/common/stringops.cpp
|
||||
src/common/strvararg.cpp
|
||||
src/common/sysopt.cpp
|
||||
|
|
@ -696,7 +695,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||
wx/strconv.h
|
||||
wx/stream.h
|
||||
wx/string.h
|
||||
wx/stringimpl.h
|
||||
wx/stringops.h
|
||||
wx/strvararg.h
|
||||
wx/sysopt.h
|
||||
|
|
|
|||
|
|
@ -460,7 +460,6 @@ set(BASE_CMN_SRC
|
|||
src/common/strconv.cpp
|
||||
src/common/stream.cpp
|
||||
src/common/string.cpp
|
||||
src/common/stringimpl.cpp
|
||||
src/common/stringops.cpp
|
||||
src/common/strvararg.cpp
|
||||
src/common/sysopt.cpp
|
||||
|
|
@ -611,7 +610,6 @@ set(BASE_CMN_HDR
|
|||
wx/strconv.h
|
||||
wx/stream.h
|
||||
wx/string.h
|
||||
wx/stringimpl.h
|
||||
wx/stringops.h
|
||||
wx/strvararg.h
|
||||
wx/sysopt.h
|
||||
|
|
|
|||
|
|
@ -479,7 +479,6 @@ BASE_CMN_SRC =
|
|||
src/common/strconv.cpp
|
||||
src/common/stream.cpp
|
||||
src/common/string.cpp
|
||||
src/common/stringimpl.cpp
|
||||
src/common/stringops.cpp
|
||||
src/common/strvararg.cpp
|
||||
src/common/sysopt.cpp
|
||||
|
|
@ -628,7 +627,6 @@ BASE_CMN_HDR =
|
|||
wx/strconv.h
|
||||
wx/stream.h
|
||||
wx/string.h
|
||||
wx/stringimpl.h
|
||||
wx/stringops.h
|
||||
wx/strvararg.h
|
||||
wx/sysopt.h
|
||||
|
|
|
|||
|
|
@ -460,7 +460,6 @@ MONODLL_OBJECTS = \
|
|||
$(OBJS)\monodll_strconv.o \
|
||||
$(OBJS)\monodll_stream.o \
|
||||
$(OBJS)\monodll_string.o \
|
||||
$(OBJS)\monodll_stringimpl.o \
|
||||
$(OBJS)\monodll_stringops.o \
|
||||
$(OBJS)\monodll_strvararg.o \
|
||||
$(OBJS)\monodll_sysopt.o \
|
||||
|
|
@ -620,7 +619,6 @@ MONOLIB_OBJECTS = \
|
|||
$(OBJS)\monolib_strconv.o \
|
||||
$(OBJS)\monolib_stream.o \
|
||||
$(OBJS)\monolib_string.o \
|
||||
$(OBJS)\monolib_stringimpl.o \
|
||||
$(OBJS)\monolib_stringops.o \
|
||||
$(OBJS)\monolib_strvararg.o \
|
||||
$(OBJS)\monolib_sysopt.o \
|
||||
|
|
@ -772,7 +770,6 @@ BASEDLL_OBJECTS = \
|
|||
$(OBJS)\basedll_strconv.o \
|
||||
$(OBJS)\basedll_stream.o \
|
||||
$(OBJS)\basedll_string.o \
|
||||
$(OBJS)\basedll_stringimpl.o \
|
||||
$(OBJS)\basedll_stringops.o \
|
||||
$(OBJS)\basedll_strvararg.o \
|
||||
$(OBJS)\basedll_sysopt.o \
|
||||
|
|
@ -905,7 +902,6 @@ BASELIB_OBJECTS = \
|
|||
$(OBJS)\baselib_strconv.o \
|
||||
$(OBJS)\baselib_stream.o \
|
||||
$(OBJS)\baselib_string.o \
|
||||
$(OBJS)\baselib_stringimpl.o \
|
||||
$(OBJS)\baselib_stringops.o \
|
||||
$(OBJS)\baselib_strvararg.o \
|
||||
$(OBJS)\baselib_sysopt.o \
|
||||
|
|
@ -7112,9 +7108,6 @@ $(OBJS)\monodll_stream.o: ../../src/common/stream.cpp
|
|||
$(OBJS)\monodll_string.o: ../../src/common/string.cpp
|
||||
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\monodll_stringimpl.o: ../../src/common/stringimpl.cpp
|
||||
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\monodll_stringops.o: ../../src/common/stringops.cpp
|
||||
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
|
@ -9702,9 +9695,6 @@ $(OBJS)\monolib_stream.o: ../../src/common/stream.cpp
|
|||
$(OBJS)\monolib_string.o: ../../src/common/string.cpp
|
||||
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\monolib_stringimpl.o: ../../src/common/stringimpl.cpp
|
||||
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\monolib_stringops.o: ../../src/common/stringops.cpp
|
||||
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
|
@ -12292,9 +12282,6 @@ $(OBJS)\basedll_stream.o: ../../src/common/stream.cpp
|
|||
$(OBJS)\basedll_string.o: ../../src/common/string.cpp
|
||||
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\basedll_stringimpl.o: ../../src/common/stringimpl.cpp
|
||||
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\basedll_stringops.o: ../../src/common/stringops.cpp
|
||||
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
|
@ -12643,9 +12630,6 @@ $(OBJS)\baselib_stream.o: ../../src/common/stream.cpp
|
|||
$(OBJS)\baselib_string.o: ../../src/common/string.cpp
|
||||
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\baselib_stringimpl.o: ../../src/common/stringimpl.cpp
|
||||
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\baselib_stringops.o: ../../src/common/stringops.cpp
|
||||
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
|
|
|||
|
|
@ -490,7 +490,6 @@ MONODLL_OBJECTS = \
|
|||
$(OBJS)\monodll_strconv.obj \
|
||||
$(OBJS)\monodll_stream.obj \
|
||||
$(OBJS)\monodll_string.obj \
|
||||
$(OBJS)\monodll_stringimpl.obj \
|
||||
$(OBJS)\monodll_stringops.obj \
|
||||
$(OBJS)\monodll_strvararg.obj \
|
||||
$(OBJS)\monodll_sysopt.obj \
|
||||
|
|
@ -657,7 +656,6 @@ MONOLIB_OBJECTS = \
|
|||
$(OBJS)\monolib_strconv.obj \
|
||||
$(OBJS)\monolib_stream.obj \
|
||||
$(OBJS)\monolib_string.obj \
|
||||
$(OBJS)\monolib_stringimpl.obj \
|
||||
$(OBJS)\monolib_stringops.obj \
|
||||
$(OBJS)\monolib_strvararg.obj \
|
||||
$(OBJS)\monolib_sysopt.obj \
|
||||
|
|
@ -818,7 +816,6 @@ BASEDLL_OBJECTS = \
|
|||
$(OBJS)\basedll_strconv.obj \
|
||||
$(OBJS)\basedll_stream.obj \
|
||||
$(OBJS)\basedll_string.obj \
|
||||
$(OBJS)\basedll_stringimpl.obj \
|
||||
$(OBJS)\basedll_stringops.obj \
|
||||
$(OBJS)\basedll_strvararg.obj \
|
||||
$(OBJS)\basedll_sysopt.obj \
|
||||
|
|
@ -961,7 +958,6 @@ BASELIB_OBJECTS = \
|
|||
$(OBJS)\baselib_strconv.obj \
|
||||
$(OBJS)\baselib_stream.obj \
|
||||
$(OBJS)\baselib_string.obj \
|
||||
$(OBJS)\baselib_stringimpl.obj \
|
||||
$(OBJS)\baselib_stringops.obj \
|
||||
$(OBJS)\baselib_strvararg.obj \
|
||||
$(OBJS)\baselib_sysopt.obj \
|
||||
|
|
@ -7557,9 +7553,6 @@ $(OBJS)\monodll_stream.obj: ..\..\src\common\stream.cpp
|
|||
$(OBJS)\monodll_string.obj: ..\..\src\common\string.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\string.cpp
|
||||
|
||||
$(OBJS)\monodll_stringimpl.obj: ..\..\src\common\stringimpl.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\stringimpl.cpp
|
||||
|
||||
$(OBJS)\monodll_stringops.obj: ..\..\src\common\stringops.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\stringops.cpp
|
||||
|
||||
|
|
@ -10147,9 +10140,6 @@ $(OBJS)\monolib_stream.obj: ..\..\src\common\stream.cpp
|
|||
$(OBJS)\monolib_string.obj: ..\..\src\common\string.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\string.cpp
|
||||
|
||||
$(OBJS)\monolib_stringimpl.obj: ..\..\src\common\stringimpl.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\stringimpl.cpp
|
||||
|
||||
$(OBJS)\monolib_stringops.obj: ..\..\src\common\stringops.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\stringops.cpp
|
||||
|
||||
|
|
@ -12737,9 +12727,6 @@ $(OBJS)\basedll_stream.obj: ..\..\src\common\stream.cpp
|
|||
$(OBJS)\basedll_string.obj: ..\..\src\common\string.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\string.cpp
|
||||
|
||||
$(OBJS)\basedll_stringimpl.obj: ..\..\src\common\stringimpl.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\stringimpl.cpp
|
||||
|
||||
$(OBJS)\basedll_stringops.obj: ..\..\src\common\stringops.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\stringops.cpp
|
||||
|
||||
|
|
@ -13088,9 +13075,6 @@ $(OBJS)\baselib_stream.obj: ..\..\src\common\stream.cpp
|
|||
$(OBJS)\baselib_string.obj: ..\..\src\common\string.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\string.cpp
|
||||
|
||||
$(OBJS)\baselib_stringimpl.obj: ..\..\src\common\stringimpl.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\stringimpl.cpp
|
||||
|
||||
$(OBJS)\baselib_stringops.obj: ..\..\src\common\stringops.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\stringops.cpp
|
||||
|
||||
|
|
|
|||
|
|
@ -535,7 +535,6 @@
|
|||
<ClCompile Include="..\..\src\common\strconv.cpp" />
|
||||
<ClCompile Include="..\..\src\common\stream.cpp" />
|
||||
<ClCompile Include="..\..\src\common\string.cpp" />
|
||||
<ClCompile Include="..\..\src\common\stringimpl.cpp" />
|
||||
<ClCompile Include="..\..\src\common\stringops.cpp" />
|
||||
<ClCompile Include="..\..\src\common\strvararg.cpp" />
|
||||
<ClCompile Include="..\..\src\common\sysopt.cpp" />
|
||||
|
|
@ -791,7 +790,6 @@
|
|||
<ClInclude Include="..\..\include\wx\strconv.h" />
|
||||
<ClInclude Include="..\..\include\wx\stream.h" />
|
||||
<ClInclude Include="..\..\include\wx\string.h" />
|
||||
<ClInclude Include="..\..\include\wx\stringimpl.h" />
|
||||
<ClInclude Include="..\..\include\wx\stringops.h" />
|
||||
<ClInclude Include="..\..\include\wx\strvararg.h" />
|
||||
<ClInclude Include="..\..\include\wx\sysopt.h" />
|
||||
|
|
|
|||
|
|
@ -219,9 +219,6 @@
|
|||
<ClCompile Include="..\..\src\common\string.cpp">
|
||||
<Filter>Common Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\common\stringimpl.cpp">
|
||||
<Filter>Common Sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\common\stringops.cpp">
|
||||
<Filter>Common Sources</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -814,9 +811,6 @@
|
|||
<ClInclude Include="..\..\include\wx\string.h">
|
||||
<Filter>Common Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\wx\stringimpl.h">
|
||||
<Filter>Common Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\wx\stringops.h">
|
||||
<Filter>Common Headers</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -307,7 +307,6 @@
|
|||
28ADE8D385A53445A5451F23 /* jdhuff.c in Sources */ = {isa = PBXBuildFile; fileRef = 72869747E68E37998CB0A07E /* jdhuff.c */; };
|
||||
BD53E095EC1136EF853A47D9 /* m_layout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5EE0B8985443BDCB36F781F /* m_layout.cpp */; };
|
||||
4788F736CD9C324E8A3DFA74 /* LexEScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 58EFF24DE2E737CA8A164F5C /* LexEScript.cxx */; };
|
||||
55F0D287F60F3EDEA16CCB64 /* stringimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5357E76650035639844D15B /* stringimpl.cpp */; };
|
||||
EAE02BA934B43EEE92C496C8 /* dcpsg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EEA0945B20913754A54D0FD9 /* dcpsg.cpp */; };
|
||||
6AC347D2DCC730149A0A83D8 /* button_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CF4F4F5211933057824B5621 /* button_osx.cpp */; };
|
||||
2EECB3C2F9523D0B95847A7F /* accel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C78A1539462370CAA429508 /* accel.cpp */; };
|
||||
|
|
@ -740,7 +739,6 @@
|
|||
784F7C50882F320FA76537B5 /* LexAU3.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C76222F466E831F896A89269 /* LexAU3.cxx */; };
|
||||
BF068F3C06473D8CBC55D508 /* PositionCache.cxx in Sources */ = {isa = PBXBuildFile; fileRef = BCD873D873A53BBF955D8A4E /* PositionCache.cxx */; };
|
||||
700BBDECBE313E108BA99ABD /* toplvcmn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 861438BD294335D4B859EA71 /* toplvcmn.cpp */; };
|
||||
55F0D287F60F3EDEA16CCB65 /* stringimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5357E76650035639844D15B /* stringimpl.cpp */; };
|
||||
20BEEFFA08F3396791596871 /* dlunix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA2D9F325F833C408657E7B7 /* dlunix.cpp */; };
|
||||
1E17F95DD433379E8C18298C /* odcombo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7906BD74118A3B4DAC515BC2 /* odcombo.cpp */; };
|
||||
97C551F8AEF133D680D1FD36 /* LexProgress.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E4A9905843A4683A6B460 /* LexProgress.cxx */; };
|
||||
|
|
@ -2272,7 +2270,6 @@
|
|||
05814571E7A83F5DBFB6E4C7 /* msgout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E968913A9A593B258BD8EACB /* msgout.cpp */; };
|
||||
DC6B669C9A78398F914AEE55 /* fontutil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5FF661188B563D27A11F5716 /* fontutil.cpp */; };
|
||||
6D723C987BFB39B7B887DCB3 /* Editor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DA5E95D498C53A808A8E2EEB /* Editor.cxx */; };
|
||||
55F0D287F60F3EDEA16CCB66 /* stringimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5357E76650035639844D15B /* stringimpl.cpp */; };
|
||||
438EAEA4B30C325C827F6199 /* xh_fontpicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 87E609641B583666AB9D1D58 /* xh_fontpicker.cpp */; };
|
||||
0164A65CDB7A334A8E9AA4C1 /* dynload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93BA27DFFB023F2EBD6295E3 /* dynload.cpp */; };
|
||||
86003C8EB906304F9025F78A /* jcinit.c in Sources */ = {isa = PBXBuildFile; fileRef = AA6C6739C3BD3EFA9CF71102 /* jcinit.c */; };
|
||||
|
|
@ -4167,7 +4164,6 @@
|
|||
080597FC0436378E96EDA94B /* m_links.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = m_links.cpp; path = ../../src/html/m_links.cpp; sourceTree = SOURCE_ROOT; };
|
||||
726C0457DF1232C793918DC1 /* tif_zip.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tif_zip.c; path = ../../src/tiff/libtiff/tif_zip.c; sourceTree = SOURCE_ROOT; };
|
||||
C3904351139F3F0DB4B72F94 /* pcre2_auto_possess.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = pcre2_auto_possess.c; path = ../../3rdparty/pcre/src/pcre2_auto_possess.c; sourceTree = SOURCE_ROOT; };
|
||||
E5357E76650035639844D15B /* stringimpl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = stringimpl.cpp; path = ../../src/common/stringimpl.cpp; sourceTree = SOURCE_ROOT; };
|
||||
B60497805D37375EBFCF3D98 /* pcre2_tables.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = pcre2_tables.c; path = ../../3rdparty/pcre/src/pcre2_tables.c; sourceTree = SOURCE_ROOT; };
|
||||
FC6A8FAE9CA63EEB8883B6BD /* pcre2_config.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = pcre2_config.c; path = ../../3rdparty/pcre/src/pcre2_config.c; sourceTree = SOURCE_ROOT; };
|
||||
A0DCC5EF59143640BE13AD73 /* jidctfst.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jidctfst.c; path = ../../src/jpeg/jidctfst.c; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -6370,7 +6366,6 @@
|
|||
9FEB8204E530329FA085E5B8 /* strconv.cpp */,
|
||||
FFDD414DBCC73D0FB6C2C5FD /* stream.cpp */,
|
||||
F7E99B35A98D30818120B002 /* string.cpp */,
|
||||
E5357E76650035639844D15B /* stringimpl.cpp */,
|
||||
F1E724EA70AB35DDB130F84F /* stringops.cpp */,
|
||||
0EEAD9C3E180305D8899441E /* strvararg.cpp */,
|
||||
F32F6B47EBB23068B1FCDC0D /* sysopt.cpp */,
|
||||
|
|
@ -7702,7 +7697,6 @@
|
|||
E882402BEE0330A080A65171 /* strconv.cpp in Sources */,
|
||||
30493B486DFF35AF80D12C49 /* stream.cpp in Sources */,
|
||||
795613831EC8332A83FF26E8 /* string.cpp in Sources */,
|
||||
55F0D287F60F3EDEA16CCB64 /* stringimpl.cpp in Sources */,
|
||||
88E1AE56FD393C8BA5CF8546 /* stringops.cpp in Sources */,
|
||||
056E30EA43753A7CB1AF8C9F /* strvararg.cpp in Sources */,
|
||||
4DD98A9436C83CF3B9425A78 /* sysopt.cpp in Sources */,
|
||||
|
|
@ -8426,7 +8420,6 @@
|
|||
E882402BEE0330A080A6516F /* strconv.cpp in Sources */,
|
||||
30493B486DFF35AF80D12C4B /* stream.cpp in Sources */,
|
||||
795613831EC8332A83FF26E9 /* string.cpp in Sources */,
|
||||
55F0D287F60F3EDEA16CCB66 /* stringimpl.cpp in Sources */,
|
||||
88E1AE56FD393C8BA5CF8545 /* stringops.cpp in Sources */,
|
||||
056E30EA43753A7CB1AF8C9E /* strvararg.cpp in Sources */,
|
||||
4DD98A9436C83CF3B9425A7A /* sysopt.cpp in Sources */,
|
||||
|
|
@ -9750,7 +9743,6 @@
|
|||
E882402BEE0330A080A65170 /* strconv.cpp in Sources */,
|
||||
30493B486DFF35AF80D12C4A /* stream.cpp in Sources */,
|
||||
795613831EC8332A83FF26E7 /* string.cpp in Sources */,
|
||||
55F0D287F60F3EDEA16CCB65 /* stringimpl.cpp in Sources */,
|
||||
88E1AE56FD393C8BA5CF8547 /* stringops.cpp in Sources */,
|
||||
056E30EA43753A7CB1AF8CA0 /* strvararg.cpp in Sources */,
|
||||
4DD98A9436C83CF3B9425A79 /* sysopt.cpp in Sources */,
|
||||
|
|
|
|||
|
|
@ -457,7 +457,6 @@
|
|||
0D6596A44A8C37DE85D578F6 /* Document.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 71DB140E670738839EC42C2B /* Document.cxx */; };
|
||||
353B584AD0C03919A57A3048 /* affinematrix2d.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD09A813E10A31C19554B425 /* affinematrix2d.cpp */; };
|
||||
EA10DA3199813E90B39C70D3 /* xh_infobar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45C65E309F3A39598C043657 /* xh_infobar.cpp */; };
|
||||
55F0D287F60F3EDEA16CCB64 /* stringimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E5357E76650035639844D15B /* stringimpl.cpp */; };
|
||||
056CA84179433AA48D55DA65 /* bar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FDDE855D9F83E4891362EB4 /* bar.cpp */; };
|
||||
E3AD8574E13B39BDB8D4E92E /* LexKVIrc.cxx in Sources */ = {isa = PBXBuildFile; fileRef = FCE8B55EBD6B348B8351AB08 /* LexKVIrc.cxx */; };
|
||||
90BC965B1A1F35A3B2C9D1C9 /* Decoration.cxx in Sources */ = {isa = PBXBuildFile; fileRef = BF1C44D726E63B18A98006EC /* Decoration.cxx */; };
|
||||
|
|
@ -1350,7 +1349,6 @@
|
|||
7A1CE0B28CB73F90AE92B5AB /* richtooltipcmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = richtooltipcmn.cpp; path = ../../src/common/richtooltipcmn.cpp; sourceTree = SOURCE_ROOT; };
|
||||
93BA27DFFB023F2EBD6295E3 /* dynload.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dynload.cpp; path = ../../src/common/dynload.cpp; sourceTree = SOURCE_ROOT; };
|
||||
B4028ABB08C63AB59F5F240B /* m_list.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = m_list.cpp; path = ../../src/html/m_list.cpp; sourceTree = SOURCE_ROOT; };
|
||||
E5357E76650035639844D15B /* stringimpl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = stringimpl.cpp; path = ../../src/common/stringimpl.cpp; sourceTree = SOURCE_ROOT; };
|
||||
497861EB7E623C68951D1AB2 /* LexAPDL.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexAPDL.cxx; path = ../../src/stc/scintilla/lexers/LexAPDL.cxx; sourceTree = SOURCE_ROOT; };
|
||||
DDE22D7DDAC93DCABAE5AED0 /* socketiohandler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = socketiohandler.cpp; path = ../../src/common/socketiohandler.cpp; sourceTree = SOURCE_ROOT; };
|
||||
DE16011AD6323AAC8616F973 /* stdstream.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = stdstream.cpp; path = ../../src/common/stdstream.cpp; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -2158,7 +2156,6 @@
|
|||
9FEB8204E530329FA085E5B8 /* strconv.cpp */,
|
||||
FFDD414DBCC73D0FB6C2C5FD /* stream.cpp */,
|
||||
F7E99B35A98D30818120B002 /* string.cpp */,
|
||||
E5357E76650035639844D15B /* stringimpl.cpp */,
|
||||
F1E724EA70AB35DDB130F84F /* stringops.cpp */,
|
||||
0EEAD9C3E180305D8899441E /* strvararg.cpp */,
|
||||
F32F6B47EBB23068B1FCDC0D /* sysopt.cpp */,
|
||||
|
|
@ -3095,7 +3092,6 @@
|
|||
E882402BEE0330A080A6516F /* strconv.cpp in Sources */,
|
||||
30493B486DFF35AF80D12C49 /* stream.cpp in Sources */,
|
||||
795613831EC8332A83FF26E7 /* string.cpp in Sources */,
|
||||
55F0D287F60F3EDEA16CCB64 /* stringimpl.cpp in Sources */,
|
||||
88E1AE56FD393C8BA5CF8545 /* stringops.cpp in Sources */,
|
||||
056E30EA43753A7CB1AF8C9E /* strvararg.cpp in Sources */,
|
||||
4DD98A9436C83CF3B9425A78 /* sysopt.cpp in Sources */,
|
||||
|
|
|
|||
|
|
@ -33,14 +33,18 @@
|
|||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "wx/chartype.h" // for wxChar
|
||||
#include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc.
|
||||
#include "wx/strvararg.h"
|
||||
#include "wx/buffer.h" // for wxCharBuffer
|
||||
#include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes
|
||||
#include "wx/stringimpl.h"
|
||||
#include "wx/stringops.h"
|
||||
#include "wx/unichar.h"
|
||||
|
||||
#include "wx/beforestd.h"
|
||||
#include <string>
|
||||
#include "wx/afterstd.h"
|
||||
|
||||
// by default we cache the mapping of the positions in UTF-8 string to the byte
|
||||
// offset as this results in noticeable performance improvements for loops over
|
||||
// strings using indices; comment out this line to disable this
|
||||
|
|
@ -92,6 +96,32 @@ namespace wxPrivate
|
|||
template <typename T> struct wxStringAsBufHelper;
|
||||
}
|
||||
|
||||
// All the symbols here only exist for compatibility in case they're referenced
|
||||
// in the existing code.
|
||||
#define wxUSE_STL_BASED_WXSTRING 1
|
||||
|
||||
// Define this for compatibility only, it is not used any longer.
|
||||
typedef std::wstring wxStdWideString;
|
||||
|
||||
#if wxUSE_UNICODE_WCHAR
|
||||
typedef std::wstring wxStdString;
|
||||
#else
|
||||
typedef std::string wxStdString;
|
||||
#endif
|
||||
|
||||
typedef wxStdString wxStringImpl;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// global pointer to empty string
|
||||
extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString;
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
// FIXME-UTF8: we should have only one wxEmptyString
|
||||
extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl;
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// macros
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
@ -673,7 +703,6 @@ public:
|
|||
typedef size_t size_type;
|
||||
typedef const wxUniChar const_reference;
|
||||
|
||||
#if wxUSE_STD_STRING
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
// random access is not O(1), as required by Random Access Iterator
|
||||
#define WX_STR_ITERATOR_TAG std::bidirectional_iterator_tag
|
||||
|
|
@ -681,12 +710,6 @@ public:
|
|||
#define WX_STR_ITERATOR_TAG std::random_access_iterator_tag
|
||||
#endif
|
||||
#define WX_DEFINE_ITERATOR_CATEGORY(cat) typedef cat iterator_category;
|
||||
#else
|
||||
// not defining iterator_category at all in this case is better than defining
|
||||
// it as some dummy type -- at least it results in more intelligible error
|
||||
// messages
|
||||
#define WX_DEFINE_ITERATOR_CATEGORY(cat)
|
||||
#endif
|
||||
|
||||
#define WX_STR_ITERATOR_IMPL(iterator_name, pointer_type, reference_type) \
|
||||
private: \
|
||||
|
|
@ -1053,7 +1076,7 @@ private:
|
|||
// instead we define dummy type that lets us have wxString ctor for creation
|
||||
// from wxStringImpl that couldn't be used by user code (in all other builds,
|
||||
// "standard" ctors can be used):
|
||||
#if wxUSE_UNICODE_UTF8 && wxUSE_STL_BASED_WXSTRING
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
struct CtorFromStringImplTag {};
|
||||
|
||||
wxString(CtorFromStringImplTag* WXUNUSED(dummy), const wxStringImpl& src)
|
||||
|
|
@ -1062,10 +1085,6 @@ private:
|
|||
static wxString FromImpl(const wxStringImpl& src)
|
||||
{ return wxString((CtorFromStringImplTag*)nullptr, src); }
|
||||
#else
|
||||
#if !wxUSE_STL_BASED_WXSTRING
|
||||
wxString(const wxStringImpl& src) : m_impl(src) { }
|
||||
// else: already defined as wxString(wxStdString) below
|
||||
#endif
|
||||
static wxString FromImpl(const wxStringImpl& src) { return wxString(src); }
|
||||
#endif
|
||||
|
||||
|
|
@ -1181,14 +1200,6 @@ public:
|
|||
}
|
||||
#endif // wxUSE_STRING_POS_CACHE
|
||||
|
||||
// even if we're not built with wxUSE_STD_STRING_CONV_IN_WXSTRING == 1 it is
|
||||
// very convenient to allow implicit conversions from std::string to wxString
|
||||
// and vice verse as this allows to use the same strings in non-GUI and GUI
|
||||
// code, however we don't want to unconditionally add this ctor as it would
|
||||
// make wx lib dependent on libstdc++ on some Linux versions which is bad, so
|
||||
// instead we ask the client code to define this wxUSE_STD_STRING symbol if
|
||||
// they need it
|
||||
#if wxUSE_STD_STRING
|
||||
#if wxUSE_UNICODE_WCHAR
|
||||
wxString(const std::wstring& str) : m_impl(str) {}
|
||||
#else // UTF-8 or ANSI
|
||||
|
|
@ -1200,14 +1211,12 @@ public:
|
|||
wxString(const std::string& str)
|
||||
{ assign(str.c_str(), str.length()); }
|
||||
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||
#endif // wxUSE_STD_STRING
|
||||
|
||||
// Also always provide explicit conversions to std::[w]string in any case,
|
||||
// see below for the implicit ones.
|
||||
#if wxUSE_STD_STRING
|
||||
// We can avoid a copy if we already use this string type internally,
|
||||
// otherwise we create a copy on the fly:
|
||||
#if wxUSE_UNICODE_WCHAR && wxUSE_STL_BASED_WXSTRING
|
||||
#if wxUSE_UNICODE_WCHAR
|
||||
#define wxStringToStdWstringRetType const std::wstring&
|
||||
const std::wstring& ToStdWstring() const { return m_impl; }
|
||||
#else
|
||||
|
|
@ -1226,7 +1235,7 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
#if wxUSE_UTF8_LOCALE_ONLY && wxUSE_STL_BASED_WXSTRING
|
||||
#if wxUSE_UTF8_LOCALE_ONLY
|
||||
// wxStringImpl is std::string in the encoding we want
|
||||
#define wxStringToStdStringRetType const std::string&
|
||||
const std::string& ToStdString() const { return m_impl; }
|
||||
|
|
@ -1261,8 +1270,6 @@ public:
|
|||
#undef wxStringToStdStringRetType
|
||||
#undef wxStringToStdWstringRetType
|
||||
|
||||
#endif // wxUSE_STD_STRING
|
||||
|
||||
wxString Clone() const
|
||||
{
|
||||
// make a deep copy of the string, i.e. the returned string will have
|
||||
|
|
@ -1605,14 +1612,9 @@ public:
|
|||
return FromImpl(wxStringImpl(utf8, len));
|
||||
}
|
||||
|
||||
#if wxUSE_STD_STRING
|
||||
static wxString FromUTF8Unchecked(const std::string& utf8)
|
||||
{
|
||||
wxASSERT( wxStringOperations::IsValidUtf8String(utf8.c_str(), utf8.length()) );
|
||||
/*
|
||||
Note that, under wxUSE_UNICODE_UTF8 and wxUSE_STD_STRING, wxStringImpl can be
|
||||
initialized with a std::string whether wxUSE_STL_BASED_WXSTRING is 1 or not.
|
||||
*/
|
||||
return FromImpl(utf8);
|
||||
}
|
||||
static wxString FromUTF8(const std::string& utf8)
|
||||
|
|
@ -1623,7 +1625,6 @@ public:
|
|||
}
|
||||
|
||||
std::string utf8_string() const { return m_impl; }
|
||||
#endif
|
||||
|
||||
const wxScopedCharBuffer utf8_str() const
|
||||
{ return wxCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); }
|
||||
|
|
@ -1641,14 +1642,12 @@ public:
|
|||
"string must be valid UTF-8" );
|
||||
return s;
|
||||
}
|
||||
#if wxUSE_STD_STRING
|
||||
static wxString FromUTF8(const std::string& utf8)
|
||||
{ return FromUTF8(utf8.c_str(), utf8.length()); }
|
||||
static wxString FromUTF8Unchecked(const std::string& utf8)
|
||||
{ return FromUTF8Unchecked(utf8.c_str(), utf8.length()); }
|
||||
|
||||
std::string utf8_string() const { return ToStdString(wxMBConvUTF8()); }
|
||||
#endif
|
||||
const wxScopedCharBuffer utf8_str() const { return mb_str(wxMBConvUTF8()); }
|
||||
#else // ANSI
|
||||
static wxString FromUTF8(const char *utf8)
|
||||
|
|
@ -1676,14 +1675,12 @@ public:
|
|||
|
||||
return wxString(buf.data(), wlen);
|
||||
}
|
||||
#if wxUSE_STD_STRING
|
||||
static wxString FromUTF8(const std::string& utf8)
|
||||
{ return FromUTF8(utf8.c_str(), utf8.length()); }
|
||||
static wxString FromUTF8Unchecked(const std::string& utf8)
|
||||
{ return FromUTF8Unchecked(utf8.c_str(), utf8.length()); }
|
||||
|
||||
std::string utf8_string() const { return ToStdString(wxMBConvUTF8()); }
|
||||
#endif
|
||||
const wxScopedCharBuffer utf8_str() const
|
||||
{
|
||||
if (empty())
|
||||
|
|
@ -1798,7 +1795,6 @@ public:
|
|||
{ return operator=(wxUniChar(ch)); }
|
||||
// from a C string - STL probably will crash on nullptr,
|
||||
// so we need to compensate in that case
|
||||
#if wxUSE_STL_BASED_WXSTRING
|
||||
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||
wxString& operator=(const char *psz)
|
||||
{
|
||||
|
|
@ -1824,27 +1820,6 @@ public:
|
|||
|
||||
return *this;
|
||||
}
|
||||
#else // !wxUSE_STL_BASED_WXSTRING
|
||||
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||
wxString& operator=(const char *psz)
|
||||
{
|
||||
wxSTRING_INVALIDATE_CACHE();
|
||||
|
||||
m_impl = ImplStr(psz);
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||
|
||||
wxString& operator=(const wchar_t *pwz)
|
||||
{
|
||||
wxSTRING_INVALIDATE_CACHE();
|
||||
|
||||
m_impl = ImplStr(pwz);
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif // wxUSE_STL_BASED_WXSTRING/!wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||
wxString& operator=(const unsigned char *psz)
|
||||
|
|
@ -3081,7 +3056,7 @@ public:
|
|||
{ return rfind(wxUniChar(ch), nStart); }
|
||||
|
||||
// find first/last occurrence of any character (not) in the set:
|
||||
#if wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
|
||||
#if !wxUSE_UNICODE_UTF8
|
||||
// FIXME-UTF8: this is not entirely correct, because it doesn't work if
|
||||
// sizeof(wchar_t)==2 and surrogates are present in the string;
|
||||
// should we care? Probably not.
|
||||
|
|
@ -3217,7 +3192,7 @@ public:
|
|||
size_t find_last_not_of(const wchar_t* sz, size_t nStart, size_t n) const;
|
||||
// same as above
|
||||
size_t find_last_not_of(wxUniChar ch, size_t nStart = npos) const;
|
||||
#endif // wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8 or not
|
||||
#endif // !wxUSE_UNICODE_UTF8
|
||||
|
||||
// provide char/wchar_t/wxUniCharRef overloads for char-finding functions
|
||||
// above to resolve ambiguities:
|
||||
|
|
@ -3398,28 +3373,6 @@ public:
|
|||
wxString& operator+=(wchar_t ch) { return *this += wxUniChar(ch); }
|
||||
|
||||
private:
|
||||
#if !wxUSE_STL_BASED_WXSTRING
|
||||
// helpers for wxStringBuffer and wxStringBufferLength
|
||||
wxStringCharType *DoGetWriteBuf(size_t nLen)
|
||||
{
|
||||
return m_impl.DoGetWriteBuf(nLen);
|
||||
}
|
||||
|
||||
void DoUngetWriteBuf()
|
||||
{
|
||||
wxSTRING_INVALIDATE_CACHE();
|
||||
|
||||
m_impl.DoUngetWriteBuf();
|
||||
}
|
||||
|
||||
void DoUngetWriteBuf(size_t nLen)
|
||||
{
|
||||
wxSTRING_INVALIDATE_CACHE();
|
||||
|
||||
m_impl.DoUngetWriteBuf(nLen);
|
||||
}
|
||||
#endif // !wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
#if !wxUSE_UTF8_LOCALE_ONLY
|
||||
int DoPrintfWchar(const wxChar *format, ...);
|
||||
static wxString DoFormatWchar(const wxChar *format, ...);
|
||||
|
|
@ -3429,11 +3382,6 @@ private:
|
|||
static wxString DoFormatUtf8(const char *format, ...);
|
||||
#endif
|
||||
|
||||
#if !wxUSE_STL_BASED_WXSTRING
|
||||
// check string's data validity
|
||||
bool IsValid() const { return m_impl.GetStringData()->IsValid(); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
wxStringImpl m_impl;
|
||||
|
||||
|
|
@ -3681,61 +3629,6 @@ struct wxStringAsBufHelper<wchar_t>
|
|||
// wxStringBuffer: a tiny class allowing to get a writable pointer into string
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if !wxUSE_STL_BASED_WXSTRING
|
||||
// string buffer for direct access to string data in their native
|
||||
// representation:
|
||||
class wxStringInternalBuffer
|
||||
{
|
||||
public:
|
||||
typedef wxStringCharType CharType;
|
||||
|
||||
wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024)
|
||||
: m_str(str), m_buf(nullptr)
|
||||
{ m_buf = m_str.DoGetWriteBuf(lenWanted); }
|
||||
|
||||
~wxStringInternalBuffer() { m_str.DoUngetWriteBuf(); }
|
||||
|
||||
operator wxStringCharType*() const { return m_buf; }
|
||||
|
||||
private:
|
||||
wxString& m_str;
|
||||
wxStringCharType *m_buf;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer);
|
||||
};
|
||||
|
||||
class wxStringInternalBufferLength
|
||||
{
|
||||
public:
|
||||
typedef wxStringCharType CharType;
|
||||
|
||||
wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024)
|
||||
: m_str(str), m_buf(nullptr), m_len(0), m_lenSet(false)
|
||||
{
|
||||
m_buf = m_str.DoGetWriteBuf(lenWanted);
|
||||
wxASSERT(m_buf != nullptr);
|
||||
}
|
||||
|
||||
~wxStringInternalBufferLength()
|
||||
{
|
||||
wxASSERT(m_lenSet);
|
||||
m_str.DoUngetWriteBuf(m_len);
|
||||
}
|
||||
|
||||
operator wxStringCharType*() const { return m_buf; }
|
||||
void SetLength(size_t length) { m_len = length; m_lenSet = true; }
|
||||
|
||||
private:
|
||||
wxString& m_str;
|
||||
wxStringCharType *m_buf;
|
||||
size_t m_len;
|
||||
bool m_lenSet;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength);
|
||||
};
|
||||
|
||||
#endif // !wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
template<typename T>
|
||||
class wxStringTypeBufferBase
|
||||
{
|
||||
|
|
@ -3828,8 +3721,6 @@ public:
|
|||
wxDECLARE_NO_COPY_CLASS(wxStringTypeBufferLength);
|
||||
};
|
||||
|
||||
#if wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
class wxStringInternalBuffer : public wxStringTypeBufferBase<wxStringCharType>
|
||||
{
|
||||
public:
|
||||
|
|
@ -3856,16 +3747,13 @@ public:
|
|||
wxDECLARE_NO_COPY_CLASS(wxStringInternalBufferLength);
|
||||
};
|
||||
|
||||
#endif // wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
|
||||
#if wxUSE_STL_BASED_WXSTRING || wxUSE_UNICODE_UTF8
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
typedef wxStringTypeBuffer<wxChar> wxStringBuffer;
|
||||
typedef wxStringTypeBufferLength<wxChar> wxStringBufferLength;
|
||||
#else // if !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
|
||||
#else // !wxUSE_UNICODE_UTF8
|
||||
typedef wxStringInternalBuffer wxStringBuffer;
|
||||
typedef wxStringInternalBufferLength wxStringBufferLength;
|
||||
#endif // !wxUSE_STL_BASED_WXSTRING && !wxUSE_UNICODE_UTF8
|
||||
#endif // wxUSE_UNICODE_UTF8/!wxUSE_UNICODE_UTF8
|
||||
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
typedef wxStringInternalBuffer wxUTF8StringBuffer;
|
||||
|
|
@ -4063,11 +3951,6 @@ wxDEFINE_ALL_COMPARISONS(const char *, const wxCStrData&, wxCMP_CHAR_CSTRDATA)
|
|||
// Implement hashing using C++11 std::hash<>.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Don't do this if ToStdWstring() is not available. We could work around it
|
||||
// but, presumably, if using std::wstring is undesirable, then so is using
|
||||
// std::hash<> anyhow.
|
||||
#if wxUSE_STD_STRING
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace std
|
||||
|
|
@ -4082,8 +3965,6 @@ namespace std
|
|||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // wxUSE_STD_STRING
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Implementation only from here until the end of file
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,552 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/stringimpl.h
|
||||
// Purpose: wxStringImpl class, implementation of wxString
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 29/01/98
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
This header implements std::string-like string class, wxStringImpl, that is
|
||||
used by wxString to store the data. Alternatively, if wxUSE_STD_STRING=1,
|
||||
wxStringImpl is just a typedef to std:: string class.
|
||||
*/
|
||||
|
||||
#ifndef _WX_WXSTRINGIMPL_H__
|
||||
#define _WX_WXSTRINGIMPL_H__
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/defs.h" // everybody should include this
|
||||
#include "wx/chartype.h" // for wxChar
|
||||
#include "wx/wxcrtbase.h" // for wxStrlen() etc.
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// macros
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// implementation only
|
||||
#define wxASSERT_VALID_INDEX(i) \
|
||||
wxASSERT_MSG( (size_t)(i) <= length(), wxT("invalid index in wxString") )
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// global pointer to empty string
|
||||
extern WXDLLIMPEXP_DATA_BASE(const wxChar*) wxEmptyString;
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
// FIXME-UTF8: we should have only one wxEmptyString
|
||||
extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl;
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// deal with various build options
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// we use STL-based string internally if we use std::string at all now, there
|
||||
// should be no reason to prefer our internal implement but if you really need
|
||||
// it you can predefine wxUSE_STL_BASED_WXSTRING as 0 when building the library
|
||||
#ifndef wxUSE_STL_BASED_WXSTRING
|
||||
#define wxUSE_STL_BASED_WXSTRING wxUSE_STD_STRING
|
||||
#endif
|
||||
|
||||
// in both cases we need to define wxStdString
|
||||
#if wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING
|
||||
|
||||
#include "wx/beforestd.h"
|
||||
#include <string>
|
||||
#include "wx/afterstd.h"
|
||||
|
||||
// Define this for compatibility only, it is not used any longer.
|
||||
typedef std::wstring wxStdWideString;
|
||||
|
||||
#if wxUSE_UNICODE_WCHAR
|
||||
typedef std::wstring wxStdString;
|
||||
#else
|
||||
typedef std::string wxStdString;
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_STL_BASED_WXSTRING || wxUSE_STD_STRING
|
||||
|
||||
|
||||
#if wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
// we always want ctor from std::string when using std::string internally
|
||||
#undef wxUSE_STD_STRING
|
||||
#define wxUSE_STD_STRING 1
|
||||
|
||||
typedef wxStdString wxStringImpl;
|
||||
#else // if !wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// string data prepended with some housekeeping info (used by wxString class),
|
||||
// is never used directly (but had to be put here to allow inlining)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
struct WXDLLIMPEXP_BASE wxStringData
|
||||
{
|
||||
int nRefs; // reference count
|
||||
size_t nDataLength, // actual string length
|
||||
nAllocLength; // allocated memory size
|
||||
|
||||
// mimics declaration 'wxStringCharType data[nAllocLength]'
|
||||
wxStringCharType* data() { return reinterpret_cast<wxStringCharType*>(this + 1); }
|
||||
const wxStringCharType* data() const { return reinterpret_cast<const wxStringCharType*>(this + 1); }
|
||||
|
||||
// empty string has a special ref count so it's never deleted
|
||||
bool IsEmpty() const { return (nRefs == -1); }
|
||||
bool IsShared() const { return (nRefs > 1); }
|
||||
|
||||
// lock/unlock
|
||||
void Lock() { if ( !IsEmpty() ) nRefs++; }
|
||||
|
||||
// VC++ will refuse to inline Unlock but profiling shows that it is wrong
|
||||
#if defined(__VISUALC__)
|
||||
__forceinline
|
||||
#endif
|
||||
// VC++ free must take place in same DLL as allocation when using non dll
|
||||
// run-time library (e.g. Multithreaded instead of Multithreaded DLL)
|
||||
#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL)
|
||||
void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); }
|
||||
// we must not inline deallocation since allocation is not inlined
|
||||
void Free();
|
||||
#else
|
||||
void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); }
|
||||
#endif
|
||||
|
||||
// if we had taken control over string memory (GetWriteBuf), it's
|
||||
// intentionally put in invalid state
|
||||
void Validate(bool b) { nRefs = (b ? 1 : 0); }
|
||||
bool IsValid() const { return (nRefs != 0); }
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxStringImpl
|
||||
{
|
||||
public:
|
||||
// an 'invalid' value for string index, moved to this place due to a CW bug
|
||||
static const size_t npos;
|
||||
|
||||
protected:
|
||||
// points to data preceded by wxStringData structure with ref count info
|
||||
wxStringCharType *m_pchData;
|
||||
|
||||
// accessor to string data
|
||||
wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; }
|
||||
|
||||
// string (re)initialization functions
|
||||
// initializes the string to the empty value (must be called only from
|
||||
// ctors, use Reinit() otherwise)
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
void Init() { m_pchData = const_cast<wxStringCharType*>(wxEmptyStringImpl); } // FIXME-UTF8
|
||||
#else
|
||||
void Init() { m_pchData = const_cast<wxStringCharType*>(wxEmptyString); }
|
||||
#endif
|
||||
// initializes the string with (a part of) C-string
|
||||
void InitWith(const wxStringCharType *psz, size_t nPos = 0, size_t nLen = npos);
|
||||
// as Init, but also frees old data
|
||||
void Reinit() { GetStringData()->Unlock(); Init(); }
|
||||
|
||||
// memory allocation
|
||||
// allocates memory for string of length nLen
|
||||
bool AllocBuffer(size_t nLen);
|
||||
// effectively copies data to string
|
||||
bool AssignCopy(size_t, const wxStringCharType *);
|
||||
|
||||
// append a (sub)string
|
||||
bool ConcatSelf(size_t nLen, const wxStringCharType *src, size_t nMaxLen);
|
||||
bool ConcatSelf(size_t nLen, const wxStringCharType *src)
|
||||
{ return ConcatSelf(nLen, src, nLen); }
|
||||
|
||||
// functions called before writing to the string: they copy it if there
|
||||
// are other references to our data (should be the only owner when writing)
|
||||
bool CopyBeforeWrite();
|
||||
bool AllocBeforeWrite(size_t);
|
||||
|
||||
// compatibility with wxString
|
||||
bool Alloc(size_t nLen);
|
||||
|
||||
public:
|
||||
// standard types
|
||||
typedef wxStringCharType value_type;
|
||||
typedef wxStringCharType char_type;
|
||||
typedef size_t size_type;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
|
||||
// macro to define the bulk of iterator and const_iterator classes
|
||||
#define WX_DEFINE_STRINGIMPL_ITERATOR(iterator_name, ref_type, ptr_type) \
|
||||
public: \
|
||||
typedef wxStringCharType value_type; \
|
||||
typedef ref_type reference; \
|
||||
typedef ptr_type pointer; \
|
||||
typedef int difference_type; \
|
||||
\
|
||||
iterator_name() : m_ptr(nullptr) { } \
|
||||
iterator_name(pointer ptr) : m_ptr(ptr) { } \
|
||||
\
|
||||
reference operator*() const { return *m_ptr; } \
|
||||
\
|
||||
iterator_name& operator++() { m_ptr++; return *this; } \
|
||||
iterator_name operator++(int) \
|
||||
{ \
|
||||
const iterator_name tmp(*this); \
|
||||
m_ptr++; \
|
||||
return tmp; \
|
||||
} \
|
||||
\
|
||||
iterator_name& operator--() { m_ptr--; return *this; } \
|
||||
iterator_name operator--(int) \
|
||||
{ \
|
||||
const iterator_name tmp(*this); \
|
||||
m_ptr--; \
|
||||
return tmp; \
|
||||
} \
|
||||
\
|
||||
iterator_name operator+(ptrdiff_t n) const \
|
||||
{ return iterator_name(m_ptr + n); } \
|
||||
iterator_name operator-(ptrdiff_t n) const \
|
||||
{ return iterator_name(m_ptr - n); } \
|
||||
iterator_name& operator+=(ptrdiff_t n) \
|
||||
{ m_ptr += n; return *this; } \
|
||||
iterator_name& operator-=(ptrdiff_t n) \
|
||||
{ m_ptr -= n; return *this; } \
|
||||
\
|
||||
difference_type operator-(const iterator_name& i) const \
|
||||
{ return m_ptr - i.m_ptr; } \
|
||||
\
|
||||
bool operator==(const iterator_name& i) const \
|
||||
{ return m_ptr == i.m_ptr; } \
|
||||
bool operator!=(const iterator_name& i) const \
|
||||
{ return m_ptr != i.m_ptr; } \
|
||||
\
|
||||
bool operator<(const iterator_name& i) const \
|
||||
{ return m_ptr < i.m_ptr; } \
|
||||
bool operator>(const iterator_name& i) const \
|
||||
{ return m_ptr > i.m_ptr; } \
|
||||
bool operator<=(const iterator_name& i) const \
|
||||
{ return m_ptr <= i.m_ptr; } \
|
||||
bool operator>=(const iterator_name& i) const \
|
||||
{ return m_ptr >= i.m_ptr; } \
|
||||
\
|
||||
private: \
|
||||
/* for wxStringImpl use only */ \
|
||||
pointer GetPtr() const { return m_ptr; } \
|
||||
\
|
||||
friend class wxStringImpl; \
|
||||
\
|
||||
pointer m_ptr
|
||||
|
||||
// we need to declare const_iterator in wxStringImpl scope, the friend
|
||||
// declaration inside iterator class itself is not enough, or at least not
|
||||
// for g++ 3.4 (g++ 4 is ok)
|
||||
class WXDLLIMPEXP_FWD_BASE const_iterator;
|
||||
|
||||
class WXDLLIMPEXP_BASE iterator
|
||||
{
|
||||
WX_DEFINE_STRINGIMPL_ITERATOR(iterator,
|
||||
wxStringCharType&,
|
||||
wxStringCharType*);
|
||||
|
||||
friend class const_iterator;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE const_iterator
|
||||
{
|
||||
public:
|
||||
const_iterator(iterator i) : m_ptr(i.m_ptr) { }
|
||||
|
||||
WX_DEFINE_STRINGIMPL_ITERATOR(const_iterator,
|
||||
const wxStringCharType&,
|
||||
const wxStringCharType*);
|
||||
};
|
||||
|
||||
#undef WX_DEFINE_STRINGIMPL_ITERATOR
|
||||
|
||||
|
||||
// constructors and destructor
|
||||
// ctor for an empty string
|
||||
wxStringImpl() { Init(); }
|
||||
// copy ctor
|
||||
wxStringImpl(const wxStringImpl& stringSrc)
|
||||
{
|
||||
wxASSERT_MSG( stringSrc.GetStringData()->IsValid(),
|
||||
wxT("did you forget to call UngetWriteBuf()?") );
|
||||
|
||||
if ( stringSrc.empty() ) {
|
||||
// nothing to do for an empty string
|
||||
Init();
|
||||
}
|
||||
else {
|
||||
m_pchData = stringSrc.m_pchData; // share same data
|
||||
GetStringData()->Lock(); // => one more copy
|
||||
}
|
||||
}
|
||||
// string containing nRepeat copies of ch
|
||||
wxStringImpl(size_type nRepeat, wxStringCharType ch);
|
||||
// ctor takes first nLength characters from C string
|
||||
// (default value of npos means take all the string)
|
||||
wxStringImpl(const wxStringCharType *psz)
|
||||
{ InitWith(psz, 0, npos); }
|
||||
wxStringImpl(const wxStringCharType *psz, size_t nLength)
|
||||
{ InitWith(psz, 0, nLength); }
|
||||
// take nLen chars starting at nPos
|
||||
wxStringImpl(const wxStringImpl& str, size_t nPos, size_t nLen)
|
||||
{
|
||||
wxASSERT_MSG( str.GetStringData()->IsValid(),
|
||||
wxT("did you forget to call UngetWriteBuf()?") );
|
||||
Init();
|
||||
size_t strLen = str.length() - nPos; nLen = strLen < nLen ? strLen : nLen;
|
||||
InitWith(str.c_str(), nPos, nLen);
|
||||
}
|
||||
// take everything between start and end
|
||||
wxStringImpl(const_iterator start, const_iterator end);
|
||||
|
||||
|
||||
// ctor from and conversion to std::string
|
||||
#if wxUSE_STD_STRING
|
||||
wxStringImpl(const wxStdString& impl)
|
||||
{ InitWith(impl.c_str(), 0, impl.length()); }
|
||||
|
||||
operator wxStdString() const
|
||||
{ return wxStdString(c_str(), length()); }
|
||||
#endif
|
||||
|
||||
#if defined(__VISUALC__)
|
||||
// disable warning about Unlock() below not being inlined (first, it
|
||||
// seems to be inlined nevertheless and second, even if it isn't, there
|
||||
// is nothing we can do about this
|
||||
#pragma warning(push)
|
||||
#pragma warning (disable:4714)
|
||||
#endif
|
||||
|
||||
// dtor is not virtual, this class must not be inherited from!
|
||||
~wxStringImpl()
|
||||
{
|
||||
GetStringData()->Unlock();
|
||||
}
|
||||
|
||||
#if defined(__VISUALC__)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// overloaded assignment
|
||||
// from another wxString
|
||||
wxStringImpl& operator=(const wxStringImpl& stringSrc);
|
||||
// from a character
|
||||
wxStringImpl& operator=(wxStringCharType ch);
|
||||
// from a C string
|
||||
wxStringImpl& operator=(const wxStringCharType *psz);
|
||||
|
||||
// return the length of the string
|
||||
size_type length() const { return GetStringData()->nDataLength; }
|
||||
// return the length of the string
|
||||
size_type size() const { return length(); }
|
||||
// return the maximum size of the string
|
||||
size_type max_size() const { return npos; }
|
||||
// resize the string, filling the space with c if c != 0
|
||||
void resize(size_t nSize, wxStringCharType ch = '\0');
|
||||
// delete the contents of the string
|
||||
void clear() { erase(0, npos); }
|
||||
// returns true if the string is empty
|
||||
bool empty() const { return length() == 0; }
|
||||
// inform string about planned change in size
|
||||
void reserve(size_t sz) { Alloc(sz); }
|
||||
size_type capacity() const { return GetStringData()->nAllocLength; }
|
||||
|
||||
// lib.string.access
|
||||
// return the character at position n
|
||||
value_type operator[](size_type n) const { return m_pchData[n]; }
|
||||
value_type at(size_type n) const
|
||||
{ wxASSERT_VALID_INDEX( n ); return m_pchData[n]; }
|
||||
// returns the writable character at position n
|
||||
reference operator[](size_type n) { CopyBeforeWrite(); return m_pchData[n]; }
|
||||
reference at(size_type n)
|
||||
{
|
||||
wxASSERT_VALID_INDEX( n );
|
||||
CopyBeforeWrite();
|
||||
return m_pchData[n];
|
||||
} // FIXME-UTF8: not useful for us...?
|
||||
|
||||
// lib.string.modifiers
|
||||
// append elements str[pos], ..., str[pos+n]
|
||||
wxStringImpl& append(const wxStringImpl& str, size_t pos, size_t n)
|
||||
{
|
||||
wxASSERT(pos <= str.length());
|
||||
ConcatSelf(n, str.c_str() + pos, str.length() - pos);
|
||||
return *this;
|
||||
}
|
||||
// append a string
|
||||
wxStringImpl& append(const wxStringImpl& str)
|
||||
{ ConcatSelf(str.length(), str.c_str()); return *this; }
|
||||
// append first n (or all if n == npos) characters of sz
|
||||
wxStringImpl& append(const wxStringCharType *sz)
|
||||
{ ConcatSelf(wxStrlen(sz), sz); return *this; }
|
||||
wxStringImpl& append(const wxStringCharType *sz, size_t n)
|
||||
{ ConcatSelf(n, sz); return *this; }
|
||||
// append n copies of ch
|
||||
wxStringImpl& append(size_t n, wxStringCharType ch);
|
||||
// append from first to last
|
||||
wxStringImpl& append(const_iterator first, const_iterator last)
|
||||
{ ConcatSelf(last - first, first.GetPtr()); return *this; }
|
||||
|
||||
// same as `this_string = str'
|
||||
wxStringImpl& assign(const wxStringImpl& str)
|
||||
{ return *this = str; }
|
||||
// same as ` = str[pos..pos + n]
|
||||
wxStringImpl& assign(const wxStringImpl& str, size_t pos, size_t n)
|
||||
{ return replace(0, npos, str, pos, n); }
|
||||
// same as `= first n (or all if n == npos) characters of sz'
|
||||
wxStringImpl& assign(const wxStringCharType *sz)
|
||||
{ return replace(0, npos, sz, wxStrlen(sz)); }
|
||||
wxStringImpl& assign(const wxStringCharType *sz, size_t n)
|
||||
{ return replace(0, npos, sz, n); }
|
||||
// same as `= n copies of ch'
|
||||
wxStringImpl& assign(size_t n, wxStringCharType ch)
|
||||
{ return replace(0, npos, n, ch); }
|
||||
// assign from first to last
|
||||
wxStringImpl& assign(const_iterator first, const_iterator last)
|
||||
{ return replace(begin(), end(), first, last); }
|
||||
|
||||
// first valid index position
|
||||
const_iterator begin() const { return m_pchData; }
|
||||
iterator begin();
|
||||
// position one after the last valid one
|
||||
const_iterator end() const { return m_pchData + length(); }
|
||||
iterator end();
|
||||
|
||||
// insert another string
|
||||
wxStringImpl& insert(size_t nPos, const wxStringImpl& str)
|
||||
{
|
||||
wxASSERT( str.GetStringData()->IsValid() );
|
||||
return insert(nPos, str.c_str(), str.length());
|
||||
}
|
||||
// insert n chars of str starting at nStart (in str)
|
||||
wxStringImpl& insert(size_t nPos, const wxStringImpl& str, size_t nStart, size_t n)
|
||||
{
|
||||
wxASSERT( str.GetStringData()->IsValid() );
|
||||
wxASSERT( nStart < str.length() );
|
||||
size_t strLen = str.length() - nStart;
|
||||
n = strLen < n ? strLen : n;
|
||||
return insert(nPos, str.c_str() + nStart, n);
|
||||
}
|
||||
// insert first n (or all if n == npos) characters of sz
|
||||
wxStringImpl& insert(size_t nPos, const wxStringCharType *sz, size_t n = npos);
|
||||
// insert n copies of ch
|
||||
wxStringImpl& insert(size_t nPos, size_t n, wxStringCharType ch)
|
||||
{ return insert(nPos, wxStringImpl(n, ch)); }
|
||||
iterator insert(iterator it, wxStringCharType ch)
|
||||
{ size_t idx = it - begin(); insert(idx, 1, ch); return begin() + idx; }
|
||||
void insert(iterator it, const_iterator first, const_iterator last)
|
||||
{ insert(it - begin(), first.GetPtr(), last - first); }
|
||||
void insert(iterator it, size_type n, wxStringCharType ch)
|
||||
{ insert(it - begin(), n, ch); }
|
||||
|
||||
// delete characters from nStart to nStart + nLen
|
||||
wxStringImpl& erase(size_type pos = 0, size_type n = npos);
|
||||
iterator erase(iterator first, iterator last)
|
||||
{
|
||||
size_t idx = first - begin();
|
||||
erase(idx, last - first);
|
||||
return begin() + idx;
|
||||
}
|
||||
iterator erase(iterator first);
|
||||
|
||||
// explicit conversion to C string (use this with printf()!)
|
||||
const wxStringCharType* c_str() const { return m_pchData; }
|
||||
const wxStringCharType* data() const { return m_pchData; }
|
||||
|
||||
// replaces the substring of length nLen starting at nStart
|
||||
wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringCharType* sz)
|
||||
{ return replace(nStart, nLen, sz, npos); }
|
||||
// replaces the substring of length nLen starting at nStart
|
||||
wxStringImpl& replace(size_t nStart, size_t nLen, const wxStringImpl& str)
|
||||
{ return replace(nStart, nLen, str.c_str(), str.length()); }
|
||||
// replaces the substring with nCount copies of ch
|
||||
wxStringImpl& replace(size_t nStart, size_t nLen,
|
||||
size_t nCount, wxStringCharType ch)
|
||||
{ return replace(nStart, nLen, wxStringImpl(nCount, ch)); }
|
||||
// replaces a substring with another substring
|
||||
wxStringImpl& replace(size_t nStart, size_t nLen,
|
||||
const wxStringImpl& str, size_t nStart2, size_t nLen2)
|
||||
{ return replace(nStart, nLen, str.substr(nStart2, nLen2)); }
|
||||
// replaces the substring with first nCount chars of sz
|
||||
wxStringImpl& replace(size_t nStart, size_t nLen,
|
||||
const wxStringCharType* sz, size_t nCount);
|
||||
|
||||
wxStringImpl& replace(iterator first, iterator last, const_pointer s)
|
||||
{ return replace(first - begin(), last - first, s); }
|
||||
wxStringImpl& replace(iterator first, iterator last, const_pointer s,
|
||||
size_type n)
|
||||
{ return replace(first - begin(), last - first, s, n); }
|
||||
wxStringImpl& replace(iterator first, iterator last, const wxStringImpl& s)
|
||||
{ return replace(first - begin(), last - first, s); }
|
||||
wxStringImpl& replace(iterator first, iterator last, size_type n, wxStringCharType c)
|
||||
{ return replace(first - begin(), last - first, n, c); }
|
||||
wxStringImpl& replace(iterator first, iterator last,
|
||||
const_iterator first1, const_iterator last1)
|
||||
{ return replace(first - begin(), last - first, first1.GetPtr(), last1 - first1); }
|
||||
|
||||
// swap two strings
|
||||
void swap(wxStringImpl& str);
|
||||
|
||||
// All find() functions take the nStart argument which specifies the
|
||||
// position to start the search on, the default value is 0. All functions
|
||||
// return npos if there were no match.
|
||||
|
||||
// find a substring
|
||||
size_t find(const wxStringImpl& str, size_t nStart = 0) const;
|
||||
|
||||
// find first n characters of sz
|
||||
size_t find(const wxStringCharType* sz, size_t nStart = 0, size_t n = npos) const;
|
||||
|
||||
// find the first occurrence of character ch after nStart
|
||||
size_t find(wxStringCharType ch, size_t nStart = 0) const;
|
||||
|
||||
// rfind() family is exactly like find() but works right to left
|
||||
|
||||
// as find, but from the end
|
||||
size_t rfind(const wxStringImpl& str, size_t nStart = npos) const;
|
||||
|
||||
// as find, but from the end
|
||||
size_t rfind(const wxStringCharType* sz, size_t nStart = npos,
|
||||
size_t n = npos) const;
|
||||
// as find, but from the end
|
||||
size_t rfind(wxStringCharType ch, size_t nStart = npos) const;
|
||||
|
||||
size_type copy(wxStringCharType* s, size_type n, size_type pos = 0);
|
||||
|
||||
// substring extraction
|
||||
wxStringImpl substr(size_t nStart = 0, size_t nLen = npos) const;
|
||||
|
||||
// string += string
|
||||
wxStringImpl& operator+=(const wxStringImpl& s) { return append(s); }
|
||||
// string += C string
|
||||
wxStringImpl& operator+=(const wxStringCharType *psz) { return append(psz); }
|
||||
// string += char
|
||||
wxStringImpl& operator+=(wxStringCharType ch) { return append(1, ch); }
|
||||
|
||||
// helpers for wxStringBuffer and wxStringBufferLength
|
||||
wxStringCharType *DoGetWriteBuf(size_t nLen);
|
||||
void DoUngetWriteBuf();
|
||||
void DoUngetWriteBuf(size_t nLen);
|
||||
|
||||
friend class WXDLLIMPEXP_FWD_BASE wxString;
|
||||
};
|
||||
|
||||
#endif // !wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
// don't pollute the library user's name space
|
||||
#undef wxASSERT_VALID_INDEX
|
||||
|
||||
#endif // _WX_WXSTRINGIMPL_H__
|
||||
|
|
@ -12,10 +12,13 @@
|
|||
#define _WX_WXSTRINGOPS_H__
|
||||
|
||||
#include "wx/chartype.h"
|
||||
#include "wx/stringimpl.h"
|
||||
#include "wx/unichar.h"
|
||||
#include "wx/buffer.h"
|
||||
|
||||
#include "wx/beforestd.h"
|
||||
#include <string>
|
||||
#include "wx/afterstd.h"
|
||||
|
||||
// This header contains wxStringOperations "namespace" class that implements
|
||||
// elementary operations on string data as static methods; wxString methods and
|
||||
// iterators are implemented in terms of it. Two implementations are available,
|
||||
|
|
@ -76,7 +79,7 @@ struct WXDLLIMPEXP_BASE wxStringOperationsWchar
|
|||
static bool IsSingleCodeUnitCharacter(const wxUniChar&) { return true; }
|
||||
#endif
|
||||
|
||||
static wxUniChar DecodeChar(const wxStringImpl::const_iterator& i)
|
||||
static wxUniChar DecodeChar(const std::wstring::const_iterator& i)
|
||||
{ return *i; }
|
||||
};
|
||||
#endif // wxUSE_UNICODE_WCHAR
|
||||
|
|
@ -87,7 +90,7 @@ struct WXDLLIMPEXP_BASE wxStringOperationsUtf8
|
|||
{
|
||||
// checks correctness of UTF-8 sequence
|
||||
static bool IsValidUtf8String(const char *c,
|
||||
size_t len = wxStringImpl::npos);
|
||||
size_t len = std::string::npos);
|
||||
static bool IsValidUtf8LeadByte(unsigned char c)
|
||||
{
|
||||
return (c <= 0x7F) || (c >= 0xC2 && c <= 0xF4);
|
||||
|
|
@ -181,7 +184,7 @@ struct WXDLLIMPEXP_BASE wxStringOperationsUtf8
|
|||
}
|
||||
|
||||
// decodes single UTF-8 character from UTF-8 string
|
||||
static wxUniChar DecodeChar(wxStringImpl::const_iterator i)
|
||||
static wxUniChar DecodeChar(std::string::const_iterator i)
|
||||
{
|
||||
if ( (unsigned char)*i < 0x80 )
|
||||
return (int)*i;
|
||||
|
|
@ -189,7 +192,7 @@ struct WXDLLIMPEXP_BASE wxStringOperationsUtf8
|
|||
}
|
||||
|
||||
private:
|
||||
static wxUniChar DecodeNonAsciiChar(wxStringImpl::const_iterator i);
|
||||
static wxUniChar DecodeNonAsciiChar(std::string::const_iterator i);
|
||||
};
|
||||
#endif // wxUSE_UNICODE_UTF8
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,13 @@
|
|||
#include "wx/buffer.h"
|
||||
#include "wx/unichar.h"
|
||||
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#ifdef __cpp_lib_string_view
|
||||
#include <string_view>
|
||||
#endif // __cpp_lib_string_view
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxCStrData;
|
||||
class WXDLLIMPEXP_FWD_BASE wxString;
|
||||
|
||||
|
|
@ -721,18 +726,7 @@ WX_ARG_NORMALIZER_FORWARD(const wxCharBuffer&, const char*);
|
|||
WX_ARG_NORMALIZER_FORWARD(wxWCharBuffer, const wchar_t*);
|
||||
WX_ARG_NORMALIZER_FORWARD(const wxWCharBuffer&, const wchar_t*);
|
||||
|
||||
// versions for std::[w]string:
|
||||
#if wxUSE_STD_STRING
|
||||
|
||||
#include "wx/stringimpl.h"
|
||||
|
||||
// And also string_view, if we have it (notice that <string> was included from
|
||||
// wx/stringimpl.h above, so __cpp_lib_string_view should be defined if it's
|
||||
// supported).
|
||||
#ifdef __cpp_lib_string_view
|
||||
#include <string_view>
|
||||
#endif // __cpp_lib_string_view
|
||||
|
||||
// versions for std::[w]string and string_view, if we have it.
|
||||
#if !wxUSE_UTF8_LOCALE_ONLY
|
||||
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
|
||||
template<>
|
||||
|
|
@ -813,8 +807,6 @@ WX_ARG_NORMALIZER_FORWARD(std::string_view, const std::string_view&);
|
|||
#endif
|
||||
WX_ARG_NORMALIZER_FORWARD(std::wstring, const std::wstring&);
|
||||
|
||||
#endif // wxUSE_STD_STRING
|
||||
|
||||
|
||||
// versions for wxUniChar, wxUniCharRef:
|
||||
// (this is same for UTF-8 and Wchar builds, we just convert to wchar_t)
|
||||
|
|
|
|||
|
|
@ -12,14 +12,9 @@
|
|||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/chartype.h"
|
||||
#include "wx/stringimpl.h"
|
||||
|
||||
// We need to get std::swap() declaration in order to specialize it below and
|
||||
// it is declared in different headers for C++98 and C++11. Instead of testing
|
||||
// which one is being used, just include both of them as it's simpler and less
|
||||
// error-prone.
|
||||
#include <algorithm> // std::swap() for C++98
|
||||
#include <utility> // std::swap() for C++11
|
||||
#include <string>
|
||||
#include <utility> // std::swap() which we specialize below
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxUniCharRef;
|
||||
class WXDLLIMPEXP_FWD_BASE wxString;
|
||||
|
|
@ -210,7 +205,11 @@ private:
|
|||
class WXDLLIMPEXP_BASE wxUniCharRef
|
||||
{
|
||||
private:
|
||||
typedef wxStringImpl::iterator iterator;
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
typedef std::string::iterator iterator;
|
||||
#else
|
||||
typedef std::wstring::iterator iterator;
|
||||
#endif
|
||||
|
||||
// create the reference
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
|
|
|
|||
|
|
@ -614,8 +614,8 @@ WXDLLIMPEXP_BASE size_t wxCRT_StrftimeW(wchar_t *s, size_t max,
|
|||
#ifdef __cplusplus
|
||||
|
||||
/* NB: this belongs to wxcrt.h and not this header, but it makes life easier
|
||||
* for buffer.h and stringimpl.h (both of which must be included before
|
||||
* string.h, which is required by wxcrt.h) to have them here: */
|
||||
* for buffer.h which must be included before string.h, which is required
|
||||
* by wxcrt.h, to have them here: */
|
||||
|
||||
/* safe version of strlen() (returns 0 if passed null pointer) */
|
||||
inline size_t wxStrlen(const char *s) { return s ? wxCRT_StrlenA(s) : 0; }
|
||||
|
|
|
|||
|
|
@ -175,7 +175,6 @@ OBJECTS1=fs_inet.obj,\
|
|||
strconv.obj,\
|
||||
stream.obj,\
|
||||
string.obj,\
|
||||
stringimpl.obj,\
|
||||
stringops.obj,\
|
||||
strvararg.obj,\
|
||||
sysopt.obj
|
||||
|
|
@ -376,7 +375,6 @@ SOURCES = \
|
|||
strvararg.cpp,\
|
||||
sysopt.cpp,\
|
||||
string.cpp,\
|
||||
stringimpl.cpp,\
|
||||
stringops.cpp,\
|
||||
tbarbase.cpp,\
|
||||
textbuf.cpp,\
|
||||
|
|
@ -615,7 +613,6 @@ stream.obj : stream.cpp
|
|||
strvararg.obj : strvararg.cpp
|
||||
sysopt.obj : sysopt.cpp
|
||||
string.obj : string.cpp
|
||||
stringimpl.obj : stringimpl.cpp
|
||||
stringops.obj : stringops.cpp
|
||||
tbarbase.obj : tbarbase.cpp
|
||||
textbuf.obj : textbuf.cpp
|
||||
|
|
|
|||
|
|
@ -79,6 +79,11 @@ UntypedBufferData *GetUntypedNullData()
|
|||
//According to STL _must_ be a -1 size_t
|
||||
const size_t wxString::npos = (size_t) -1;
|
||||
|
||||
// FIXME-UTF8: get rid of this, have only one wxEmptyString
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
const wxStringCharType WXDLLIMPEXP_BASE *wxEmptyStringImpl = "";
|
||||
#endif
|
||||
const wxChar WXDLLIMPEXP_BASE *wxEmptyString = wxT("");
|
||||
#if wxUSE_STRING_POS_CACHE
|
||||
|
||||
wxTHREAD_SPECIFIC_DECL wxString::Cache wxString::ms_cache;
|
||||
|
|
|
|||
|
|
@ -1,791 +0,0 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/stringimpl.cpp
|
||||
// Purpose: wxString class
|
||||
// Author: Vadim Zeitlin, Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 29/01/98
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// (c) 2004 Ryan Norton <wxprojects@comcast.net>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
* About ref counting:
|
||||
* 1) all empty strings use g_strEmpty, nRefs = -1 (set in Init())
|
||||
* 2) AllocBuffer() sets nRefs to 1, Lock() increments it by one
|
||||
* 3) Unlock() decrements nRefs and frees memory if it goes to 0
|
||||
*/
|
||||
|
||||
// ===========================================================================
|
||||
// headers, declarations, constants
|
||||
// ===========================================================================
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/stringimpl.h"
|
||||
#include "wx/wxcrt.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// static class variables definition
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#if !wxUSE_STL_BASED_WXSTRING
|
||||
//According to STL _must_ be a -1 size_t
|
||||
const size_t wxStringImpl::npos = (size_t) -1;
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// static data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
// FIXME-UTF8: get rid of this, have only one wxEmptyString
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
const wxStringCharType WXDLLIMPEXP_BASE *wxEmptyStringImpl = "";
|
||||
#endif
|
||||
const wxChar WXDLLIMPEXP_BASE *wxEmptyString = wxT("");
|
||||
|
||||
#else
|
||||
|
||||
// allocating extra space for each string consumes more memory but speeds up
|
||||
// the concatenation operations (nLen is the current string's length)
|
||||
// NB: EXTRA_ALLOC must be >= 0!
|
||||
#define EXTRA_ALLOC (19 - nLen % 16)
|
||||
|
||||
// string handling functions used by wxString:
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
#define wxStringMemcpy memcpy
|
||||
#define wxStringMemcmp memcmp
|
||||
#define wxStringMemchr memchr
|
||||
#else
|
||||
#define wxStringMemcpy wxTmemcpy
|
||||
#define wxStringMemcmp wxTmemcmp
|
||||
#define wxStringMemchr wxTmemchr
|
||||
#endif
|
||||
|
||||
// for an empty string, GetStringData() will return this address: this
|
||||
// structure has the same layout as wxStringData and it's data() method will
|
||||
// return the empty string (dummy pointer)
|
||||
static const struct
|
||||
{
|
||||
wxStringData data;
|
||||
wxStringCharType dummy;
|
||||
} g_strEmpty = { {-1, 0, 0}, wxT('\0') };
|
||||
|
||||
// empty C style string: points to 'string data' byte of g_strEmpty
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
// FIXME-UTF8: get rid of this, have only one wxEmptyString
|
||||
const wxStringCharType WXDLLIMPEXP_BASE *wxEmptyStringImpl = &g_strEmpty.dummy;
|
||||
const wxChar WXDLLIMPEXP_BASE *wxEmptyString = wxT("");
|
||||
#else
|
||||
const wxStringCharType WXDLLIMPEXP_BASE *wxEmptyString = &g_strEmpty.dummy;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !wxUSE_STL_BASED_WXSTRING
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// this small class is used to gather statistics for performance tuning
|
||||
|
||||
// uncomment this to enable gathering of some statistics about wxString
|
||||
// efficiency
|
||||
//#define WXSTRING_STATISTICS
|
||||
|
||||
#ifdef WXSTRING_STATISTICS
|
||||
class Averager
|
||||
{
|
||||
public:
|
||||
Averager(const wxStringCharType *sz) { m_sz = sz; m_nTotal = m_nCount = 0; }
|
||||
~Averager()
|
||||
{
|
||||
wxPrintf("wxString %s: total = %lu, average = %f\n",
|
||||
m_sz, m_nTotal, ((float)m_nTotal)/m_nCount);
|
||||
}
|
||||
|
||||
void Add(size_t n) { m_nTotal += n; m_nCount++; }
|
||||
|
||||
private:
|
||||
unsigned long m_nCount, m_nTotal;
|
||||
const wxStringCharType *m_sz;
|
||||
} g_averageLength("allocation size"),
|
||||
g_averageSummandLength("summand length"),
|
||||
g_averageConcatHit("hit probability in concat"),
|
||||
g_averageInitialLength("initial string length");
|
||||
|
||||
#define STATISTICS_ADD(av, val) g_average##av.Add(val)
|
||||
#else
|
||||
#define STATISTICS_ADD(av, val)
|
||||
#endif // WXSTRING_STATISTICS
|
||||
|
||||
// ===========================================================================
|
||||
// wxStringData class deallocation
|
||||
// ===========================================================================
|
||||
|
||||
#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL)
|
||||
# pragma message (__FILE__ ": building with Multithreaded non DLL runtime has a performance impact on wxString!")
|
||||
void wxStringData::Free()
|
||||
{
|
||||
free(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ===========================================================================
|
||||
// wxStringImpl
|
||||
// ===========================================================================
|
||||
|
||||
// takes nLength elements of psz starting at nPos
|
||||
void wxStringImpl::InitWith(const wxStringCharType *psz,
|
||||
size_t nPos, size_t nLength)
|
||||
{
|
||||
Init();
|
||||
|
||||
// if the length is not given, assume the string to be NUL terminated
|
||||
if ( nLength == npos ) {
|
||||
wxASSERT_MSG( nPos <= wxStrlen(psz), wxT("index out of bounds") );
|
||||
|
||||
nLength = wxStrlen(psz + nPos);
|
||||
}
|
||||
|
||||
STATISTICS_ADD(InitialLength, nLength);
|
||||
|
||||
if ( nLength > 0 ) {
|
||||
// trailing '\0' is written in AllocBuffer()
|
||||
if ( !AllocBuffer(nLength) ) {
|
||||
wxFAIL_MSG( wxT("out of memory in wxStringImpl::InitWith") );
|
||||
return;
|
||||
}
|
||||
wxStringMemcpy(m_pchData, psz + nPos, nLength);
|
||||
}
|
||||
}
|
||||
|
||||
wxStringImpl::wxStringImpl(const_iterator first, const_iterator last)
|
||||
{
|
||||
if ( last >= first )
|
||||
{
|
||||
InitWith(first.GetPtr(), 0, last - first);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFAIL_MSG( wxT("first must be before last") );
|
||||
Init();
|
||||
}
|
||||
}
|
||||
|
||||
wxStringImpl::wxStringImpl(size_type n, wxStringCharType ch)
|
||||
{
|
||||
Init();
|
||||
append(n, ch);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// memory allocation
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// allocates memory needed to store a C string of length nLen
|
||||
bool wxStringImpl::AllocBuffer(size_t nLen)
|
||||
{
|
||||
// allocating 0 sized buffer doesn't make sense, all empty strings should
|
||||
// reuse g_strEmpty
|
||||
wxASSERT( nLen > 0 );
|
||||
|
||||
// make sure that we don't overflow
|
||||
wxCHECK( nLen < (INT_MAX / sizeof(wxStringCharType)) -
|
||||
(sizeof(wxStringData) + EXTRA_ALLOC + 1), false );
|
||||
|
||||
STATISTICS_ADD(Length, nLen);
|
||||
|
||||
// allocate memory:
|
||||
// 1) one extra character for '\0' termination
|
||||
// 2) sizeof(wxStringData) for housekeeping info
|
||||
wxStringData* pData = (wxStringData*)
|
||||
malloc(sizeof(wxStringData) + (nLen + EXTRA_ALLOC + 1)*sizeof(wxStringCharType));
|
||||
|
||||
if ( pData == nullptr ) {
|
||||
// allocation failures are handled by the caller
|
||||
return false;
|
||||
}
|
||||
|
||||
pData->nRefs = 1;
|
||||
pData->nDataLength = nLen;
|
||||
pData->nAllocLength = nLen + EXTRA_ALLOC;
|
||||
m_pchData = pData->data(); // data starts after wxStringData
|
||||
m_pchData[nLen] = wxT('\0');
|
||||
return true;
|
||||
}
|
||||
|
||||
// must be called before changing this string
|
||||
bool wxStringImpl::CopyBeforeWrite()
|
||||
{
|
||||
wxStringData* pData = GetStringData();
|
||||
|
||||
if ( pData->IsShared() ) {
|
||||
pData->Unlock(); // memory not freed because shared
|
||||
size_t nLen = pData->nDataLength;
|
||||
if ( !AllocBuffer(nLen) ) {
|
||||
// allocation failures are handled by the caller
|
||||
return false;
|
||||
}
|
||||
wxStringMemcpy(m_pchData, pData->data(), nLen);
|
||||
}
|
||||
|
||||
wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// must be called before replacing contents of this string
|
||||
bool wxStringImpl::AllocBeforeWrite(size_t nLen)
|
||||
{
|
||||
wxASSERT( nLen != 0 ); // doesn't make any sense
|
||||
|
||||
// must not share string and must have enough space
|
||||
wxStringData* pData = GetStringData();
|
||||
if ( pData->IsShared() || pData->IsEmpty() ) {
|
||||
// can't work with old buffer, get new one
|
||||
pData->Unlock();
|
||||
if ( !AllocBuffer(nLen) ) {
|
||||
// allocation failures are handled by the caller
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( nLen > pData->nAllocLength ) {
|
||||
// realloc the buffer instead of calling malloc() again, this is more
|
||||
// efficient
|
||||
STATISTICS_ADD(Length, nLen);
|
||||
|
||||
nLen += EXTRA_ALLOC;
|
||||
|
||||
pData = (wxStringData*)
|
||||
realloc(pData,
|
||||
sizeof(wxStringData) + (nLen + 1)*sizeof(wxStringCharType));
|
||||
|
||||
if ( pData == nullptr ) {
|
||||
// allocation failures are handled by the caller
|
||||
// keep previous data since reallocation failed
|
||||
return false;
|
||||
}
|
||||
|
||||
pData->nAllocLength = nLen;
|
||||
m_pchData = pData->data();
|
||||
}
|
||||
}
|
||||
|
||||
wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner
|
||||
|
||||
// it doesn't really matter what the string length is as it's going to be
|
||||
// overwritten later but, for extra safety, set it to 0 for now as we may
|
||||
// have some junk in m_pchData
|
||||
GetStringData()->nDataLength = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxStringImpl& wxStringImpl::append(size_t n, wxStringCharType ch)
|
||||
{
|
||||
size_type len = length();
|
||||
|
||||
if ( !Alloc(len + n) || !CopyBeforeWrite() ) {
|
||||
wxFAIL_MSG( wxT("out of memory in wxStringImpl::append") );
|
||||
return *this;
|
||||
}
|
||||
GetStringData()->nDataLength = len + n;
|
||||
m_pchData[len + n] = '\0';
|
||||
for ( size_t i = 0; i < n; ++i )
|
||||
m_pchData[len + i] = ch;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void wxStringImpl::resize(size_t nSize, wxStringCharType ch)
|
||||
{
|
||||
size_t len = length();
|
||||
|
||||
if ( nSize < len )
|
||||
{
|
||||
erase(begin() + nSize, end());
|
||||
}
|
||||
else if ( nSize > len )
|
||||
{
|
||||
append(nSize - len, ch);
|
||||
}
|
||||
//else: we have exactly the specified length, nothing to do
|
||||
}
|
||||
|
||||
// allocate enough memory for nLen characters
|
||||
bool wxStringImpl::Alloc(size_t nLen)
|
||||
{
|
||||
wxStringData *pData = GetStringData();
|
||||
if ( pData->nAllocLength <= nLen ) {
|
||||
if ( pData->IsEmpty() ) {
|
||||
STATISTICS_ADD(Length, nLen);
|
||||
|
||||
nLen += EXTRA_ALLOC;
|
||||
|
||||
pData = (wxStringData *)
|
||||
malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxStringCharType));
|
||||
|
||||
if ( pData == nullptr ) {
|
||||
// allocation failure handled by caller
|
||||
return false;
|
||||
}
|
||||
|
||||
pData->nRefs = 1;
|
||||
pData->nDataLength = 0;
|
||||
pData->nAllocLength = nLen;
|
||||
m_pchData = pData->data(); // data starts after wxStringData
|
||||
m_pchData[0u] = wxT('\0');
|
||||
}
|
||||
else if ( pData->IsShared() ) {
|
||||
pData->Unlock(); // memory not freed because shared
|
||||
size_t nOldLen = pData->nDataLength;
|
||||
if ( !AllocBuffer(nLen) ) {
|
||||
// allocation failure handled by caller
|
||||
return false;
|
||||
}
|
||||
// +1 to copy the terminator, too
|
||||
memcpy(m_pchData, pData->data(), (nOldLen+1)*sizeof(wxStringCharType));
|
||||
GetStringData()->nDataLength = nOldLen;
|
||||
}
|
||||
else {
|
||||
nLen += EXTRA_ALLOC;
|
||||
|
||||
pData = (wxStringData *)
|
||||
realloc(pData, sizeof(wxStringData) + (nLen + 1)*sizeof(wxStringCharType));
|
||||
|
||||
if ( pData == nullptr ) {
|
||||
// allocation failure handled by caller
|
||||
// keep previous data since reallocation failed
|
||||
return false;
|
||||
}
|
||||
|
||||
// it's not important if the pointer changed or not (the check for this
|
||||
// is not faster than assigning to m_pchData in all cases)
|
||||
pData->nAllocLength = nLen;
|
||||
m_pchData = pData->data();
|
||||
}
|
||||
}
|
||||
//else: we've already got enough
|
||||
return true;
|
||||
}
|
||||
|
||||
wxStringImpl::iterator wxStringImpl::begin()
|
||||
{
|
||||
if ( !empty() )
|
||||
CopyBeforeWrite();
|
||||
return m_pchData;
|
||||
}
|
||||
|
||||
wxStringImpl::iterator wxStringImpl::end()
|
||||
{
|
||||
if ( !empty() )
|
||||
CopyBeforeWrite();
|
||||
return m_pchData + length();
|
||||
}
|
||||
|
||||
wxStringImpl::iterator wxStringImpl::erase(iterator it)
|
||||
{
|
||||
size_type idx = it - begin();
|
||||
erase(idx, 1);
|
||||
return begin() + idx;
|
||||
}
|
||||
|
||||
wxStringImpl& wxStringImpl::erase(size_t nStart, size_t nLen)
|
||||
{
|
||||
wxASSERT(nStart <= length());
|
||||
size_t strLen = length() - nStart;
|
||||
// delete nLen or up to the end of the string characters
|
||||
nLen = strLen < nLen ? strLen : nLen;
|
||||
wxStringImpl strTmp(c_str(), nStart);
|
||||
strTmp.append(c_str() + nStart + nLen, length() - nStart - nLen);
|
||||
|
||||
swap(strTmp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxStringImpl& wxStringImpl::insert(size_t nPos,
|
||||
const wxStringCharType *sz, size_t n)
|
||||
{
|
||||
wxASSERT( nPos <= length() );
|
||||
|
||||
if ( n == npos ) n = wxStrlen(sz);
|
||||
if ( n == 0 ) return *this;
|
||||
|
||||
if ( !Alloc(length() + n) || !CopyBeforeWrite() ) {
|
||||
wxFAIL_MSG( wxT("out of memory in wxStringImpl::insert") );
|
||||
return *this;
|
||||
}
|
||||
|
||||
memmove(m_pchData + nPos + n, m_pchData + nPos,
|
||||
(length() - nPos) * sizeof(wxStringCharType));
|
||||
memcpy(m_pchData + nPos, sz, n * sizeof(wxStringCharType));
|
||||
GetStringData()->nDataLength = length() + n;
|
||||
m_pchData[length()] = '\0';
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void wxStringImpl::swap(wxStringImpl& str)
|
||||
{
|
||||
wxStringCharType* tmp = str.m_pchData;
|
||||
str.m_pchData = m_pchData;
|
||||
m_pchData = tmp;
|
||||
}
|
||||
|
||||
size_t wxStringImpl::find(const wxStringImpl& str, size_t nStart) const
|
||||
{
|
||||
// deal with the special case of empty string first
|
||||
const size_t nLen = length();
|
||||
const size_t nLenOther = str.length();
|
||||
|
||||
if ( !nLenOther )
|
||||
{
|
||||
// empty string is a substring of anything
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( !nLen )
|
||||
{
|
||||
// the other string is non empty so can't be our substring
|
||||
return npos;
|
||||
}
|
||||
|
||||
wxASSERT( str.GetStringData()->IsValid() );
|
||||
wxASSERT( nStart <= nLen );
|
||||
|
||||
const wxStringCharType * const other = str.c_str();
|
||||
|
||||
// anchor
|
||||
const wxStringCharType* p =
|
||||
(const wxStringCharType*)wxStringMemchr(c_str() + nStart,
|
||||
*other,
|
||||
nLen - nStart);
|
||||
|
||||
if ( !p )
|
||||
return npos;
|
||||
|
||||
while ( p - c_str() + nLenOther <= nLen &&
|
||||
wxStringMemcmp(p, other, nLenOther) )
|
||||
{
|
||||
p++;
|
||||
|
||||
// anchor again
|
||||
p = (const wxStringCharType*)
|
||||
wxStringMemchr(p, *other, nLen - (p - c_str()));
|
||||
|
||||
if ( !p )
|
||||
return npos;
|
||||
}
|
||||
|
||||
return p - c_str() + nLenOther <= nLen ? p - c_str() : npos;
|
||||
}
|
||||
|
||||
size_t wxStringImpl::find(const wxStringCharType* sz,
|
||||
size_t nStart, size_t n) const
|
||||
{
|
||||
return find(wxStringImpl(sz, n), nStart);
|
||||
}
|
||||
|
||||
size_t wxStringImpl::find(wxStringCharType ch, size_t nStart) const
|
||||
{
|
||||
wxASSERT( nStart <= length() );
|
||||
|
||||
const wxStringCharType *p = (const wxStringCharType*)
|
||||
wxStringMemchr(c_str() + nStart, ch, length() - nStart);
|
||||
|
||||
return p == nullptr ? npos : p - c_str();
|
||||
}
|
||||
|
||||
size_t wxStringImpl::rfind(const wxStringImpl& str, size_t nStart) const
|
||||
{
|
||||
wxASSERT( str.GetStringData()->IsValid() );
|
||||
wxASSERT( nStart == npos || nStart <= length() );
|
||||
|
||||
if ( length() >= str.length() )
|
||||
{
|
||||
// avoids a corner case later
|
||||
if ( empty() && str.empty() )
|
||||
return 0;
|
||||
|
||||
// "top" is the point where search starts from
|
||||
size_t top = length() - str.length();
|
||||
|
||||
if ( nStart == npos )
|
||||
nStart = length() - 1;
|
||||
if ( nStart < top )
|
||||
top = nStart;
|
||||
|
||||
const wxStringCharType *cursor = c_str() + top;
|
||||
do
|
||||
{
|
||||
if ( wxStringMemcmp(cursor, str.c_str(), str.length()) == 0 )
|
||||
{
|
||||
return cursor - c_str();
|
||||
}
|
||||
} while ( cursor-- > c_str() );
|
||||
}
|
||||
|
||||
return npos;
|
||||
}
|
||||
|
||||
size_t wxStringImpl::rfind(const wxStringCharType* sz,
|
||||
size_t nStart, size_t n) const
|
||||
{
|
||||
return rfind(wxStringImpl(sz, n), nStart);
|
||||
}
|
||||
|
||||
size_t wxStringImpl::rfind(wxStringCharType ch, size_t nStart) const
|
||||
{
|
||||
if ( nStart == npos )
|
||||
{
|
||||
nStart = length();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT( nStart <= length() );
|
||||
}
|
||||
|
||||
const wxStringCharType *actual;
|
||||
for ( actual = c_str() + ( nStart == npos ? length() : nStart + 1 );
|
||||
actual > c_str(); --actual )
|
||||
{
|
||||
if ( *(actual - 1) == ch )
|
||||
return (actual - 1) - c_str();
|
||||
}
|
||||
|
||||
return npos;
|
||||
}
|
||||
|
||||
wxStringImpl& wxStringImpl::replace(size_t nStart, size_t nLen,
|
||||
const wxStringCharType *sz, size_t nCount)
|
||||
{
|
||||
// check and adjust parameters
|
||||
const size_t lenOld = length();
|
||||
|
||||
wxASSERT_MSG( nStart <= lenOld,
|
||||
wxT("index out of bounds in wxStringImpl::replace") );
|
||||
size_t nEnd = nStart + nLen;
|
||||
if ( nLen > lenOld - nStart )
|
||||
{
|
||||
// nLen may be out of range, as it can be npos, just clump it down
|
||||
nLen = lenOld - nStart;
|
||||
nEnd = lenOld;
|
||||
}
|
||||
|
||||
if ( nCount == npos )
|
||||
nCount = wxStrlen(sz);
|
||||
|
||||
// build the new string from 3 pieces: part of this string before nStart,
|
||||
// the new substring and the part of this string after nStart+nLen
|
||||
wxStringImpl tmp;
|
||||
const size_t lenNew = lenOld + nCount - nLen;
|
||||
if ( lenNew )
|
||||
{
|
||||
tmp.AllocBuffer(lenOld + nCount - nLen);
|
||||
|
||||
wxStringCharType *dst = tmp.m_pchData;
|
||||
memcpy(dst, m_pchData, nStart*sizeof(wxStringCharType));
|
||||
dst += nStart;
|
||||
|
||||
memcpy(dst, sz, nCount*sizeof(wxStringCharType));
|
||||
dst += nCount;
|
||||
|
||||
memcpy(dst, m_pchData + nEnd, (lenOld - nEnd)*sizeof(wxStringCharType));
|
||||
}
|
||||
|
||||
// and replace this string contents with the new one
|
||||
swap(tmp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxStringImpl wxStringImpl::substr(size_t nStart, size_t nLen) const
|
||||
{
|
||||
if ( nLen == npos )
|
||||
nLen = length() - nStart;
|
||||
return wxStringImpl(*this, nStart, nLen);
|
||||
}
|
||||
|
||||
// assigns one string to another
|
||||
wxStringImpl& wxStringImpl::operator=(const wxStringImpl& stringSrc)
|
||||
{
|
||||
wxASSERT( stringSrc.GetStringData()->IsValid() );
|
||||
|
||||
// don't copy string over itself
|
||||
if ( m_pchData != stringSrc.m_pchData ) {
|
||||
if ( stringSrc.GetStringData()->IsEmpty() ) {
|
||||
Reinit();
|
||||
}
|
||||
else {
|
||||
// adjust references
|
||||
GetStringData()->Unlock();
|
||||
m_pchData = stringSrc.m_pchData;
|
||||
GetStringData()->Lock();
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// assigns a single character
|
||||
wxStringImpl& wxStringImpl::operator=(wxStringCharType ch)
|
||||
{
|
||||
wxStringCharType c(ch);
|
||||
if ( !AssignCopy(1, &c) ) {
|
||||
wxFAIL_MSG( wxT("out of memory in wxStringImpl::operator=(wxStringCharType)") );
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// assigns C string
|
||||
wxStringImpl& wxStringImpl::operator=(const wxStringCharType *psz)
|
||||
{
|
||||
if ( !AssignCopy(wxStrlen(psz), psz) ) {
|
||||
wxFAIL_MSG( wxT("out of memory in wxStringImpl::operator=(const wxStringCharType *)") );
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// helper function: does real copy
|
||||
bool wxStringImpl::AssignCopy(size_t nSrcLen,
|
||||
const wxStringCharType *pszSrcData)
|
||||
{
|
||||
if ( nSrcLen == 0 ) {
|
||||
Reinit();
|
||||
}
|
||||
else {
|
||||
if ( !AllocBeforeWrite(nSrcLen) ) {
|
||||
// allocation failure handled by caller
|
||||
return false;
|
||||
}
|
||||
|
||||
// use memmove() and not memcpy() here as we might be copying from our own
|
||||
// buffer in case of assignment such as "s = s.c_str()" (see #11294)
|
||||
memmove(m_pchData, pszSrcData, nSrcLen*sizeof(wxStringCharType));
|
||||
|
||||
GetStringData()->nDataLength = nSrcLen;
|
||||
m_pchData[nSrcLen] = wxT('\0');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// string concatenation
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// add something to this string
|
||||
bool wxStringImpl::ConcatSelf(size_t nSrcLen,
|
||||
const wxStringCharType *pszSrcData,
|
||||
size_t nMaxLen)
|
||||
{
|
||||
STATISTICS_ADD(SummandLength, nSrcLen);
|
||||
|
||||
nSrcLen = nSrcLen < nMaxLen ? nSrcLen : nMaxLen;
|
||||
|
||||
// concatenating an empty string is a NOP
|
||||
if ( nSrcLen > 0 ) {
|
||||
wxStringData *pData = GetStringData();
|
||||
size_t nLen = pData->nDataLength;
|
||||
|
||||
// take special care when appending part of this string to itself: the code
|
||||
// below reallocates our buffer and this invalidates pszSrcData pointer so
|
||||
// we have to copy it in another temporary string in this case (but avoid
|
||||
// doing this unnecessarily)
|
||||
if ( pszSrcData >= m_pchData && pszSrcData < m_pchData + nLen )
|
||||
{
|
||||
wxStringImpl tmp(pszSrcData, nSrcLen);
|
||||
return ConcatSelf(nSrcLen, tmp.m_pchData, nSrcLen);
|
||||
}
|
||||
|
||||
size_t nNewLen = nLen + nSrcLen;
|
||||
|
||||
// alloc new buffer if current is too small
|
||||
if ( pData->IsShared() ) {
|
||||
STATISTICS_ADD(ConcatHit, 0);
|
||||
|
||||
// we have to allocate another buffer
|
||||
wxStringData* pOldData = GetStringData();
|
||||
if ( !AllocBuffer(nNewLen) ) {
|
||||
// allocation failure handled by caller
|
||||
return false;
|
||||
}
|
||||
memcpy(m_pchData, pOldData->data(), nLen*sizeof(wxStringCharType));
|
||||
pOldData->Unlock();
|
||||
}
|
||||
else if ( nNewLen > pData->nAllocLength ) {
|
||||
STATISTICS_ADD(ConcatHit, 0);
|
||||
|
||||
reserve(nNewLen);
|
||||
// we have to grow the buffer
|
||||
if ( capacity() < nNewLen ) {
|
||||
// allocation failure handled by caller
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
STATISTICS_ADD(ConcatHit, 1);
|
||||
|
||||
// the buffer is already big enough
|
||||
}
|
||||
|
||||
// should be enough space
|
||||
wxASSERT( nNewLen <= GetStringData()->nAllocLength );
|
||||
|
||||
// fast concatenation - all is done in our buffer
|
||||
memcpy(m_pchData + nLen, pszSrcData, nSrcLen*sizeof(wxStringCharType));
|
||||
|
||||
m_pchData[nNewLen] = wxT('\0'); // put terminating '\0'
|
||||
GetStringData()->nDataLength = nNewLen; // and fix the length
|
||||
}
|
||||
//else: the string to append was empty
|
||||
return true;
|
||||
}
|
||||
|
||||
// get the pointer to writable buffer of (at least) nLen bytes
|
||||
wxStringCharType *wxStringImpl::DoGetWriteBuf(size_t nLen)
|
||||
{
|
||||
if ( !AllocBeforeWrite(nLen) ) {
|
||||
// allocation failure handled by caller
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
wxASSERT( GetStringData()->nRefs == 1 );
|
||||
GetStringData()->Validate(false);
|
||||
|
||||
return m_pchData;
|
||||
}
|
||||
|
||||
// put string back in a reasonable state after GetWriteBuf
|
||||
void wxStringImpl::DoUngetWriteBuf()
|
||||
{
|
||||
DoUngetWriteBuf(wxStrlen(m_pchData));
|
||||
}
|
||||
|
||||
void wxStringImpl::DoUngetWriteBuf(size_t nLen)
|
||||
{
|
||||
wxStringData * const pData = GetStringData();
|
||||
|
||||
wxASSERT_MSG( nLen < pData->nAllocLength, wxT("buffer overrun") );
|
||||
|
||||
// the strings we store are always NUL-terminated
|
||||
pData->data()[nLen] = wxT('\0');
|
||||
pData->nDataLength = nLen;
|
||||
pData->Validate(true);
|
||||
}
|
||||
|
||||
#endif // !wxUSE_STL_BASED_WXSTRING
|
||||
|
|
@ -128,7 +128,7 @@ bool wxStringOperationsUtf8::IsValidUtf8String(const char *str, size_t len)
|
|||
return true; // empty string is UTF8 string
|
||||
|
||||
const unsigned char *c = (const unsigned char*)str;
|
||||
const unsigned char * const end = (len == wxStringImpl::npos) ? nullptr : c + len;
|
||||
const unsigned char * const end = (len == std::string::npos) ? nullptr : c + len;
|
||||
|
||||
for ( ; end != nullptr ? c != end : *c; ++c )
|
||||
{
|
||||
|
|
@ -285,7 +285,7 @@ wxUniChar::Utf8CharBuffer wxUniChar::AsUTF8() const
|
|||
}
|
||||
|
||||
wxUniChar
|
||||
wxStringOperationsUtf8::DecodeNonAsciiChar(wxStringImpl::const_iterator i)
|
||||
wxStringOperationsUtf8::DecodeNonAsciiChar(std::string::const_iterator i)
|
||||
{
|
||||
wxASSERT( IsValidUtf8LeadByte(*i) );
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,6 @@
|
|||
#include <wx/strconv.h>
|
||||
#include <wx/stream.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stringimpl.h>
|
||||
#include <wx/stringops.h>
|
||||
#include <wx/strvararg.h>
|
||||
#include <wx/sysopt.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue