/*
 * This file is autogenerated with bcop:
 * The Compiz option code generator
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */


#include <core/core.h>

#include "imgjpeg_options.h"

ImgjpegOptions::ImgjpegOptions (bool init /* = true */) :
    mOptions (ImgjpegOptions::OptionNum),
    mNotify (ImgjpegOptions::OptionNum)
{
    if (init)
        initOptions ();
}

void
ImgjpegOptions::initOptions ()
{

    // quality
    mOptions[ImgjpegOptions::Quality].setName ("quality", CompOption::TypeInt);
    mOptions[ImgjpegOptions::Quality].rest ().set (0, 100);
    mOptions[ImgjpegOptions::Quality].value().set((int) 80);

}

ImgjpegOptions::~ImgjpegOptions ()
{
}


CompOption::Vector &
ImgjpegOptions::getOptions ()
{
    return mOptions;
}

bool
ImgjpegOptions::setOption (const CompString &name, CompOption::Value &value)
{
    CompOption   *o;
    unsigned int index;

    o = CompOption::findOption (mOptions, name, &index);

    if (!o)
        return false;

    switch (index)
    {
        case ImgjpegOptions::Quality:
            if (o->set (value))
            {
                if (!mNotify[ImgjpegOptions::Quality].empty ())
                    mNotify[ImgjpegOptions::Quality] (o, ImgjpegOptions::Quality);
                return true;
            }
            break;
        default:
            break;
    }
    return false;

}

