#include "save2filetexts.h"

string_code_objects getObjectCode(QString text) {
  if (text.compare("") == 0)
    return obj_simple;
  if (text.compare(CMOCapabText) == 0)
    return obj_capab;
  if (text.compare(CMOSLimitsText) == 0)
    return obj_limits;
  if (text.compare(CMOSImageParamsText) == 0)
    return obj_imgParams;
  if (text.compare(CMOSROIText) == 0)
    return obj_roi;
  if (text.compare(CMOSFlipText) == 0)
    return obj_flip;
  if (text.compare(CMOSBinText) == 0)
    return obj_binnig;
  if (text.compare(CMOSSkipText) == 0)
    return obj_skip;

  return obj_invalid;
}

string_code_simple getSimpleCode(QString text) {
  if (text.compare(CMOSTypeText) == 0)
    return simple_CMOStype;
  if (text.compare(CMOSShutterText) == 0)
    return simple_CMOShutter;
  if (text.compare(CMOSAECText) == 0)
    return simple_AEC;
  if (text.compare(CMOSAGCText) == 0)
    return simple_AGC;
  if (text.compare(CMOSHDRText) == 0)
    return simple_HDR;
  if (text.compare(CMOSTestText) == 0)
    return simple_test;
  if (text.compare(CMOSBrightText) == 0)
    return simple_bright;
  if (text.compare(CMOSGainText) == 0)
    return simple_gain;
  if (text.compare(CMOSExpText) == 0)
    return simple_exp;

  return simple_invalid;
}

string_code_capab getCapabCode(QString text) {
  if (text.compare(CMOCapabRGBText) == 0)
    return capab_RGB;
  if (text.compare(CMOCapabAECText) == 0)
    return capab_AEC;
  if (text.compare(CMOCapabAGCText) == 0)
    return capab_AGC;
  if (text.compare(CMOCapabHDRText) == 0)
    return capab_HDR;
  if (text.compare(CMOCapabROIText) == 0)
    return capab_ROI;
  if (text.compare(CMOCapabBinText) == 0)
    return capab_bin;
  if (text.compare(CMOCapabSkipText) == 0)
    return capab_skip;
  if (text.compare(CMOCapabFlipText) == 0)
    return capab_flip;
  if (text.compare(CMOCapabTestText) == 0)
    return capab_test;

  return capab_invalid;
}

string_code_lims getLimsCode(QString text) {
  if (text.compare(CMOSLimitsMinWidthText) == 0)
    return lims_minWidth;
  if (text.compare(CMOSLimitsMaxWidthText) == 0)
    return lims_maxWidth;
  if (text.compare(CMOSLimitsMinHeightText) == 0)
    return lims_minHeight;
  if (text.compare(CMOSLimitsMaxHeightText) == 0)
    return lims_maxHeight;
  if (text.compare(CMOSLimitsMinBrightText) == 0)
    return lims_minBright;
  if (text.compare(CMOSLimitsMaxBrightText) == 0)
    return lims_maxBright;
  if (text.compare(CMOSLimitsMinGainText) == 0)
    return lims_minGain;
  if (text.compare(CMOSLimitsMaxGainText) == 0)
    return lims_maxGain;
  if (text.compare(CMOSLimitsGainStepsRText) == 0)
    return lims_gainStepR;
  if (text.compare(CMOSLimitsGainStepsText) == 0)
    return lims_gainStep;
  if (text.compare(CMOSLimitsGainLimsText) == 0)
    return lims_gainLim;
  if (text.compare(CMOSLimitsBinText) == 0)
    return lims_bin;
  if (text.compare(CMOSLimitsSkipText) == 0)
    return lims_skip;

  return lims_invalid;
}

string_code_image getImageCode(QString text) {
  if (text.compare(CMOSImageParamsWidthText) == 0)
    return img_width;
  if (text.compare(CMOSImageParamsHeightText) == 0)
    return img_height;
  if (text.compare(CMOSImageParamsRGBText) == 0)
    return img_rgb;

  return img_invalid;
}

string_code_roi getROICode(QString text) {
  if (text.compare(CMOSROIEnabledText) == 0)
    return roi_enabled;
  if (text.compare(CMOSROIWidthText) == 0)
    return roi_width;
  if (text.compare(CMOSROIHeightText) == 0)
    return roi_height;
  if (text.compare(CMOSROIStartXText) == 0)
    return roi_startX;
  if (text.compare(CMOSROIStartYText) == 0)
    return roi_startY;

  return roi_invalid;
}

string_code_flip getFlipCode(QString text) {
  if (text.compare(CMOSFlipRowText) == 0)
    return flip_row;
  if (text.compare(CMOSFlipColText) == 0)
    return flip_col;

  return flip_invalid;
}

string_code_bin getBinCode(QString text) {
  if (text.compare(CMOSBinRowText) == 0)
    return bin_row;
  if (text.compare(CMOSBinColText) == 0)
    return bin_col;

  return bin_invalid;
}

string_code_skip getSkipCode(QString text) {
  if (text.compare(CMOSSkipRowText) == 0)
    return skip_row;
  if (text.compare(CMOSSkipColText) == 0)
    return skip_col;

  return skip_invalid;
}
