You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1080 lines
24 KiB
1080 lines
24 KiB
// This is the SIP interface definition for TQChar and TQString.
|
|
//
|
|
// Copyright (c) 2007
|
|
// Riverbank Computing Limited <info@riverbankcomputing.co.uk>
|
|
//
|
|
// This file is part of PyTQt.
|
|
//
|
|
// This copy of PyTQt is free software; you can redistribute it and/or modify it
|
|
// under the terms of the GNU General Public License as published by the Free
|
|
// Software Foundation; either version 2, or (at your option) any later
|
|
// version.
|
|
//
|
|
// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
// details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License along with
|
|
// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation,
|
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
%ExportedDoc
|
|
<Sect2><Title>TQChar (TQt v2+)</Title>
|
|
<FuncSynopsis>
|
|
<FuncDef>uchar &<Function>cell</Function> const</FuncDef>
|
|
<ParamDef></ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
Not implemented.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>uchar &<Function>row</Function> const</FuncDef>
|
|
<ParamDef></ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
Not implemented.
|
|
</Para>
|
|
</Sect2>
|
|
|
|
<Sect2><Title>TQString</Title>
|
|
<Para>
|
|
A Python string object (or Unicode object) can be used whenever a
|
|
<Literal>TQString</Literal> can be used. A <Literal>TQString</Literal> can be
|
|
converted to a Python string object using the Python <Literal>str()</Literal>
|
|
function, and to a Python Unicode object using the Python
|
|
<Literal>unicode()</Literal> function.
|
|
</Para>
|
|
|
|
<Para>
|
|
The Python <Literal>+</Literal>, <Literal>+=</Literal>, <Literal>*</Literal>,
|
|
<Literal>*=</Literal>, <Literal>len</Literal>, <Literal>[]</Literal>
|
|
(for reading slices and individual characters), <Literal>in</Literal> and
|
|
comparison operators are supported.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>TQCharRef <Function>at</Function></FuncDef>
|
|
<ParamDef>uint <Parameter>i</Parameter></ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
Not yet implemented. (TQt v2+)
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>TQChar <Function>constref</Function> const</FuncDef>
|
|
<ParamDef>uint <Parameter>i</Parameter></ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
Not yet implemented. (TQt v2+)
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>TQChar &<Function>ref</Function></FuncDef>
|
|
<ParamDef>uint <Parameter>i</Parameter></ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
Not yet implemented. (TQt v2+)
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>TQString &<Function>setUnicodeCodes</Function></FuncDef>
|
|
<ParamDef>const ushort *<Parameter>unicode_as_shorts</Parameter></ParamDef>
|
|
<ParamDef>uint <Parameter>len</Parameter></ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
Not yet implemented. (TQt v2.1+)
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>TQString &<Function>sprintf</Function></FuncDef>
|
|
<ParamDef>const char *<Parameter>format</Parameter></ParamDef>
|
|
<ParamDef>...</ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
Not implemented.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>short <Function>toShort</Function></FuncDef>
|
|
<ParamDef>bool *<Parameter>ok</Parameter> = 0</ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
This returns a tuple of the <Literal>short</Literal> result and the
|
|
<Literal>ok</Literal> value.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>ushort <Function>toUShort</Function></FuncDef>
|
|
<ParamDef>bool *<Parameter>ok</Parameter> = 0</ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
This returns a tuple of the <Literal>ushort</Literal> result and the
|
|
<Literal>ok</Literal> value.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>int <Function>toInt</Function></FuncDef>
|
|
<ParamDef>bool *<Parameter>ok</Parameter> = 0</ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
This returns a tuple of the <Literal>int</Literal> result and the
|
|
<Literal>ok</Literal> value.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>uint <Function>toUInt</Function></FuncDef>
|
|
<ParamDef>bool *<Parameter>ok</Parameter> = 0</ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
This returns a tuple of the <Literal>uint</Literal> result and the
|
|
<Literal>ok</Literal> value.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>long <Function>toLong</Function></FuncDef>
|
|
<ParamDef>bool *<Parameter>ok</Parameter> = 0</ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
This returns a tuple of the <Literal>long</Literal> result and the
|
|
<Literal>ok</Literal> value.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>ulong <Function>toULong</Function></FuncDef>
|
|
<ParamDef>bool *<Parameter>ok</Parameter> = 0</ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
This returns a tuple of the <Literal>ulong</Literal> result and the
|
|
<Literal>ok</Literal> value.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>float <Function>toFloat</Function></FuncDef>
|
|
<ParamDef>bool *<Parameter>ok</Parameter> = 0</ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
This returns a tuple of the <Literal>float</Literal> result and the
|
|
<Literal>ok</Literal> value.
|
|
</Para>
|
|
|
|
<FuncSynopsis>
|
|
<FuncDef>double <Function>toDouble</Function></FuncDef>
|
|
<ParamDef>bool *<Parameter>ok</Parameter> = 0</ParamDef>
|
|
</FuncSynopsis>
|
|
<Para>
|
|
This returns a tuple of the <Literal>double</Literal> result and the
|
|
<Literal>ok</Literal> value.
|
|
</Para>
|
|
</Sect2>
|
|
%End
|
|
|
|
|
|
%If (TQt_2_00 -)
|
|
|
|
class TQChar
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qstring.h>
|
|
%End
|
|
|
|
public:
|
|
TQChar();
|
|
TQChar(char);
|
|
// TQChar(uchar);
|
|
TQChar(uchar,uchar);
|
|
TQChar(const TQChar &);
|
|
// TQChar(ushort);
|
|
// TQChar(short);
|
|
// TQChar(uint);
|
|
TQChar(int);
|
|
|
|
static const TQChar null;
|
|
static const TQChar replacement;
|
|
static const TQChar byteOrderMark;
|
|
static const TQChar byteOrderSwapped;
|
|
%If (TQt_2_2_0 -)
|
|
static const TQChar nbsp;
|
|
%End
|
|
|
|
%If (- TQt_3_0_0)
|
|
enum Category {
|
|
NoCategory,
|
|
|
|
Mark_NonSpacing,
|
|
Mark_SpacingCombining,
|
|
Mark_Enclosing,
|
|
|
|
Number_DecimalDigit,
|
|
Number_Letter,
|
|
Number_Other,
|
|
|
|
Separator_Space,
|
|
Separator_Line,
|
|
Separator_Paragraph,
|
|
|
|
Other_Control,
|
|
Other_Format,
|
|
Other_Surrogate,
|
|
Other_PrivateUse,
|
|
Other_NotAssigned,
|
|
|
|
Letter_Uppercase,
|
|
Letter_Lowercase,
|
|
Letter_Titlecase,
|
|
Letter_Modifier,
|
|
Letter_Other,
|
|
|
|
Punctuation_Connector,
|
|
Punctuation_Dask,
|
|
Punctuation_Open,
|
|
Punctuation_Close,
|
|
Punctuation_InitialQuote,
|
|
Punctuation_FinalQuote,
|
|
Punctuation_Other,
|
|
|
|
Symbol_Math,
|
|
Symbol_Currency,
|
|
Symbol_Modifier,
|
|
Symbol_Other
|
|
};
|
|
%End
|
|
%If (TQt_3_0_0 -)
|
|
enum Category {
|
|
NoCategory,
|
|
|
|
Mark_NonSpacing,
|
|
Mark_SpacingCombining,
|
|
Mark_Enclosing,
|
|
|
|
Number_DecimalDigit,
|
|
Number_Letter,
|
|
Number_Other,
|
|
|
|
Separator_Space,
|
|
Separator_Line,
|
|
Separator_Paragraph,
|
|
|
|
Other_Control,
|
|
Other_Format,
|
|
Other_Surrogate,
|
|
Other_PrivateUse,
|
|
Other_NotAssigned,
|
|
|
|
Letter_Uppercase,
|
|
Letter_Lowercase,
|
|
Letter_Titlecase,
|
|
Letter_Modifier,
|
|
Letter_Other,
|
|
|
|
Punctuation_Connector,
|
|
Punctuation_Dash,
|
|
Punctuation_Open,
|
|
Punctuation_Close,
|
|
Punctuation_InitialQuote,
|
|
Punctuation_FinalQuote,
|
|
Punctuation_Other,
|
|
|
|
Symbol_Math,
|
|
Symbol_Currency,
|
|
Symbol_Modifier,
|
|
Symbol_Other
|
|
};
|
|
%End
|
|
|
|
%If (- TQt_3_0_0)
|
|
enum Direction {
|
|
DirL,
|
|
DirR,
|
|
DirEN,
|
|
DirES,
|
|
DirET,
|
|
DirAN,
|
|
DirCS,
|
|
DirB,
|
|
DirS,
|
|
DirWS,
|
|
DirON
|
|
};
|
|
%End
|
|
%If (TQt_3_0_0 -)
|
|
enum Direction {
|
|
DirL,
|
|
DirR,
|
|
DirEN,
|
|
DirES,
|
|
DirET,
|
|
DirAN,
|
|
DirCS,
|
|
DirB,
|
|
DirS,
|
|
DirWS,
|
|
DirON,
|
|
DirLRE,
|
|
DirLRO,
|
|
DirAL,
|
|
DirRLE,
|
|
DirRLO,
|
|
DirPDF,
|
|
DirNSM,
|
|
DirBN
|
|
};
|
|
%End
|
|
|
|
enum Decomposition {
|
|
Single,
|
|
Canonical,
|
|
Font,
|
|
NoBreak,
|
|
Initial,
|
|
Medial,
|
|
Final,
|
|
Isolated,
|
|
Circle,
|
|
Super,
|
|
Sub,
|
|
Vertical,
|
|
Wide,
|
|
Narrow,
|
|
Small,
|
|
Square,
|
|
Compat,
|
|
Fraction
|
|
};
|
|
|
|
enum Joining {
|
|
OtherJoining,
|
|
Dual,
|
|
Right,
|
|
Center
|
|
};
|
|
|
|
%If (TQt_3_0_0 -)
|
|
enum CombiningClass {
|
|
Combining_BelowLeftAttached,
|
|
Combining_BelowAttached,
|
|
Combining_BelowRightAttached,
|
|
Combining_LeftAttached,
|
|
Combining_RightAttached,
|
|
Combining_AboveLeftAttached,
|
|
Combining_AboveAttached,
|
|
Combining_AboveRightAttached,
|
|
|
|
Combining_BelowLeft,
|
|
Combining_Below,
|
|
Combining_BelowRight,
|
|
Combining_Left,
|
|
Combining_Right,
|
|
Combining_AboveLeft,
|
|
Combining_Above,
|
|
Combining_AboveRight,
|
|
|
|
Combining_DoubleBelow,
|
|
Combining_DoubleAbove,
|
|
Combining_IotaSubscript
|
|
};
|
|
%End
|
|
|
|
int digitValue() const;
|
|
TQChar lower() const;
|
|
TQChar upper() const;
|
|
|
|
Category category() const;
|
|
Direction direction() const;
|
|
Joining joining() const;
|
|
bool mirrored() const;
|
|
%If (TQt_2_1_0 -)
|
|
TQChar mirroredChar() const;
|
|
%End
|
|
%If (- TQt_3_0_0)
|
|
TQString decomposition() const;
|
|
%End
|
|
%If (TQt_3_0_0 -)
|
|
const TQString &decomposition() const;
|
|
%End
|
|
Decomposition decompositionTag() const;
|
|
%If (TQt_3_0_0 -)
|
|
unsigned char combiningClass() const;
|
|
%End
|
|
|
|
char latin1() const;
|
|
ushort unicode() const;
|
|
|
|
bool isNull() const;
|
|
bool isPrint() const;
|
|
bool isPunct() const;
|
|
bool isSpace() const;
|
|
bool isMark() const;
|
|
bool isLetter() const;
|
|
bool isNumber() const;
|
|
%If (TQt_2_1_0 -)
|
|
bool isLetterOrNumber() const;
|
|
%End
|
|
bool isDigit() const;
|
|
%If (TQt_3_0_0 -)
|
|
bool isSymbol() const;
|
|
%End
|
|
|
|
// uchar& cell();
|
|
// uchar& row();
|
|
uchar cell() const;
|
|
uchar row() const;
|
|
%If (TQt_3_0_0 -)
|
|
void setCell(uchar);
|
|
void setRow(uchar);
|
|
%End
|
|
|
|
static bool networkOrdered();
|
|
};
|
|
|
|
bool operator==(TQChar,char);
|
|
bool operator==(TQChar,TQChar);
|
|
bool operator!=(TQChar,TQChar);
|
|
bool operator!=(TQChar,char);
|
|
bool operator<=(TQChar,char);
|
|
bool operator<=(TQChar,TQChar);
|
|
bool operator>=(TQChar,char);
|
|
bool operator>=(TQChar,TQChar);
|
|
bool operator<(TQChar,char);
|
|
bool operator<(TQChar,TQChar);
|
|
bool operator>(TQChar,char);
|
|
bool operator>(TQChar,TQChar);
|
|
|
|
|
|
class TQString
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qstring.h>
|
|
%End
|
|
|
|
public:
|
|
TQString();
|
|
TQString(TQChar);
|
|
TQString(const TQString &);
|
|
TQString(const TQByteArray &);
|
|
// TQString(const TQChar *,uint);
|
|
// TQString(const char *);
|
|
|
|
%If (TQt_2_1_0 -)
|
|
// This is how we implement TQUrl::operator TQString() const.
|
|
TQString(const TQUrl &);
|
|
%End
|
|
|
|
%If (TQt_3_0_0 -)
|
|
// This is how we implement TQKeySequence::operator TQString() const.
|
|
TQString(const TQKeySequence &);
|
|
|
|
// This is how we implement TQUuid::operator TQString() const.
|
|
TQString(const TQUuid &);
|
|
%End
|
|
|
|
static const TQString null;
|
|
|
|
bool isNull() const;
|
|
bool isEmpty() const;
|
|
uint length() const;
|
|
void truncate(uint);
|
|
%If (- TQt_3_0_0)
|
|
void fill(TQChar,int = -1);
|
|
%End
|
|
%If (TQt_3_0_0 -)
|
|
TQString &fill(TQChar,int = -1);
|
|
%End
|
|
TQString copy() const;
|
|
|
|
TQString arg(int /Constrained/,int = 0,int = 10) const;
|
|
TQString arg(double /Constrained/,int = 0,char = 'g',int = -1) const;
|
|
%If (TQt_3_2_0 -)
|
|
// TQString arg(Q_LLONG,int = 0,int = 10) const;
|
|
// TQString arg(Q_ULLONG,int = 0,int = 10) const;
|
|
%End
|
|
TQString arg(long,int = 0,int = 10) const;
|
|
TQString arg(ulong,int = 0,int = 10) const;
|
|
// TQString arg(uint,int = 0,int = 10) const;
|
|
// TQString arg(short,int = 0,int = 10) const;
|
|
// TQString arg(ushort,int = 0,int = 10) const;
|
|
TQString arg(char,int = 0) const;
|
|
TQString arg(TQChar,int = 0) const;
|
|
TQString arg(const TQString&,int = 0) const;
|
|
%If (TQt_3_2_0 -)
|
|
TQString arg(const TQString &,const TQString &) const;
|
|
TQString arg(const TQString &,const TQString &,const TQString &) const;
|
|
TQString arg(const TQString &,const TQString &,const TQString &,
|
|
const TQString &) const;
|
|
%End
|
|
|
|
// TQString &sprintf(const char *,...);
|
|
|
|
int find(TQChar,int = 0,bool = 1) const;
|
|
int find(char,int = 0,bool = 1) const;
|
|
int find(const TQString &,int = 0,bool = 1) const;
|
|
int find(const TQRegExp &,int = 0) const;
|
|
// int find(const char *,int = 0) const;
|
|
int findRev(TQChar,int = -1,bool = 1) const;
|
|
int findRev(char,int = -1,bool = 1) const;
|
|
int findRev(const TQString &,int = -1,bool = 1) const;
|
|
int findRev(const TQRegExp &,int = -1) const;
|
|
// int findRev(const char *,int = -1) const;
|
|
int contains(TQChar,bool = 1) const;
|
|
int contains(char,bool = 1) const;
|
|
// int contains(const char *,bool = 1) const;
|
|
int contains(const TQString &,bool = 1) const;
|
|
int contains(const TQRegExp &) const;
|
|
|
|
%If (TQt_3_0_0 -)
|
|
enum SectionFlags {
|
|
SectionDefault,
|
|
SectionSkipEmpty,
|
|
SectionIncludeLeadingSep,
|
|
SectionIncludeTrailingSep,
|
|
SectionCaseInsensitiveSeps
|
|
};
|
|
|
|
TQString section(TQChar,int,int = 0xffffffff,int = SectionDefault) const;
|
|
// TQString section(char,int,int = 0xffffffff,int = SectionDefault) const;
|
|
// TQString section(const char *,int,int = 0xffffffff,
|
|
// int = SectionDefault) const;
|
|
TQString section(const TQString &,int,int = 0xffffffff,
|
|
int = SectionDefault) const;
|
|
TQString section(const TQRegExp &,int,int = 0xffffffff,
|
|
int = SectionDefault) const;
|
|
%End
|
|
|
|
TQString left(uint) const;
|
|
TQString right(uint) const;
|
|
TQString mid(uint,uint = 0xffffffff) const;
|
|
TQString leftJustify(uint,TQChar = ' ',bool = 0) const;
|
|
TQString rightJustify(uint,TQChar = ' ',bool = 0) const;
|
|
TQString lower() const;
|
|
TQString upper() const;
|
|
TQString stripWhiteSpace() const;
|
|
TQString simplifyWhiteSpace() const;
|
|
|
|
TQString &insert(uint,const TQString &);
|
|
%If (TQt_3_2_0 -)
|
|
TQString &insert(uint,const TQByteArray &);
|
|
// TQString &insert(uint,const char *);
|
|
%End
|
|
TQString &insert(uint,TQChar *,uint);
|
|
TQString &insert(uint,TQChar);
|
|
TQString &insert(uint,char);
|
|
|
|
TQString &append(char);
|
|
%If (TQt_2_2_0 -)
|
|
TQString &append(TQChar);
|
|
%End
|
|
TQString &append(const TQString &);
|
|
TQString &prepend(char);
|
|
%If (TQt_2_2_0 -)
|
|
TQString &prepend(TQChar);
|
|
%End
|
|
TQString &prepend(const TQString &);
|
|
TQString &remove(uint,uint);
|
|
%If (TQt_3_1_0 -)
|
|
TQString &remove(const TQString &);
|
|
%If (TQt_3_2_0 -)
|
|
TQString &remove(const TQString &,bool);
|
|
%End
|
|
TQString &remove(TQChar);
|
|
TQString &remove(char);
|
|
TQString &remove(const TQRegExp &);
|
|
%End
|
|
TQString &replace(uint,uint,const TQString &);
|
|
TQString &replace(uint,uint,const TQChar *,uint);
|
|
%If (TQt_3_1_0 -)
|
|
TQString &replace(uint,uint,TQChar);
|
|
TQString &replace(uint,uint,char);
|
|
TQString &replace(TQChar,const TQString &);
|
|
%If (TQt_3_2_0 -)
|
|
TQString &replace(TQChar,const TQString &,bool);
|
|
%End
|
|
TQString &replace(char,const TQString &);
|
|
%If (TQt_3_2_0 -)
|
|
TQString &replace(char,const TQString &,bool);
|
|
%End
|
|
TQString &replace(const TQString &,const TQString &);
|
|
%If (TQt_3_2_0 -)
|
|
TQString &replace(const TQString &,const TQString &,bool);
|
|
%End
|
|
%End
|
|
TQString &replace(const TQRegExp &,const TQString &);
|
|
%If (TQt_3_1_0 -)
|
|
TQString &replace(TQChar,TQChar);
|
|
%End
|
|
|
|
short toShort(bool * = 0,int = 10) const;
|
|
ushort toUShort(bool * = 0,int = 10) const;
|
|
int toInt(bool * = 0,int = 10) const;
|
|
uint toUInt(bool * = 0,int = 10) const;
|
|
long toLong(bool * = 0,int = 10) const;
|
|
ulong toULong(bool * = 0,int = 10) const;
|
|
%If (TQt_3_2_0 -)
|
|
// Q_LLONG toLongLong(bool * = 0,int = 10) const;
|
|
// Q_ULLONG toULongLong(bool * = 0,int = 10) const;
|
|
%End
|
|
float toFloat(bool * = 0) const;
|
|
double toDouble(bool * = 0) const;
|
|
|
|
TQString &setNum(int /Constrained/,int = 10);
|
|
TQString &setNum(double /Constrained/,char = 'g',int = 6);
|
|
// TQString &setNum(short,int = 10);
|
|
// TQString &setNum(ushort,int = 10);
|
|
// TQString &setNum(uint,int = 10);
|
|
TQString &setNum(long,int = 10);
|
|
TQString &setNum(ulong,int = 10);
|
|
%If (TQt_3_2_0 -)
|
|
// TQString &setNum(Q_LLONG,int = 10);
|
|
// TQString &setNum(Q_ULLONG,int = 10);
|
|
%End
|
|
// TQString &setNum(float,char = 'g',int = 6);
|
|
|
|
static TQString number(int /Constrained/,int = 10);
|
|
static TQString number(double /Constrained/,char = 'g',int = 6);
|
|
static TQString number(long,int = 10);
|
|
static TQString number(ulong,int = 10);
|
|
%If (TQt_3_2_0 -)
|
|
// static TQString number(Q_LLONG,int = 10);
|
|
// static TQString number(Q_ULLONG,int = 10);
|
|
%End
|
|
// static TQString number(uint,int = 10);
|
|
|
|
void setExpand(uint,TQChar);
|
|
|
|
TQString &operator+=(const TQString &);
|
|
%If (TQt_3_3_0 -)
|
|
TQString &operator+=(const TQByteArray &);
|
|
%End
|
|
TQString &operator+=(TQChar);
|
|
//TQString &operator+=(char);
|
|
|
|
TQString operator*(int);
|
|
%MethodCode
|
|
sipRes = new TQString();
|
|
|
|
while (a0-- > 0)
|
|
*sipRes += *sipCpp;
|
|
%End
|
|
|
|
TQString &operator*=(int);
|
|
%MethodCode
|
|
TQString orig(*sipCpp);
|
|
|
|
sipCpp -> truncate(0);
|
|
|
|
while (a0-- > 0)
|
|
*sipCpp += orig;
|
|
%End
|
|
|
|
TQChar at(uint) const;
|
|
// TQCharRef at(uint);
|
|
// TQChar constref(uint) const;
|
|
// TQChar &ref(uint);
|
|
// const TQChar *unicode() const;
|
|
const char *ascii() const;
|
|
%If (TQt_3_1_0 -)
|
|
static TQString fromAscii(const char *,int = -1);
|
|
%End
|
|
const char *latin1() const;
|
|
static TQString fromLatin1(const char *,int = -1);
|
|
TQCString utf8() const;
|
|
static TQString fromUtf8(const char *,int = -1);
|
|
TQCString local8Bit() const;
|
|
static TQString fromLocal8Bit(const char *,int = -1);
|
|
|
|
%If (TQt_3_1_0 -)
|
|
// static TQString fromUcs2(const unsigned short *);
|
|
// const unsigned short *ucs2() const;
|
|
%End
|
|
|
|
%If (TQt_2_1_0 -)
|
|
// TQString &setUnicode(const TQChar *,uint);
|
|
// TQString &setUnicodeCodes(const ushort *,uint);
|
|
%End
|
|
%If (TQt_3_1_0 -)
|
|
TQString &setAscii(const char *,int = -1);
|
|
%End
|
|
%If (TQt_2_1_0 -)
|
|
TQString &setLatin1(const char *,int = -1);
|
|
%End
|
|
|
|
int compare(const TQString &) const;
|
|
static int compare(const TQString &,const TQString &);
|
|
|
|
%If (TQt_3_0_0 -)
|
|
int localeAwareCompare(const TQString &) const;
|
|
static int localeAwareCompare(const TQString &,const TQString &);
|
|
%End
|
|
|
|
void compose();
|
|
%If (- TQt_3_0_0)
|
|
TQChar::Direction basicDirection();
|
|
TQString visual(int = 0,int = -1);
|
|
%End
|
|
%If (TQt_2_2_0 -)
|
|
bool startsWith(const TQString &) const;
|
|
%End
|
|
%If (TQt_3_2_0 -)
|
|
bool startsWith(const TQString &,bool) const;
|
|
%End
|
|
%If (TQt_3_0_0 -)
|
|
bool endsWith(const TQString &) const;
|
|
%End
|
|
%If (TQt_3_2_0 -)
|
|
bool endsWith(const TQString &,bool) const;
|
|
%End
|
|
|
|
%If (TQt_3_0_0 -)
|
|
void setLength(uint);
|
|
%End
|
|
|
|
%If (TQt_3_2_0 -)
|
|
uint capacity() const;
|
|
void reserve(uint);
|
|
void squeeze();
|
|
%End
|
|
|
|
%If (TQt_3_0_0 -)
|
|
bool simpleText() const;
|
|
bool isRightToLeft() const;
|
|
%End
|
|
|
|
// Force the numeric interpretation so that str + TQString gets handled
|
|
// as we want.
|
|
const TQString operator+(const TQString &) /Numeric/;
|
|
|
|
TQString operator[](int) const;
|
|
%MethodCode
|
|
int len;
|
|
|
|
len = sipCpp -> length();
|
|
|
|
if ((a0 = (int)sipConvertFromSequenceIndex(a0,len)) < 0)
|
|
sipIsErr = 1;
|
|
else
|
|
sipRes = new TQString(sipCpp -> at(a0));
|
|
%End
|
|
|
|
TQString operator[](SIP_PYSLICE) const;
|
|
%MethodCode
|
|
#if PY_VERSION_HEX >= 0x02050000
|
|
Py_ssize_t len, start, stop, step, slicelength, i;
|
|
#else
|
|
int len, start, stop, step, slicelength, i;
|
|
#endif
|
|
|
|
len = sipCpp -> length();
|
|
|
|
if (sipConvertFromSliceObject(a0,len,&start,&stop,&step,&slicelength) < 0)
|
|
sipIsErr = 1;
|
|
else
|
|
{
|
|
sipRes = new TQString();
|
|
|
|
for (i = 0; i < slicelength; ++i)
|
|
{
|
|
sipRes -> append(sipCpp -> at(start));
|
|
start += step;
|
|
}
|
|
}
|
|
%End
|
|
|
|
int __len__() const;
|
|
%MethodCode
|
|
sipRes = sipCpp -> length();
|
|
%End
|
|
|
|
int __contains__(const TQString &) const;
|
|
%MethodCode
|
|
sipRes = (sipCpp -> contains(*a0) > 0);
|
|
%End
|
|
|
|
SIP_PYOBJECT __unicode__();
|
|
%MethodCode
|
|
#if PY_VERSION_HEX >= 0x01060000
|
|
sipRes = TQStringToPyUnicode(sipCpp);
|
|
#else
|
|
Py_INCREF(Py_None);
|
|
sipRes = Py_None;
|
|
#endif
|
|
%End
|
|
|
|
SIP_PYOBJECT __str__();
|
|
%MethodCode
|
|
#if PY_VERSION_HEX >= 0x01060000
|
|
sipRes = TQStringToPyUnicode(sipCpp);
|
|
#else
|
|
const char *s;
|
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
s = *sipCpp;
|
|
Py_END_ALLOW_THREADS
|
|
|
|
if (s == NULL)
|
|
s = "";
|
|
|
|
sipRes = PyString_FromString(s);
|
|
#endif
|
|
%End
|
|
|
|
%TypeCode
|
|
#include <qtextcodec.h>
|
|
|
|
#if PY_VERSION_HEX >= 0x01060000
|
|
// Convenience function for converting a TQString to a Python Unicode object.
|
|
static PyObject *TQStringToPyUnicode(TQString *qs)
|
|
{
|
|
PyObject *uobj;
|
|
|
|
if ((uobj = PyUnicode_FromUnicode(NULL,qs -> length())) == NULL)
|
|
return NULL;
|
|
|
|
Py_UNICODE *pyu = PyUnicode_AS_UNICODE(uobj);
|
|
|
|
for (uint i = 0; i < qs -> length(); ++i)
|
|
*pyu++ = (qs -> at(i)).unicode();
|
|
|
|
return uobj;
|
|
}
|
|
#endif
|
|
|
|
// Convenience function for converting a Python unicode or string object to a
|
|
// TQString on the heap.
|
|
static TQString *PyUnicodeStringToTQString(PyObject *py)
|
|
{
|
|
#if PY_VERSION_HEX >= 0x01060000
|
|
if (PyUnicode_Check(py))
|
|
{
|
|
TQString *qs = new TQString;
|
|
|
|
#if defined(Py_UNICODE_WIDE)
|
|
PY_UNICODE_TYPE *ucode = PyUnicode_AS_UNICODE(py);
|
|
int len = PyUnicode_GET_SIZE(py);
|
|
|
|
for (int i = 0; i < len; ++i)
|
|
qs->ref(i) = (uint)ucode[i];
|
|
#else
|
|
qs -> setUnicodeCodes((ushort *)PyUnicode_AS_UNICODE(py),PyUnicode_GET_SIZE(py));
|
|
#endif
|
|
|
|
return qs;
|
|
}
|
|
#endif
|
|
|
|
if (PyString_Check(py))
|
|
return new TQString(PyString_AS_STRING(py));
|
|
|
|
return 0;
|
|
}
|
|
%End
|
|
|
|
%ConvertToTypeCode
|
|
// Allow a Python string (or a unicode string) whenever a TQString is
|
|
// expected.
|
|
|
|
if (sipIsErr == NULL)
|
|
return (PyString_Check(sipPy) ||
|
|
#if PY_VERSION_HEX >= 0x01060000
|
|
PyUnicode_Check(sipPy) ||
|
|
#endif
|
|
sipCanConvertToInstance(sipPy,sipClass_TQString,SIP_NO_CONVERTORS));
|
|
|
|
*sipCppPtr = PyUnicodeStringToTQString(sipPy);
|
|
|
|
if (*sipCppPtr)
|
|
return sipGetState(sipTransferObj);
|
|
|
|
*sipCppPtr = reinterpret_cast<TQString *>(sipConvertToInstance(sipPy,sipClass_TQString,sipTransferObj,SIP_NO_CONVERTORS,0,sipIsErr));
|
|
|
|
return 0;
|
|
%End
|
|
|
|
%BIGetReadBufferCode
|
|
if (sipSegment != 0)
|
|
{
|
|
PyErr_SetString(PyExc_SystemError, "accessing non-existent TQString segment");
|
|
sipRes = -1;
|
|
}
|
|
else
|
|
{
|
|
*sipPtrPtr = (void *)sipCpp->ucs2();
|
|
sipRes = sipCpp->length() * sizeof (ushort);
|
|
}
|
|
%End
|
|
|
|
%BIGetSegCountCode
|
|
if (sipLenPtr)
|
|
*sipLenPtr = sipCpp->length() * sizeof (ushort);
|
|
|
|
sipRes = 1;
|
|
%End
|
|
|
|
%BIGetCharBufferCode
|
|
if (sipSegment != 0)
|
|
{
|
|
PyErr_SetString(PyExc_SystemError, "accessing non-existent TQString segment");
|
|
sipRes = -1;
|
|
}
|
|
else
|
|
{
|
|
static TQTextCodec *codec = 0;
|
|
static bool check_codec = TRUE;
|
|
|
|
// For the first time only, try and find a TQt codec that
|
|
// corresponds to the default Python codec. If one wasn't
|
|
// found then fall back to ASCII (which is actually the codec
|
|
// returned by TQTextCodec::codecForCStrings()).
|
|
if (check_codec)
|
|
{
|
|
codec = TQTextCodec::codecForName(PyUnicode_GetDefaultEncoding());
|
|
check_codec = FALSE;
|
|
}
|
|
|
|
if (codec)
|
|
{
|
|
// A Python string is the most convenient method to
|
|
// save the encoded version on the heap.
|
|
PyObject *encobj = ((sipSimpleWrapper *)sipSelf)->user;
|
|
TQCString enc;
|
|
|
|
Py_XDECREF(encobj);
|
|
|
|
enc = codec->fromUnicode(*sipCpp);
|
|
|
|
if ((encobj = PyString_FromString(enc.data())) != NULL)
|
|
{
|
|
*sipPtrPtr = (void *)PyString_AS_STRING(encobj);
|
|
sipRes = PyString_GET_SIZE(encobj);
|
|
|
|
((sipSimpleWrapper *)sipSelf)->user = encobj;
|
|
}
|
|
else
|
|
sipRes = -1;
|
|
}
|
|
else
|
|
{
|
|
const char *asc = sipCpp->ascii();
|
|
|
|
*sipPtrPtr = (void *)asc;
|
|
sipRes = qstrlen(asc);
|
|
}
|
|
}
|
|
%End
|
|
};
|
|
|
|
bool operator==(const TQString &,const TQString &);
|
|
bool operator!=(const TQString &,const TQString &);
|
|
bool operator<(const TQString &,const TQString &);
|
|
bool operator<=(const TQString &,const TQString &);
|
|
bool operator>(const TQString &,const TQString &);
|
|
bool operator>=(const TQString &,const TQString &);
|
|
|
|
%End
|
|
|
|
|
|
%If (- TQt_2_00)
|
|
|
|
class TQString : TQByteArray
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qstring.h>
|
|
%End
|
|
|
|
public:
|
|
TQString();
|
|
TQString(int);
|
|
TQString(const TQString &);
|
|
TQString(const char *);
|
|
TQString(const char *,uint);
|
|
|
|
bool isNull() const;
|
|
bool isEmpty() const;
|
|
uint length() const;
|
|
bool resize(uint);
|
|
bool truncate(uint);
|
|
bool fill(char,int = -1);
|
|
TQString copy() const;
|
|
// TQString &sprintf(const char *,...);
|
|
int find(char,int = 0,bool = 1) const;
|
|
int find(const char *,int = 0,bool = 1) const;
|
|
int find(const TQRegExp &,int = 0) const;
|
|
int findRev(char,int = -1,bool = 1) const;
|
|
int findRev(const char *,int = -1,bool = 1) const;
|
|
int findRev(const TQRegExp &,int = -1) const;
|
|
int contains(char,bool = 1) const;
|
|
int contains(const char *,bool = 1) const;
|
|
int contains(const TQRegExp &) const;
|
|
TQString left(uint) const;
|
|
TQString right(uint) const;
|
|
TQString mid(uint,uint) const;
|
|
TQString leftJustify(uint,char = ' ',bool = 0) const;
|
|
TQString rightJustify(uint,char = ' ',bool = 0) const;
|
|
TQString lower() const;
|
|
TQString upper() const;
|
|
TQString stripWhiteSpace() const;
|
|
TQString simplifyWhiteSpace() const;
|
|
TQString &insert(uint,const char *);
|
|
TQString &insert(uint,char);
|
|
TQString &append(const char *);
|
|
TQString &prepend(const char *);
|
|
TQString &remove(uint,uint);
|
|
TQString &replace(uint,uint,const char *);
|
|
TQString &replace(const TQRegExp &,const char *);
|
|
|
|
short toShort(bool * = 0) const;
|
|
ushort toUShort(bool * = 0) const;
|
|
int toInt(bool * = 0) const;
|
|
uint toUInt(bool * = 0) const;
|
|
long toLong(bool * = 0) const;
|
|
ulong toULong(bool * = 0) const;
|
|
float toFloat(bool * = 0) const;
|
|
double toDouble(bool * = 0) const;
|
|
|
|
TQString &setStr(const char *);
|
|
// TQString &setNum(short);
|
|
// TQString &setNum(ushort);
|
|
TQString &setNum(int /Constrained/);
|
|
// TQString &setNum(uint);
|
|
// TQString &setNum(long);
|
|
// TQString &setNum(ulong);
|
|
// TQString &setNum(float,char = 'g',int = 6);
|
|
TQString &setNum(double,char = 'g',int = 6);
|
|
bool setExpand(uint,char);
|
|
|
|
SIP_PYOBJECT __str__();
|
|
%MethodCode
|
|
const char *s;
|
|
|
|
Py_BEGIN_ALLOW_THREADS
|
|
s = *sipCpp;
|
|
Py_END_ALLOW_THREADS
|
|
|
|
if (s == NULL)
|
|
s = "";
|
|
|
|
sipRes = PyString_FromString(s);
|
|
%End
|
|
|
|
%ConvertToTypeCode
|
|
// Allow a Python string whenever a TQString is expected.
|
|
|
|
if (sipIsErr == NULL)
|
|
return (PyString_Check(sipPy) ||
|
|
sipCanConvertToInstance(sipPy,sipClass_TQString,SIP_NO_CONVERTORS));
|
|
|
|
if (PyString_Check(sipPy))
|
|
{
|
|
*sipCppPtr = new TQString(PyString_AS_STRING(sipPy));
|
|
|
|
return sipGetState(sipTransferObj);
|
|
}
|
|
|
|
*sipCppPtr = reinterpret_cast<TQString *>(sipConvertToInstance(sipPy,sipClass_TQString,sipTransferObj,SIP_NO_CONVERTORS,0,sipIsErr));
|
|
|
|
return 0;
|
|
%End
|
|
};
|
|
|
|
%End
|