default smart pointer type switched to intrusive_ptr

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@337 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-11 21:34:53 +00:00
parent 3b6743b110
commit 33fd2b5e18
103 changed files with 368 additions and 256 deletions
+7
View File
@@ -9,6 +9,7 @@
#include <data/action/set.hpp>
#include <data/set.hpp>
#include <data/card.hpp>
#include <data/stylesheet.hpp>
#include <util/error.hpp>
// ----------------------------------------------------------------------------- : Add card
@@ -89,6 +90,9 @@ void DisplayChangeAction::perform(bool to_undo) {
}
ChangeCardStyleAction::ChangeCardStyleAction(const CardP& card, const StyleSheetP& stylesheet)
: card(card), stylesheet(stylesheet)
{}
String ChangeCardStyleAction::getName(bool to_undo) const {
return _("Change style");
}
@@ -97,6 +101,9 @@ void ChangeCardStyleAction::perform(bool to_undo) {
}
ChangeSetStyleAction::ChangeSetStyleAction(Set& set, const CardP& card)
: set(set), card(card)
{}
String ChangeSetStyleAction::getName(bool to_undo) const {
return _("Change style (all cards)");
}
+2 -4
View File
@@ -87,8 +87,7 @@ class DisplayChangeAction : public Action {
/// Changing the style of a a card
class ChangeCardStyleAction : public DisplayChangeAction {
public:
ChangeCardStyleAction(const CardP& card, const StyleSheetP& stylesheet)
: card(card), stylesheet(stylesheet) {}
ChangeCardStyleAction(const CardP& card, const StyleSheetP& stylesheet);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
@@ -101,8 +100,7 @@ class ChangeCardStyleAction : public DisplayChangeAction {
/// Changing the style of a set to that of a card
class ChangeSetStyleAction : public DisplayChangeAction {
public:
ChangeSetStyleAction(Set& set, const CardP& card)
: set(set), card(card) {}
ChangeSetStyleAction(Set& set, const CardP& card);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
+3 -3
View File
@@ -289,7 +289,7 @@ double ssqrt(double x) {
}
// Remove a single control point
class SinglePointRemoveAction : public Action {
class SinglePointRemoveAction : public Action, public IntrusivePtrBase<SinglePointRemoveAction> {
public:
SinglePointRemoveAction(const SymbolPartP& part, UInt position);
@@ -393,7 +393,7 @@ ControlPointRemoveAction::ControlPointRemoveAction(const SymbolPartP& part, cons
FOR_EACH(point, part->points) {
if (toDelete.find(point) != toDelete.end()) {
// remove this point
removals.push_back(new_shared2<SinglePointRemoveAction>(part, index));
removals.push_back(new_intrusive2<SinglePointRemoveAction>(part, index));
}
++index;
}
@@ -417,7 +417,7 @@ void ControlPointRemoveAction::perform(bool to_undo) {
Action* controlPointRemoveAction(const SymbolPartP& part, const set<ControlPointP>& toDelete) {
if (part->points.size() - toDelete.size() < 2) {
// TODO : remove part?
//new_shared<ControlPointRemoveAllAction>(part);
//new_intrusive<ControlPointRemoveAllAction>(part);
return 0; // no action
} else {
return new ControlPointRemoveAction(part, toDelete);
+1 -1
View File
@@ -36,7 +36,7 @@ inline void swap_value(TextValue& a, TextValue ::ValueType& b
template <typename T, bool ALLOW_MERGE>
class SimpleValueAction : public ValueAction {
public:
inline SimpleValueAction(const shared_ptr<T>& value, const typename T::ValueType& new_value)
inline SimpleValueAction(const intrusive_ptr<T>& value, const typename T::ValueType& new_value)
: ValueAction(value), new_value(new_value)
{}