Version: 9.16.0
ItemMimeData.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include "ItemMimeData.hxx"
21#include "guiObservers.hxx"
22#include "Catalog.hxx"
23
24#include <QStringList>
25
26//#define _DEVDEBUG_
27#include "YacsTrace.hxx"
28
29using namespace std;
30using namespace YACS::ENGINE;
31using namespace YACS::HMI;
32
33ItemMimeData::ItemMimeData(): QMimeData()
34{
35 _sub.clear();
36 _catalog.clear();
37 _cataName.clear();
38 _compoName.clear();
39 _typeName.clear();
40 _swCase=0;
41 _control=false;
42}
43
45{
46}
47
49{
50 _sub.push_back(sub);
51}
52
54{
55 _catalog.push_back(cata);
56}
57
58void ItemMimeData::setCataName(std::string cataName)
59{
60 _cataName.push_back(cataName);
61}
62
63void ItemMimeData::setCompo(std::string compo)
64{
65 _compoName.push_back(compo);
66}
67
68void ItemMimeData::setType(std::string aType)
69{
70 _typeName.push_back(aType);
71}
72
73void ItemMimeData::setCase(int aCase)
74{
75 _swCase = aCase;
76}
77
79{
80 YASSERT(i < _sub.size());
81 return _sub[i];
82}
83
85{
86 YASSERT(i < _catalog.size());
87 return _catalog[i];
88}
89
90std::string ItemMimeData::getCataName(int i) const
91{
92 YASSERT(i < _cataName.size());
93 return _cataName[i];
94}
95
96std::string ItemMimeData::getCompo(int i) const
97{
98 YASSERT(i < _compoName.size());
99 return _compoName[i];
100}
101
102std::string ItemMimeData::getType(int i) const
103{
104 YASSERT(i < _typeName.size());
105 return _typeName[i];
106}
107
109{
110 return _swCase;
111}
112void ItemMimeData::setControl(bool control)
113{
114 _control=control;
115}
117{
118 return _control;
119}
120
122{
123 int lg=0;
124 QStringList myFormats = formats();
125 for (int i=0; i<myFormats.size(); i++)
126 {
127 if (myFormats[i].contains("yacs/cata"))
128 {
129 lg = _cataName.size();
130 break;
131 }
132 else
133 {
134 lg = _sub.size();
135 break;
136 }
137 }
138 return lg;
139}
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
class for YACS catalogs.
Definition: Catalog.hxx:42
virtual int getCase() const
std::vector< std::string > _typeName
virtual int getDataSize() const
virtual void setCompo(std::string compo)
virtual bool getControl() const
virtual Subject * getSubject(int i=0) const
virtual std::string getType(int i=0) const
virtual std::string getCataName(int i=0) const
virtual void setType(std::string aType)
virtual void setCase(int aCase)
virtual YACS::ENGINE::Catalog * getCatalog(int i=0) const
std::vector< std::string > _compoName
std::vector< YACS::ENGINE::Catalog * > _catalog
std::vector< Subject * > _sub
virtual std::string getCompo(int i=0) const
virtual void setCataName(std::string cataName)
virtual void setCatalog(YACS::ENGINE::Catalog *cata)
virtual void setSubject(Subject *sub)
virtual void setControl(bool control)
std::vector< std::string > _cataName