72 #include <OpenFlipper/common/UpdateType.hh>
76 #include <QStringList>
80 #if QT_VERSION >= 0x050000
81 #include <QJsonDocument>
82 #include <QJsonObject>
134 int persistentId()
const;
138 void persistentId(
int _id );
164 bool dataType(
DataType _type)
const;
192 virtual void cleanup();
202 virtual QString getObjectinfo();
205 virtual void printObjectInfo();
227 void target(
bool _target);
236 void source(
bool _source);
240 bool flag(QString _flag);
244 void setFlag(QString _flag,
bool _set);
276 virtual bool visible();
279 virtual void visible(
bool _visible);
389 int childCount()
const;
395 QList< BaseObject* > getLeafs();
398 void deleteSubtree();
417 bool isGroup()
const;
423 bool isInGroup(
int _id )
const;
429 bool isInGroup( QString _name )
const;
433 std::vector< int > getGroupIds();
437 QStringList getGroupNames();
451 void setFromFileName(
const QString &_filename);
455 QString path()
const;
458 void setPath(
const QString &_path);
461 QString name( )
const;
467 virtual void setName(QString _name );
470 QString filename()
const;
473 void setFileName(
const QString &_filename);
510 void setObjectData( QString _dataName ,
PerObjectData* _data );
513 void clearObjectData( QString _dataName );
516 bool hasObjectData( QString _dataName );
536 QMap<QString, PerObjectData*>& getPerObjectDataMap();
557 return commentsByKey_[key];
566 return commentsByKey_.value(key);
571 return commentsByKey_.contains(key);
576 return !commentsByKey_.empty();
580 commentsByKey_.remove(key);
584 commentsByKey_.clear();
589 return commentsByKey_;
596 result.append(QString(
"BEGIN Comments for object \"%1\"").arg(name()));
601 #if QT_VERSION >= 0x050000
602 QJsonObject comment_obj;
603 for (QMap<QString, QString>::const_iterator it = commentsByKey_.begin(), it_end = commentsByKey_.end();
604 it != it_end; ++it) {
606 QJsonParseError json_error;
607 QString test_json_str = QString::fromUtf8(
"{\"test\": %1}").arg(it.value());
608 QByteArray test_json_ba = test_json_str.toUtf8();
609 QJsonDocument test_json = QJsonDocument::fromJson(test_json_ba, &json_error);
610 if (json_error.error != QJsonParseError::NoError) {
611 comment_obj[it.key()] = it.value();
613 comment_obj[it.key()] = test_json.object().value(
"test");
616 result.append(QString::fromUtf8(QJsonDocument(comment_obj).toJson(QJsonDocument::Indented)));
618 for (QMap<QString, QString>::const_iterator it = commentsByKey_.begin(), it_end = commentsByKey_.end();
619 it != it_end; ++it) {
620 result.append(QString(
"%1: %2").arg(it.key(), it.value()));
624 result.append(QString(
"END Comments for object \"%1\"\n").arg(name()));
626 return result.join(
"\n");
638 #endif // BASEOBJECT_HH defined
QString path_
path to the file from which the object is loaded ( defaults to "." )
const QString getAllCommentsFlat() const
QMap< QString, PerObjectData * > dataMap_
get reference to map of all perObject Datas
void clearComment(const QString &key)
Get comment for the specified key.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
const QMap< QString, QString > & getAllComments() const
QList< BaseObject * > childItems_
Children of this node.
void visibilityChanged(int _id)
Tell plugins that the visibility of an object has changed.
void objectSelectionChanged(int)
This signal is emitted if the object has been changed (source/target)
QString filename_
path to the file from which the object is loaded ( defaults to "." )
const QString getCommentByKey(const QString &key) const
Get comment for the specified key.
QString name_
Object/FileName ( defaults to NONAME )
void objectPropertiesChanged(int _id)
Tell plugins that object properties such as object names have been changed.
QString & getCommentByKey(const QString &key)
Get comment for the specified key.
QMap< QString, QString > commentsByKey_
Get comment for the specified key.
int persistentId_
Persistent ID for this Object.
int id_
Unique ID for this Object.
void clearAllComments()
Get comment for the specified key.
bool hasCommentForKey(const QString &key) const
BaseObject * parentItem_
Parent item or 0 if rootnode.