Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
714a0eee
Commit
714a0eee
authored
Jan 13, 2011
by
Max-Wilhelm Bruker
Browse files
don't waste bandwidth with spaces or default-value items
parent
f07bb38e
Changes
7
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/remoteclient.cpp
View file @
714a0eee
...
...
@@ -21,7 +21,6 @@ RemoteClient::RemoteClient(QObject *parent)
xmlReader
=
new
QXmlStreamReader
;
xmlWriter
=
new
QXmlStreamWriter
;
xmlWriter
->
setAutoFormatting
(
true
);
xmlWriter
->
setDevice
(
socket
);
}
...
...
common/decklist.cpp
View file @
714a0eee
...
...
@@ -109,7 +109,6 @@ AbstractDecklistNode *InnerDecklistNode::findChild(const QString &name)
int
InnerDecklistNode
::
height
()
const
{
Q_ASSERT
(
!
isEmpty
());
return
at
(
0
)
->
height
()
+
1
;
}
...
...
@@ -469,11 +468,6 @@ void DeckList::cleanList()
setComments
();
}
bool
DeckList
::
isEmpty
()
const
{
return
root
->
isEmpty
();
}
DecklistCardNode
*
DeckList
::
addCard
(
const
QString
&
cardName
,
const
QString
&
zoneName
)
{
InnerDecklistNode
*
zoneNode
=
dynamic_cast
<
InnerDecklistNode
*>
(
root
->
findChild
(
zoneName
));
...
...
common/decklist.h
View file @
714a0eee
...
...
@@ -148,7 +148,7 @@ public:
static
FileFormat
getFormatFromNameFilter
(
const
QString
&
selectedNameFilter
);
void
cleanList
();
bool
isEmpty
()
const
;
bool
isEmpty
()
const
{
return
root
->
isEmpty
()
&&
name
.
isEmpty
()
&&
comments
.
isEmpty
()
&&
sideboardPlans
.
isEmpty
();
}
InnerDecklistNode
*
getRoot
()
const
{
return
root
;
}
DecklistCardNode
*
addCard
(
const
QString
&
cardName
,
const
QString
&
zoneName
);
...
...
common/protocol.h
View file @
714a0eee
...
...
@@ -60,6 +60,7 @@ public:
bool
getReceiverMayDelete
()
const
{
return
receiverMayDelete
;
}
void
setReceiverMayDelete
(
bool
_receiverMayDelete
)
{
receiverMayDelete
=
_receiverMayDelete
;
}
ProtocolItem
(
const
QString
&
_itemType
,
const
QString
&
_itemSubType
);
bool
isEmpty
()
const
{
return
false
;
}
};
class
ProtocolItem_Invalid
:
public
ProtocolItem
{
...
...
@@ -79,6 +80,7 @@ public:
TopLevelProtocolItem
();
bool
readElement
(
QXmlStreamReader
*
xml
);
void
writeElement
(
QXmlStreamWriter
*
xml
);
bool
isEmpty
()
const
{
return
false
;
}
};
// ----------------
...
...
common/serializable_item.cpp
View file @
714a0eee
...
...
@@ -25,6 +25,9 @@ bool SerializableItem::readElement(QXmlStreamReader *xml)
void
SerializableItem
::
write
(
QXmlStreamWriter
*
xml
)
{
if
(
isEmpty
())
return
;
xml
->
writeStartElement
(
itemType
);
if
(
!
itemSubType
.
isEmpty
())
xml
->
writeAttribute
(
"type"
,
itemSubType
);
...
...
common/serializable_item.h
View file @
714a0eee
...
...
@@ -29,6 +29,7 @@ public:
const
QString
&
getItemSubType
()
const
{
return
itemSubType
;
}
virtual
bool
readElement
(
QXmlStreamReader
*
xml
);
virtual
void
writeElement
(
QXmlStreamWriter
*
xml
)
=
0
;
virtual
bool
isEmpty
()
const
=
0
;
void
write
(
QXmlStreamWriter
*
xml
);
};
...
...
@@ -36,6 +37,7 @@ class SerializableItem_Invalid : public SerializableItem {
public:
SerializableItem_Invalid
(
const
QString
&
_itemType
)
:
SerializableItem
(
_itemType
)
{
}
void
writeElement
(
QXmlStreamWriter
*
/*xml*/
)
{
}
bool
isEmpty
()
const
{
return
true
;
}
};
class
SerializableItem_Map
:
public
SerializableItem
{
...
...
@@ -67,6 +69,7 @@ public:
~
SerializableItem_Map
();
bool
readElement
(
QXmlStreamReader
*
xml
);
void
writeElement
(
QXmlStreamWriter
*
xml
);
bool
isEmpty
()
const
{
return
itemMap
.
isEmpty
()
&&
itemList
.
isEmpty
();
}
void
appendItem
(
SerializableItem
*
item
)
{
itemList
.
append
(
item
);
}
};
...
...
@@ -81,6 +84,7 @@ public:
:
SerializableItem
(
_itemType
),
data
(
_data
)
{
}
const
QString
&
getData
()
{
return
data
;
}
void
setData
(
const
QString
&
_data
)
{
data
=
_data
;
}
bool
isEmpty
()
const
{
return
data
.
isEmpty
();
}
};
class
SerializableItem_Int
:
public
SerializableItem
{
...
...
@@ -94,6 +98,7 @@ public:
:
SerializableItem
(
_itemType
),
data
(
_data
)
{
}
int
getData
()
{
return
data
;
}
void
setData
(
int
_data
)
{
data
=
_data
;
}
bool
isEmpty
()
const
{
return
data
==
-
1
;
}
};
class
SerializableItem_Bool
:
public
SerializableItem
{
...
...
@@ -107,6 +112,7 @@ public:
:
SerializableItem
(
_itemType
),
data
(
_data
)
{
}
bool
getData
()
{
return
data
;
}
void
setData
(
bool
_data
)
{
data
=
_data
;
}
bool
isEmpty
()
const
{
return
data
==
false
;
}
};
class
SerializableItem_Color
:
public
SerializableItem
{
...
...
@@ -120,6 +126,7 @@ public:
:
SerializableItem
(
_itemType
),
data
(
_data
)
{
}
const
Color
&
getData
()
{
return
data
;
}
void
setData
(
const
Color
&
_data
)
{
data
=
_data
;
}
bool
isEmpty
()
const
{
return
data
.
getValue
()
==
0
;
}
};
class
SerializableItem_DateTime
:
public
SerializableItem
{
...
...
@@ -133,6 +140,7 @@ public:
:
SerializableItem
(
_itemType
),
data
(
_data
)
{
}
const
QDateTime
&
getData
()
{
return
data
;
}
void
setData
(
const
QDateTime
&
_data
)
{
data
=
_data
;
}
bool
isEmpty
()
const
{
return
data
==
QDateTime
();
}
};
class
SerializableItem_ByteArray
:
public
SerializableItem
{
...
...
@@ -146,6 +154,7 @@ public:
:
SerializableItem
(
_itemType
),
data
(
_data
)
{
}
const
QByteArray
&
getData
()
{
return
data
;
}
void
setData
(
const
QByteArray
&
_data
)
{
data
=
_data
;
}
bool
isEmpty
()
const
{
return
data
.
isEmpty
();
}
};
#endif
servatrice/src/serversocketinterface.cpp
View file @
714a0eee
...
...
@@ -34,7 +34,6 @@ ServerSocketInterface::ServerSocketInterface(Servatrice *_server, QTcpSocket *_s
{
xmlWriter
=
new
QXmlStreamWriter
;
xmlWriter
->
setDevice
(
socket
);
xmlWriter
->
setAutoFormatting
(
true
);
xmlReader
=
new
QXmlStreamReader
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment