include.cpp
Go to the documentation of this file.
00001 #include "rqt_mrta/config/include.h"
00002 #include "rqt_mrta/config/args.h"
00003 
00004 namespace rqt_mrta
00005 {
00006 namespace config
00007 {
00008 Include::Include(QObject* parent)
00009     : AbstractConfig(parent), args_(new Args(this))
00010 {
00011   connect(args_, SIGNAL(changed()), this, SIGNAL(changed()));
00012 }
00013 
00014 Include::~Include()
00015 {
00016   if (args_)
00017   {
00018     delete args_;
00019     args_ = NULL;
00020   }
00021 }
00022 
00023 QString Include::getFile() const { return file_; }
00024 
00025 Args* Include::getArgs() const { return args_; }
00026 
00027 void Include::setFile(const QString& file)
00028 {
00029   if (file != file_)
00030   {
00031     file_ = file;
00032     emit fileChanged(file);
00033     emit changed();
00034   }
00035 }
00036 
00037 QString Include::validate() const
00038 {
00039   if (file_.isEmpty())
00040   {
00041     return "Enter the file location to be included.";
00042   }
00043   return args_->validate();
00044 }
00045 
00046 void Include::save(QSettings& settings) const
00047 {
00048   settings.setValue("file", file_);
00049   args_->save(settings);
00050 }
00051 
00052 void Include::load(QSettings& settings)
00053 {
00054   setFile(settings.value("file").toString());
00055   args_->load(settings);
00056 }
00057 
00058 void Include::reset()
00059 {
00060   setFile("");
00061   args_->reset();
00062 }
00063 
00064 void Include::write(QDataStream& stream) const
00065 {
00066   stream << file_;
00067   args_->write(stream);
00068 }
00069 
00070 void Include::read(QDataStream& stream)
00071 {
00072   QString file;
00073   quint64 count;
00074   QString config;
00075   stream >> file;
00076   setFile(file);
00077   stream >> count;
00078   args_->read(stream);
00079 }
00080 
00081 Include& Include::operator=(const Include& config)
00082 {
00083   setFile(config.file_);
00084   *args_ = *config.args_;
00085   return *this;
00086 }
00087 
00088 QString Include::toLaunch(const QString &prefix) const
00089 {
00090   QString launch;
00091   launch += prefix + "<include file=\"" + file_ + "\">\n";
00092   launch += args_->toLaunch(prefix);
00093   launch += prefix + "</include>\n";
00094   return launch;
00095 }
00096 }
00097 }


rqt_mrta
Author(s): Adriano Henrique Rossette Leite
autogenerated on Thu Jun 6 2019 18:50:52