remove operators in QPIConfig::Entry

git-svn-id: svn://db.shs.com.ru/libs@946 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
2020-04-14 18:51:00 +00:00
parent 5eefb1ebe5
commit 14bbb32503
10 changed files with 77 additions and 93 deletions

View File

@@ -88,8 +88,6 @@ public:
bool isEntryExists(const QString & name) const {foreach (const Entry * i, *this) if (entryExists(i, name)) return true; return false;}
int indexOf(const Entry * e) {for (int i = 0; i < size(); ++i) if (at(i) == e) return i; return -1;}
//void clear() {foreach (Entry * i, *this) delete i; QVector<Entry * >::clear();}
private:
bool entryExists(const Entry * e, const QString & name) const;
void allLeaves(Branch & b, Entry * e) {foreach (Entry * i, e->_children) {if (i->isLeaf()) b << i; else allLeaves(b, i);}}
@@ -150,27 +148,26 @@ public:
Branch getValues(const QString & vname);
bool isEntryExists(const QString & name) const {return entryExists(this, name);}
const QString & stringValue() const {return _value;}
operator bool() {return (_value.toLower().trimmed() == "true" || _value.toLower().trimmed() == "yes" || _value.toLower().trimmed() == "on" || _value.toInt() > 0);}
operator char() {return (_value.isEmpty() ? 0 : _value[0].toLatin1());}
operator short() {return _value.toShort();}
operator int() {return QString2int(_value);}
operator long() {return QString2int(_value);}
operator uchar() {return QString2int(_value);}
operator ushort() {return QString2int(_value);}
operator uint() {return QString2int(_value);}
operator ulong() {return QString2int(_value);}
operator float() {return _value.toFloat();}
operator double() {return _value.toDouble();}
operator QString() {return _value;}
operator QStringList() {return _value.split("%|%");}
operator QColor() {return QString2QColor(_value);}
operator QRect() {return QString2QRect(_value);}
operator QRectF() {return QString2QRectF(_value);}
operator QPoint() {return QString2QPoint(_value);}
operator QPointF() {return QString2QPointF(_value);}
operator QByteArray() {return QString2QByteArray(_value);}
bool toBool() const {return (_value.toLower().trimmed() == "true" || _value.toLower().trimmed() == "yes" || _value.toLower().trimmed() == "on" || _value.toInt() > 0);}
char toChar() const {return (_value.isEmpty() ? 0 : _value[0].toLatin1());}
short toShort() const {return _value.toShort();}
int toInt() const {return QString2int(_value);}
long toLong() const {return QString2int(_value);}
uchar toUChar() const {return QString2int(_value);}
ushort toUShort() const {return QString2int(_value);}
uint toUInt() const {return QString2int(_value);}
ulong toULong() const {return QString2int(_value);}
float toFloat() const {return _value.toFloat();}
double toDouble() const {return _value.toDouble();}
QString toString() const {return _value;}
QStringList toStringList() const {return _value.split("%|%");}
QColor toColor() const {return QString2QColor(_value);}
QRect toRect() const {return QString2QRect(_value);}
QRectF toRectF() const {return QString2QRectF(_value);}
QPoint toPoint() const {return QString2QPoint(_value);}
QPointF toPointF() const {return QString2QPointF(_value);}
QByteArray toByteArray() const {return QString2QByteArray(_value);}
private:
static bool compare(const QPIConfig::Entry * f, const QPIConfig::Entry * s) {return f->_line < s->_line;}
@@ -228,7 +225,7 @@ public:
int entryIndex(const QString & name);
QString getName(uint number) {return entryByIndex(number)._name;}
QString getValue(uint number) {return entryByIndex(number)._value;}
QString getValueByIndex(uint number) {return entryByIndex(number)._value;}
QChar getType(uint number) {return entryByIndex(number)._type[0];}
QString getComment(uint number) {return entryByIndex(number)._comment;}