Beispiel #1
0
LocalZipTask::LocalZipTask(rc_ptr<ThreadPool> tp, TimerManager *tmgr, rc_ptr<XmlElement> config)
    : AbstractSyncTask(tp, tmgr)
{
    assert(tp.is_not_null() && NULL != tmgr && config.is_not_null());
    const string& name = config->get_name();
    set_name(QString::fromLocal8Bit(name.data(), name.length()));

    rc_ptr<XmlElement> x = config->get_child("source");
    if (x.is_not_null())
    {
        const string& text = x->get_text();
        set_source(QString::fromLocal8Bit(text.data(), text.length()));
    }
    else
    {
        NUT_LOG_E("plugin.syncer.localzip", "source path is missing for task %s",
            get_name().toLocal8Bit().data());
    }

    x = config->get_child("destination");
    if (x.is_not_null())
    {
        const string text = x->get_text();
        set_destination(QString::fromLocal8Bit(text.data(), text.length()));
    }
    else
    {
        NUT_LOG_E("plugin.syncer.localzip", "destination path is missing for task %s",
            get_name().toLocal8Bit().data());
    }

    x = config->get_child("timer");
    if (x.is_not_null())
    {
        const string text = x->get_text();
        const time_t secs = QString::fromLocal8Bit(text.data(), text.length()).toLong();
        set_timer_interval(secs);
    }

    start_timer();
}
Beispiel #2
0
void XmlElement::insert_child(size_t pos, rc_ptr<XmlElement> child)
{
    assert(pos <= _children.size() && child.is_not_null());
    _children.insert(_children.begin() + pos, child);
    _dirty = true;
}
Beispiel #3
0
void XmlElement::append_child(rc_ptr<XmlElement> child)
{
    assert(child.is_not_null());
    _children.push_back(child);
    _dirty = true;
}