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) );
596 return( (
int)(n -
m_pString->Length()) );
607 return( (
int)(n -
m_pString->Length()) );
618 return(
m_pString->Find(Character, fromEnd) );
623 return(
m_pString->Find(Character, fromEnd) );
724 int Value;
return(
asInt(Value) ? Value : 0 );
729 const wxChar *start =
m_pString->c_str(); wxChar *end;
731 int value = wxStrtol(start, &end, 10);
762 double Value;
return(
asDouble(Value) ? Value : 0. );
767 const wxChar *start =
m_pString->c_str(); wxChar *end;
769 double value = wxStrtod(start, &end);
834 const wxScopedCharBuffer Buffer =
m_pString->utf8_str();
836 String.
Set_Data(Buffer.data(), Buffer.length() + 1);
876 wxScopedCharBuffer Buffer;
887 default : Buffer =
m_pString->mb_str(wxConvAuto ());
break;
890 String.
Set_Data(Buffer.data(), Buffer.length() + 1);
930 #if wxCHECK_VERSION(3, 1, 0)
933 const wxScopedCharBuffer Buffer =
m_pString->ToAscii();
936 String.
Set_Data(Buffer.data(), Buffer.length() + 1);
990 return(
Add(Strings) );
996 for(
int i=0; i<nStrings; i++)
1024 for(
size_t i=0; i<Strings.
Get_Size(); i++)
1052 return(
Add(String) );
1057 for(
size_t i=
Get_Size()-1; i>Index; i--)
1080 for(
size_t i=Index+1; i<
Get_Size(); i++)
1093 while(
Del(Count) ) {}
1095 for(
size_t i=
Get_Size(); i<Count; i++)
1109 CSG_Index_Compare_Strings(
CSG_String **Values,
bool Ascending) : m_Values(Values), m_Ascending(Ascending) {}
1113 sLong a = m_Ascending ? _a : _b;
1114 sLong b = m_Ascending ? _b : _a;
1116 return( m_Values[a]->Cmp(*m_Values[b]) );
1186 CSG_String s; wxDateTime t; t.SetToCurrent();
1190 s += t.FormatISODate().wc_str(); s +=
"/";
1193 s += t.FormatISOTime().wc_str();
1208 int deg, min;
double sec;
char sig = Value < 0. ?
'-' :
'+';
1215 Value = fmod(Value, 360.);
1217 Value = 60. * (Value - deg);
1219 Value = 60. * (Value - min);
1228 double sig = 1., deg = 0., min = 0., sec = 0.;
1234 sig = -1.; deg = -deg;
1245 return( sig * (deg + min / 60. + sec / 3600.) );
1260 Value = fabs(Value);
1262 for(decimals=0; decimals<maxDecimals; decimals++)
1264 double Remainder = Value - floor(Value);
1266 if( Remainder == 0. )
1274 return( maxDecimals );
1287 for(
size_t i=0; i<String.
Length(); i++)
1322 if ( Precision == -99 )
1326 else if( Precision == -98 )
1330 else if( Precision == 0 )
1332 s.
Printf(
"%d", (
int)Value);
1334 else if( Precision > 0 )
1336 s.
Printf(
"%.*f", Precision, Value);
1342 if( Precision == 0 )
1348 s.
Printf(
"%.*f", Precision, Value);
1393 {
"table",
"\n============\n",
"============\n" },
1394 {
"tr" ,
"" ,
"\n" },
1395 {
"th" ,
"" ,
"\t" },
1396 {
"td" ,
"" ,
"\t" },
1398 {
"b" ,
"[" ,
"]" },
1399 {
"i" ,
"'" ,
"'" },
1400 {
"br" ,
"\n" ,
"" },
1401 {
"p" ,
"" ,
"\n" },
1402 {
"hr" ,
"\n____________\n",
"\n" },
1403 {
"h1" ,
"\n############\n",
"\n" },
1404 {
"h2" ,
"\n============\n",
"\n" },
1405 {
"h3" ,
"\n------------\n",
"\n" },
1406 {
"h4" ,
"\n" ,
"\n" },
1407 {
"ol" ,
"\n" ,
"\n" },
1408 {
"ul" ,
"\n" ,
"\n" },
1409 {
"li" ,
"(-) " ,
"\n" },
1415 for(
int i=0, n; !Tags[i][0].
is_Empty(); i++)
1417 _Text.
Replace(
"<" + Tags[i][0] +
">", Tags[i][1]);
1419 while( (n = _Text.
Find(
"<" + Tags[i][0])) >= 0 )
1423 if( Tags[i][0].Cmp(
"a") == 0 && (n = Right.
BeforeFirst(
'>').
Find(
"href=\"")) >= 0 )
1427 if( !href.
is_Empty() && (n = Right.
Find(
"</a>")) >= 0 )
1433 _Text = Left +
"[" + text +
"](" + href +
")" + Right.
Right(Right.
Length() - n);
1440 _Text = Left + Tags[i][1] + Right.
AfterFirst(
'>');
1443 _Text.
Replace(
"</" + Tags[i][0] +
">", Tags[i][2]);
1459 m_pTokenizer =
new wxStringTokenizer();
1465 m_pTokenizer =
new wxStringTokenizer();
1473 delete(m_pTokenizer);
1479 return( m_pTokenizer->CountTokens() );
1485 return( m_pTokenizer->GetLastDelimiter() );
1491 wxString s(m_pTokenizer->GetNextToken());
1499 return( m_pTokenizer->GetPosition() );
1505 wxString s(m_pTokenizer->GetString());
1513 return( m_pTokenizer->HasMoreTokens() );
1519 wxStringTokenizerMode _Mode;
1523 default: _Mode = wxTOKEN_DEFAULT ;
break;
1531 m_pTokenizer->SetString(String.
c_str(), Delimiters.
c_str(), _Mode);