Пример #1
0
 inline void vLoss(const char *kw, AzLossType *out_loss) {
   if (param == NULL) return; 
   AzBytArr s; 
   vStr(kw, &s); 
   if (s.length() > 0) {
     *out_loss = AzLoss::lossType(s.c_str()); 
   }
   if (doCheck) sp_used_kw.put(kw); 
 }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DREAM3DUpdateCheckDialog::setCurrentVersion(QString version)
{
  m_CurrentVersion = version;
  QStringList appVersionParts = m_CurrentVersion.split(QString("."));

  {
    QString vStr(appVersionParts.at(0));
    vStr.append(".").append(appVersionParts.at(1)).append(".").append(appVersionParts.at(2));
    currentVersion->setText(vStr);
  }
}
Пример #3
0
TEST(syntax, parameter_order_index) {
  CREATE_RUNTIME();
  CREATE_TEST_ARENA();

  variant_t *subject_key = vValue(ROOT(runtime, subject_key));
  variant_t *selector_key = vValue(ROOT(runtime, selector_key));

  CHECK_ORDERING_INDEX(0, vArray(subject_key));
  CHECK_ORDERING_INDEX(1, vArray(selector_key));
  CHECK_ORDERING_INDEX(0, vArray(subject_key, selector_key));

  CHECK_ORDERING_INDEX(2, vArray(vInt(0)));
  CHECK_ORDERING_INDEX(3, vArray(vInt(1)));
  CHECK_ORDERING_INDEX(4, vArray(vInt(2)));
  CHECK_ORDERING_INDEX(2, vArray(vInt(0), vInt(2)));
  CHECK_ORDERING_INDEX(2, vArray(vInt(2), vInt(0)));
  CHECK_ORDERING_INDEX(1, vArray(vInt(2), selector_key));

  CHECK_ORDERING_INDEX(kMaxOrderIndex, vArray(vStr("foo")));
  CHECK_ORDERING_INDEX(102, vArray(vStr("foo"), vInt(100)));

  DISPOSE_TEST_ARENA();
  DISPOSE_RUNTIME();
}
Пример #4
0
wxSize wxListBox::DoGetBestSize() const
{
    //
    // Find the widest string
    //
    int                             nLine;
    int                             nListbox = 0;
    int                             nCx;
    int                             nCy;
    wxFont                          vFont = (wxFont)GetFont();

    for (int i = 0; i < m_nNumItems; i++)
    {
        wxString                    vStr(GetString(i));

        GetTextExtent( vStr
                      ,&nLine
                      ,NULL
                     );
        if (nLine > nListbox)
            nListbox = nLine;
    }

    //
    // Give it some reasonable default value if there are no strings in the
    // list.
    //
    if (nListbox == 0)
        nListbox = 100;

    //
    // The listbox should be slightly larger than the widest string
    //
    wxGetCharSize( GetHWND()
                  ,&nCx
                  ,&nCy
                  ,&vFont
                 );
    nListbox += 3 * nCx;

    int                             hListbox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy) * (wxMax(m_nNumItems, 7));

    return wxSize( nListbox
                  ,hListbox
                 );
} // end of wxListBox::DoGetBestSize
Пример #5
0
void XAITaskListsParser::WriteDefaultTaskListsFile(XAIHelper* h, const std::string& cfgFileName) {
	std::ofstream fs(cfgFileName.c_str(), std::ios::out);

	std::stringstream vStr(aiexport_getVersion());

	fs << "cfg = {" << std::endl;
	fs << "\t[\"version\"] = \"" << (aiexport_getVersion()) << "\"," << std::endl;
	fs << "\t[\"UnnamedConfig\"] = {" << std::endl;
	fs << "\t\t[\"Weight\"] = 100," << std::endl;
	fs << "\t\t[\"BuilderLists\"] = {" << std::endl;

	const unsigned int builderMask = MASK_BUILDER_MOBILE | MASK_BUILDER_STATIC;
	const unsigned int attackerMask = MASK_OFFENSE_MOBILE | MASK_OFFENSE_STATIC;
	const std::list<std::set<int>* >& builderDefIDSets = h->unitDefHandler->GetUnitDefIDSetsForMask(builderMask, 0, 0);
	const std::list<std::set<int>* >& attackerDefIDSets = h->unitDefHandler->GetUnitDefIDSetsForMask(attackerMask, 0, 0);
	const XAIUnitDef* builderDef  = 0;
	const XAIUnitDef* buildeeDef  = 0;
	const XAIUnitDef* attackerDef = 0;
	const XAIUnitDef* attackeeDef = 0;

	for (std::list<std::set<int>* >::const_iterator lit = builderDefIDSets.begin(); lit != builderDefIDSets.end(); lit++) {
		for (std::set<int>::const_iterator sit = (*lit)->begin(); sit != (*lit)->end(); sit++) {
			builderDef = h->unitDefHandler->GetUnitDefByID(*sit);
			buildeeDef = h->unitDefHandler->GetUnitDefByID(*(builderDef->buildOptionUDIDs.begin()));

			fs << "\t\t\t[\"" << std::string(builderDef->GetName()) << "\"] = {" << std::endl;
			fs << "\t\t\t\t[1] = {" << std::endl;
			fs << "\t\t\t\t\t[\"Weight\"] = 100," << std::endl;
			fs << "\t\t\t\t\t[\"Items\"] = {" << std::endl;
			fs << "\t\t\t\t\t\t[1] = {" << std::endl;
			fs << "\t\t\t\t\t\t\tbuildeeDef = \"" << std::string(buildeeDef->GetName()) << "\"," << std::endl;
			fs << "\t\t\t\t\t\t\tunitCount  = 1," << std::endl;
			fs << "\t\t\t\t\t\t}," << std::endl;
			fs << "\t\t\t\t\t}," << std::endl;
			fs << "\t\t\t\t}," << std::endl;
			fs << "\t\t\t}," << std::endl;
		}
	}

	fs << "\t\t}," << std::endl;
	fs << std::endl;
	fs << "\t\t[\"AttackerLists\"] = {" << std::endl;

	for (std::list<std::set<int>* >::const_iterator lit = attackerDefIDSets.begin(); lit != attackerDefIDSets.end(); lit++) {
		for (std::set<int>::const_iterator sit = (*lit)->begin(); sit != (*lit)->end(); sit++) {
			attackerDef = h->unitDefHandler->GetUnitDefByID(*sit);
			attackeeDef = h->unitDefHandler->GetUnitDefByID(1);

			fs << "\t\t\t[\"" << std::string(attackerDef->GetName()) << "\"] = {" << std::endl;
			fs << "\t\t\t\t[1] = {" << std::endl;
			fs << "\t\t\t\t\t[\"Weight\"] = 100," << std::endl;
			fs << "\t\t\t\t\t[\"Items\"] = {" << std::endl;
			fs << "\t\t\t\t\t\t[1] = {" << std::endl;
			fs << "\t\t\t\t\t\t\tattackeeDef = \"" << std::string(attackeeDef->GetName()) << "\"," << std::endl;
			fs << "\t\t\t\t\t\t}," << std::endl;
			fs << "\t\t\t\t\t}," << std::endl;
			fs << "\t\t\t\t}," << std::endl;
			fs << "\t\t\t}," << std::endl;
		}
	}

	fs << "\t\t}," << std::endl;
	fs << "\t}," << std::endl;
	fs << "}" << std::endl;

	fs.close();
}