Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "ext/CompositeStatus.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tgeometry.h"
Toshihiro Shimizu 890ddd
#include "tvectorimage.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "ext/Types.h"
Toshihiro Shimizu 890ddd
#include "ext/StrokeParametricDeformer.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <vector></vector>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace ToonzExt {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
/**
Toshihiro Shimizu 890ddd
   *@class CompositeStatus
Toshihiro Shimizu 890ddd
   *@brief This class mantains interal data for Dragger manipulator.
Toshihiro Shimizu 890ddd
   */
Toshihiro Shimizu 890ddd
CompositeStatus::CompositeStatus()
Shinya Kitaoka 120a6e
    : dbImpl_(new std::map<std::string, *="" compositestatus="">), db_(*dbImpl_) {}</std::string,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
CompositeStatus::~CompositeStatus() {
Shinya Kitaoka 120a6e
  iterator it = db_.begin(), end = db_.end();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  while (it != end) {
Shinya Kitaoka 120a6e
    delete it->second;
Shinya Kitaoka 120a6e
    ++it;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  delete dbImpl_;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CompositeStatus::add(CompositeStatus *status, const std::string &name) {
Shinya Kitaoka 120a6e
  if (!status) return;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  CompositeStatus *tmp = this->find(name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (tmp) delete tmp;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  db_[name] = status;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CompositeStatus::remove(const std::string &name) {
Shinya Kitaoka 120a6e
  iterator found = db_.find(name), end = db_.end();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (found != end) {
Shinya Kitaoka 120a6e
    delete found->second;
Shinya Kitaoka 120a6e
    db_.erase(found);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
CompositeStatus *CompositeStatus::find(const std::string &name) const {
Shinya Kitaoka 120a6e
  const_iterator found = db_.find(name), end = db_.end();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (found != end) return found->second;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return 0;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
}