linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05161
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2795: Types must be movable to be allowed to move them
------------------------------------------------------------
revno: 2795
committer: Jacek Sieka <arnetheduck@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Sat 2012-01-07 21:02:47 +0100
message:
Types must be movable to be allowed to move them
modified:
dcpp/QueueItem.cpp
dcpp/QueueItem.h
dwt/include/dwt/CanvasClasses.h
dwt/src/CanvasClasses.cpp
win32/WinUtil.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/QueueItem.cpp'
--- dcpp/QueueItem.cpp 2011-12-22 22:14:45 +0000
+++ dcpp/QueueItem.cpp 2012-01-07 20:02:47 +0000
@@ -200,4 +200,13 @@
}
}
+string QueueItem::getListName() const {
+ dcassert(isSet(QueueItem::FLAG_USER_LIST));
+ if(isSet(QueueItem::FLAG_XML_BZLIST)) {
+ return getTarget() + ".xml.bz2";
+ } else {
+ return getTarget() + ".xml";
+ }
+}
+
}
=== modified file 'dcpp/QueueItem.h'
--- dcpp/QueueItem.h 2011-12-23 21:15:27 +0000
+++ dcpp/QueueItem.h 2012-01-07 20:02:47 +0000
@@ -56,18 +56,25 @@
enum FileFlags {
/** Normal download, no flags set */
FLAG_NORMAL = 0x00,
+
/** This is a user file listing download */
FLAG_USER_LIST = 0x02,
+
/** The file list is downloaded to use for directory download (used with USER_LIST) */
FLAG_DIRECTORY_DOWNLOAD = 0x04,
+
/** The file is downloaded to be viewed in the gui */
FLAG_CLIENT_VIEW = 0x08,
+
/** Flag to indicate that file should be viewed as a text file */
FLAG_TEXT = 0x20,
+
/** Match the queue against this list */
FLAG_MATCH_QUEUE = 0x80,
+
/** The file list downloaded was actually an .xml.bz2 list */
FLAG_XML_BZLIST = 0x100,
+
/** Only download a part of the file list */
FLAG_PARTIAL_LIST = 0x200
};
@@ -168,14 +175,7 @@
return downloads.empty();
}
- string getListName() const {
- dcassert(isSet(QueueItem::FLAG_USER_LIST));
- if(isSet(QueueItem::FLAG_XML_BZLIST)) {
- return getTarget() + ".xml.bz2";
- } else {
- return getTarget() + ".xml";
- }
- }
+ string getListName() const;
const string& getTempTarget();
void setTempTarget(const string& aTempTarget) { tempTarget = aTempTarget; }
=== modified file 'dwt/include/dwt/CanvasClasses.h'
--- dwt/include/dwt/CanvasClasses.h 2012-01-06 23:14:39 +0000
+++ dwt/include/dwt/CanvasClasses.h 2012-01-07 20:02:47 +0000
@@ -157,22 +157,29 @@
class Selector : boost::noncopyable {
public:
template<typename T>
- Selector(Canvas& canvas_, T& t) : canvas(canvas_), h(::SelectObject(canvas.handle(), t.handle())) { }
-
- ~Selector() { ::SelectObject(canvas.handle(), h); }
+ Selector(Canvas& canvas_, T& t) : canvas(&canvas_), h(::SelectObject(canvas->handle(), t.handle())) { }
+
+ Selector(Selector &&rhs) : canvas(rhs.canvas), h(rhs.h) { rhs.canvas = nullptr; }
+ Selector& operator=(Selector &&rhs) { if(&rhs != this) { canvas = rhs.canvas; h = rhs.h; rhs.canvas = nullptr; } return *this; }
+
+ ~Selector() { if(canvas) ::SelectObject(canvas->handle(), h); }
private:
- Canvas& canvas;
+ Canvas* canvas;
HGDIOBJ h;
};
class BkMode : boost::noncopyable {
public:
BkMode(Canvas& canvas_, int mode);
+
+ BkMode(BkMode &&rhs) : canvas(rhs.canvas), prevMode(rhs.prevMode) { rhs.canvas = nullptr; }
+ BkMode& operator=(BkMode &&rhs) { if(&rhs != this) { canvas = rhs.canvas; prevMode = rhs.prevMode; rhs.canvas = nullptr; } return *this; }
+
~BkMode();
private:
- Canvas& canvas;
+ Canvas* canvas;
int prevMode;
};
=== modified file 'dwt/src/CanvasClasses.cpp'
--- dwt/src/CanvasClasses.cpp 2012-01-06 23:14:39 +0000
+++ dwt/src/CanvasClasses.cpp 2012-01-07 20:02:47 +0000
@@ -279,13 +279,13 @@
}
Canvas::BkMode::BkMode(Canvas& canvas_, int mode) :
-canvas(canvas_), prevMode(::SetBkMode(canvas.handle(), mode))
+canvas(&canvas_), prevMode(::SetBkMode(canvas->handle(), mode))
{
}
Canvas::BkMode::~BkMode() {
- if(prevMode)
- ::SetBkMode(canvas.handle(), prevMode);
+ if(canvas && prevMode)
+ ::SetBkMode(canvas->handle(), prevMode);
}
Canvas::BkMode Canvas::setBkMode(bool transparent) {
=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp 2012-01-07 18:16:19 +0000
+++ win32/WinUtil.cpp 2012-01-07 20:02:47 +0000
@@ -1444,7 +1444,6 @@
addUsers(menu, T_("Grant &extra slot"), users, [=](const HintedUser &u, const string& s) {
UploadManager::getInstance()->reserveSlot(u); });
- typedef void (QueueManager::*qmp)(const UserPtr&, int);
addUsers(menu, T_("Remove user from queue"), users, [=](const HintedUser &u, const string& s) {
qm->removeSource(u, QueueItem::Source::FLAG_REMOVED); });
}