55 #include <wx/string.h>
56 #include <wx/datetime.h>
57 #include <wx/tokenzr.h>
59 #include <wx/wxcrtvararg.h>
60 #include <wx/convauto.h>
85 m_pString = String ?
new wxString(String) :
new wxString;
90 m_pString = String ?
new wxString(String) :
new wxString;
95 m_pString =
new wxString(Character, nRepeat);
100 m_pString =
new wxString(Character, nRepeat);
106 m_pString = String ?
new wxString(*String) :
new wxString;
191 if( i >= 0 && i < (
int)
Length() )
196 return(
SG_T(
'\0') );
206 return(
SG_T(
'\0') );
216 return(
SG_T(
'\0') );
275 wxString _Format(
Format); _Format.Replace(
"%s",
"%ls");
276 va_list argptr; va_start(argptr, _Format);
279 va_list argptr; va_start(argptr,
Format);
294 wxString _Format(
Format); _Format.Replace(
"%s",
"%ls");
295 va_list argptr; va_start(argptr, _Format);
298 va_list argptr; va_start(argptr,
Format);
311 wxString _Format(
Format); _Format.Replace(
"%s",
"%ls");
312 va_list argptr; va_start(argptr, _Format);
313 int Result =
m_pString->PrintfV(_Format, argptr);
315 va_list argptr; va_start(argptr,
Format);
328 wxString _Format(
Format); _Format.Replace(
"%s",
"%ls");
329 va_list argptr; va_start(argptr, _Format);
330 int Result =
m_pString->PrintfV(_Format, argptr);
332 va_list argptr; va_start(argptr,
Format);
534 return(
m_pString->IsSameAs(Character, bCase) );
539 return(
m_pString->IsSameAs(Character, bCase) );
573 for(
size_t i=0; i<
Length(); i++)
575 if( (n == 0 || bReplaceAll)
599 for(
size_t i=0; i<
Length(); i++)
643 return( (
int)(n -
m_pString->Length()) );
654 return( (
int)(n -
m_pString->Length()) );
665 return(
m_pString->Find(Character, fromEnd) );
670 return(
m_pString->Find(Character, fromEnd) );
771 int Value;
return(
asInt(Value) ? Value : 0 );
776 const wxChar *start =
m_pString->c_str(); wxChar *end;
778 int value = wxStrtol(start, &end, 10);
809 double Value;
return(
asDouble(Value) ? Value : 0. );
814 const wxChar *start =
m_pString->c_str(); wxChar *end;
816 double value = wxStrtod(start, &end);
881 const wxScopedCharBuffer Buffer =
m_pString->utf8_str();
883 String.
Set_Data(Buffer.data(), Buffer.length() + 1);
923 wxScopedCharBuffer Buffer;
934 default : Buffer =
m_pString->mb_str(wxConvAuto ());
break;
937 String.
Set_Data(Buffer.data(), Buffer.length() + 1);
977 #if wxCHECK_VERSION(3, 1, 0)
980 const wxScopedCharBuffer Buffer =
m_pString->ToAscii();
983 String.
Set_Data(Buffer.data(), Buffer.length() + 1);
1037 return(
Add(Strings) );
1043 for(
int i=0; i<nStrings; i++)
1071 for(
size_t i=0; i<Strings.
Get_Size(); i++)
1099 return(
Add(String) );
1104 for(
size_t i=
Get_Size()-1; i>Index; i--)
1127 for(
size_t i=Index+1; i<
Get_Size(); i++)
1140 while(
Del(Count) ) {}
1142 for(
size_t i=
Get_Size(); i<Count; i++)
1156 CSG_Index_Compare_Strings(
CSG_String **Values,
bool Ascending) : m_Values(Values), m_Ascending(Ascending) {}
1160 sLong a = m_Ascending ? _a : _b;
1161 sLong b = m_Ascending ? _b : _a;
1163 return( m_Values[a]->Cmp(*m_Values[b]) );
1233 CSG_String s; wxDateTime t; t.SetToCurrent();
1237 s += t.FormatISODate().wc_str(); s +=
"/";
1240 s += t.FormatISOTime().wc_str();
1255 int deg, min;
double sec;
char sig = Value < 0. ?
'-' :
'+';
1262 Value = fmod(Value, 360.);
1264 Value = 60. * (Value - deg);
1266 Value = 60. * (Value - min);
1275 double sig = 1., deg = 0., min = 0., sec = 0.;
1281 sig = -1.; deg = -deg;
1292 return( sig * (deg + min / 60. + sec / 3600.) );
1307 Value = fabs(Value);
1309 for(decimals=0; decimals<maxDecimals; decimals++)
1311 double Remainder = Value - floor(Value);
1313 if( Remainder == 0. )
1321 return( maxDecimals );
1334 for(
size_t i=0; i<String.
Length(); i++)
1371 if ( Precision == -99 )
1375 else if( Precision == -98 )
1379 else if( Precision == -97 )
1383 else if( Precision == 0 )
1385 s.
Printf(
"%d", (
int)Value);
1387 else if( Precision > 0 )
1389 s.
Printf(
"%.*f", Precision, Value);
1397 s.
Printf(
"%d", (
int)Value);
1399 else if( Decimals > Precision )
1405 s.
Printf(
"%.*f", Decimals, Value);
1450 {
"table",
"\n============\n",
"============\n" },
1451 {
"tr" ,
"" ,
"\n" },
1452 {
"th" ,
"" ,
"\t" },
1453 {
"td" ,
"" ,
"\t" },
1455 {
"b" ,
"[" ,
"]" },
1456 {
"i" ,
"'" ,
"'" },
1457 {
"br" ,
"\n" ,
"" },
1458 {
"p" ,
"" ,
"\n" },
1459 {
"hr" ,
"\n____________\n",
"\n" },
1460 {
"h1" ,
"\n############\n",
"\n" },
1461 {
"h2" ,
"\n============\n",
"\n" },
1462 {
"h3" ,
"\n------------\n",
"\n" },
1463 {
"h4" ,
"\n" ,
"\n" },
1464 {
"ol" ,
"\n" ,
"\n" },
1465 {
"ul" ,
"\n" ,
"\n" },
1466 {
"li" ,
"(-) " ,
"\n" },
1472 for(
int i=0, n; !Tags[i][0].
is_Empty(); i++)
1474 _Text.
Replace(
"<" + Tags[i][0] +
">", Tags[i][1]);
1476 while( (n = _Text.
Find(
"<" + Tags[i][0])) >= 0 )
1480 if( Tags[i][0].Cmp(
"a") == 0 && (n = Right.
BeforeFirst(
'>').
Find(
"href=\"")) >= 0 )
1484 if( !href.
is_Empty() && (n = Right.
Find(
"</a>")) >= 0 )
1490 _Text = Left +
"[" + text +
"](" + href +
")" + Right.
Right(Right.
Length() - n);
1497 _Text = Left + Tags[i][1] + Right.
AfterFirst(
'>');
1500 _Text.
Replace(
"</" + Tags[i][0] +
">", Tags[i][2]);
1516 m_pTokenizer =
new wxStringTokenizer();
1522 m_pTokenizer =
new wxStringTokenizer();
1530 delete(m_pTokenizer);
1536 return( m_pTokenizer->CountTokens() );
1542 return( m_pTokenizer->GetLastDelimiter() );
1548 wxString s(m_pTokenizer->GetNextToken());
1556 return( m_pTokenizer->GetPosition() );
1562 wxString s(m_pTokenizer->GetString());
1570 return( m_pTokenizer->HasMoreTokens() );
1576 wxStringTokenizerMode _Mode;
1580 default: _Mode = wxTOKEN_DEFAULT ;
break;
1588 m_pTokenizer->SetString(String.
c_str(), Delimiters.
c_str(), _Mode);