Example #1
0
void CParagraphFormatDialog::DoDataExchange(CDataExchange* pDX)
{
	CPmwDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CParagraphFormatDialog)
	//}}AFX_DATA_MAP
	if (pDX->m_bSaveAndValidate)
	{
		GetDoubleValue(pDX, IDC_LEFT_MARGIN, m_dLeftMargin, m_fLeftMargin, 0., 99.);
		GetDoubleValue(pDX, IDC_RIGHT_MARGIN, m_dRightMargin, m_fRightMargin, 0., 99.);
		GetDoubleValue(pDX, IDC_FIRST_LINE_INDENT, m_dFirstLineIndent, m_fFirstLineIndent, -99., 99.);
		GetDoubleValue(pDX, IDC_LEADING_VALUE, m_dLeading, m_fLeading, 0., 99.);
		GetDoubleValue(pDX, IDC_SPACE_BEFORE, m_dSpaceBefore, m_fSpaceBefore, 0., 99.);
		GetDoubleValue(pDX, IDC_SPACE_AFTER, m_dSpaceAfter, m_fSpaceAfter, 0., 99.);
	}
	else
	{
		SetDoubleValue(IDC_LEFT_MARGIN, m_dLeftMargin, -4, m_fLeftMargin);
		SetDoubleValue(IDC_RIGHT_MARGIN, m_dRightMargin, -4, m_fRightMargin);
		SetDoubleValue(IDC_FIRST_LINE_INDENT, m_dFirstLineIndent, -4, m_fFirstLineIndent);
		SetDoubleValue(IDC_LEADING_VALUE, m_dLeading, -4, m_fLeading);
		SetDoubleValue(IDC_SPACE_BEFORE, m_dSpaceBefore, -4, m_fSpaceBefore);
		SetDoubleValue(IDC_SPACE_AFTER, m_dSpaceAfter, -4, m_fSpaceAfter);
	}

	// Unconditional ones.
	DDX_CBIndex(pDX, IDC_ALIGNMENT, m_nAlignment);
	DDX_Radio(pDX, IDC_LEADING_LINES, m_nLeadingType);
}
Example #2
0
//-----------------------------------------------------------------------------
void Profile::SetValue(JSON* val)
{
    if (val->Type == JSON_Number)
        SetDoubleValue(val->Name, val->dValue);
    else if (val->Type == JSON_Bool)
        SetBoolValue(val->Name, (val->dValue != 0));
    else if (val->Type == JSON_String)
        SetValue(val->Name, val->Value);
    else if (val->Type == JSON_Array)
    {
        if (val == NULL)
            return;

        // Create a copy of the array
        JSON* value = val->Copy();
        Values.PushBack(value);
        ValMap.Set(value->Name, value);
    }
}
bool BayesianClassifier::Save(xmlNodePtr classifierNode)
{
  int i;
  bool retCode = true;
  xmlNodePtr modelNode;

  SetIntValue(classifierNode, DIMENSION_STR, mNumDimensions);
  SetIntValue(classifierNode, CLASSES_STR, mNumClasses);
  SetStringValue(classifierNode, FEATURE_STR, mFeatureString);

  for (i = 0; (i < mNumClasses) && retCode; i++)
  {
    modelNode = xmlNewNode(NULL, (const xmlChar*)GMM_STR);
    xmlAddChild(classifierNode, modelNode);
    SetDoubleValue(modelNode, WEIGHT_STR, mClassWeights[i]);
    retCode = mModels[i].Save(modelNode);
    if ( !retCode )
      fprintf(stderr, "BayesianClassifier::Save - Failed saviing GMM %d\n", i);
  }

  return retCode;
}
Example #4
0
//-----------------------------------------------------------------------------
void Profile::SetFloatValue(const char* key, float val)
{
    SetDoubleValue(key, val);
}
Example #5
0
//-----------------------------------------------------------------------------
void Profile::SetIntValue(const char* key, int val)
{
    SetDoubleValue(key, val);
}
Example #6
0
/*!
  @param filename - the name of the configuration file
  @return CFG_FILE_NOT_SPECIFIED if filename is ""
  @return CFG_FILE_NOT_WRITABLE if the file cannot be opened for writing
  @return CFG_OK if successful

  Saves the configuration of the ConfigMgr to file.
*/
ConfigMgrStatusType ConfigMgr::Save(string filename)
{
  int i;
  FILE *fp;
  xmlDocPtr document;
  xmlNodePtr rootNode;
  xmlNodePtr repositoryNode;
  xmlNodePtr featureNode;
  int numRepositories;
  string appRoverDir = APP_ROVER_DIR;
  map<string,bool>::iterator feature;

  if ( filename == "" )
    return CFG_FILE_NOT_SPECIFIED;

  fp = fopen(filename.c_str(), "w");
  if ( !fp )
    return CFG_FILE_NOT_WRITABLE;

  mCfgFilename = filename;

  document = xmlNewDoc(NULL);
  rootNode = xmlNewDocNode(document,NULL,(const xmlChar *)CONFIG_HDR_STR,NULL);
  SetDoubleValue(rootNode, VERSION_STR, 1);
  xmlDocSetRootElement(document,rootNode);

  if ( mInstallLogFilename == "" )
    SetStringValue(rootNode, LOG_STR, appRoverDir+"AppRover.log");
  else
    SetStringValue(rootNode, LOG_STR, mInstallLogFilename);
  if ( mStorageDirectory == "" )
    SetStringValue(rootNode, STORAGE_STR, appRoverDir+"storage/");
  else
    SetStringValue(rootNode, STORAGE_STR, mStorageDirectory);
  if ( mWorkDirectory == "" )
    SetStringValue(rootNode, WORK_STR, appRoverDir + "work/");
  else
    SetStringValue(rootNode, WORK_STR, mWorkDirectory);
  if ( mInstallFileDirectory == "" )
    SetStringValue(rootNode, INSTALL_FILE_STR, appRoverDir + "files/");
  else
    SetStringValue(rootNode, INSTALL_FILE_STR, mInstallFileDirectory);

  if ( mNumProcessors < 1 )
    DetectNumProcessors();
  SetIntValue(rootNode, PROCESSOR_STR, mNumProcessors);

  numRepositories = mRepositoryDirectories.size();
  if ( !numRepositories )
  {
    repositoryNode = xmlNewNode(NULL,(const xmlChar*)REPOSITORY_STR);
    SetStringValue(repositoryNode, DIR_STR, appRoverDir+"repo/");
    xmlAddChild(rootNode,repositoryNode);
  }
  else
  {
    for (i = 0; i < numRepositories; i++)
    {
      repositoryNode = xmlNewNode(NULL,(const xmlChar*)REPOSITORY_STR);
      SetStringValue(repositoryNode, DIR_STR, mRepositoryDirectories[i]);
      xmlAddChild(rootNode,repositoryNode);
    }
  }

  for (feature=mFeatureSettings.begin(); feature!=mFeatureSettings.end(); feature++)
  {
    featureNode = xmlNewNode(NULL,(const xmlChar*)FEATURE_STR);
    SetStringValue(featureNode, FEATURE_NAME_STR, (*feature).first);
    SetBoolValue(featureNode, ENABLED_STR, (*feature).second);
    xmlAddChild(rootNode,featureNode);
  }

  xmlDocFormatDump(fp,document,1);
  fclose(fp);
  xmlFreeDoc(document);
  return CFG_OK;
}