当前位置: 首页>>代码示例>>C++>>正文


C++ StringArray类代码示例

本文整理汇总了C++中StringArray的典型用法代码示例。如果您正苦于以下问题:C++ StringArray类的具体用法?C++ StringArray怎么用?C++ StringArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了StringArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: path

void PluginListComponent::scanFor (AudioPluginFormat* format)
{
    if (format == 0)
        return;

    FileSearchPath path (format->getDefaultLocationsToSearch());

    if (propertiesToUse != 0)
        path = propertiesToUse->getValue ("lastPluginScanPath_" + format->getName(), path.toString());

    {
        AlertWindow aw (TRANS("Select folders to scan..."), String::empty, AlertWindow::NoIcon);
        FileSearchPathListComponent pathList;
        pathList.setSize (500, 300);
        pathList.setPath (path);

        aw.addCustomComponent (&pathList);
        aw.addButton (TRANS("Scan"), 1, KeyPress::returnKey);
        aw.addButton (TRANS("Cancel"), 0, KeyPress::escapeKey);

        if (aw.runModalLoop() == 0)
            return;

        path = pathList.getPath();
    }

    if (propertiesToUse != 0)
    {
        propertiesToUse->setValue ("lastPluginScanPath_" + format->getName(), path.toString());
        propertiesToUse->saveIfNeeded();
    }

    double progress = 0.0;

    AlertWindow aw (TRANS("Scanning for plugins..."),
                    TRANS("Searching for all possible plugin files..."), AlertWindow::NoIcon);

    aw.addButton (TRANS("Cancel"), 0, KeyPress::escapeKey);
    aw.addProgressBarComponent (progress);

    aw.enterModalState();

    MessageManager::getInstance()->runDispatchLoopUntil (300);

    PluginDirectoryScanner scanner (list, *format, path, true, deadMansPedalFile);

    for (;;)
    {
        aw.setMessage (TRANS("Testing:\n\n")
                         + scanner.getNextPluginFileThatWillBeScanned());

        MessageManager::getInstance()->runDispatchLoopUntil (20);

        if (! scanner.scanNextFile (true))
            break;

        if (! aw.isCurrentlyModal())
            break;

        progress = scanner.getProgress();
    }

    if (scanner.getFailedFiles().size() > 0)
    {
        StringArray shortNames;

        for (int i = 0; i < scanner.getFailedFiles().size(); ++i)
            shortNames.add (File (scanner.getFailedFiles()[i]).getFileName());

        AlertWindow::showMessageBox (AlertWindow::InfoIcon,
                                     TRANS("Scan complete"),
                                     TRANS("Note that the following files appeared to be plugin files, but failed to load correctly:\n\n")
                                        + shortNames.joinIntoString (", "));
    }
}
开发者ID:Labmind,项目名称:GUI,代码行数:75,代码来源:juce_PluginListComponent.cpp

示例2: fromTokens

StringArray StringArray::fromTokens (StringRef stringToTokenise, bool preserveQuotedStrings)
{
    StringArray s;
    s.addTokens (stringToTokenise, preserveQuotedStrings);
    return s;
}
开发者ID:Robert-yeh,项目名称:Kiwano,代码行数:6,代码来源:juce_StringArray.cpp

示例3: get_string_components

StringArray DdParser::get_string_components(const std::string &line)
{
    StringArray result;

    size_t progress = 0;
    std::string remaining = line;
    size_t comment = remaining.find("#",0);
    remaining = remaining.substr(0, comment);

    while(remaining.size() > 0)
    {
        progress += clear_front_back_whitespace(remaining);

        if(remaining.size() > 0)
        {
            size_t count=0;
            
            if(remaining.at(0) == '\"')
            {
                ++count;
                while(remaining.at(count) != '\"')
                {
                    ++count;
                    
                    if(count >= remaining.size())
                    {
                        error() << "Unclosed quotes starting at character #" << progress-1;
                        report_error();
                        result.clear();
                        return result;
                    }
                }
                
                if(count+1 < remaining.size())
                {
                    if(!isspace(remaining.at(count+1)))
                    {
                        error() << "Found illegal quotes at character #" << progress+count+1;
                        report_error();
                        result.clear();
                        return result;
                    }
                }
                
                progress += count+1;
                std::string component = remaining.substr(1, count-1);
                remaining = remaining.substr(count+1, std::string::npos);
                result.push_back(component);
            }
            else
            {
                while(!isspace(remaining.at(count)))
                {
                    if(remaining.at(count) == '\"')
                    {
                        error() << "Found illegal quotes at character #" << progress+count+1;
                        report_error();
                        result.clear();
                        return result;
                    }
                    
                    ++count;
                    if(count >= remaining.size())
                        break;
                }
                
                progress += count;
                std::string component = remaining.substr(0, count);
                remaining = remaining.substr(count, std::string::npos);
                result.push_back(component);
            }
        }
    }

    return result;
}
开发者ID:RyanYoung25,项目名称:HuboCan,代码行数:76,代码来源:DdParser.cpp

示例4: while

void Utils::uniquifyPaths(HashMap<String,String>& paths)
{
    // Get all file paths that have the same filename (i.e. /foo/bar.mdl and /bar.mdl)
    SortedSet<String> fileSet;
    for (HashMap<String, String>::Iterator i (paths); i.next();)
    {
        for (HashMap<String, String>::Iterator j(paths); j.next();)
        {
            if(i.getKey() != j.getKey())
            {
                File fi = i.getKey();
                File fj = j.getKey();
                if(fi.getFileName().compare(fj.getFileName()) == 0)
                {
                    fileSet.add(fj.getFullPathName());
                }
            }
        }
    }

    //if there are no same filenames just return
    if(fileSet.size() == 0)
        return;

    // Split paths to an Array
    HashMap<String, StringArray> sameFiles;
    for (int i = 0; i < fileSet.size(); ++i)
    {
        StringArray arr;
        arr.addTokens(fileSet[i], File::separatorString, "\"");
        sameFiles.set(fileSet[i], arr);
    }

    // Create unique paths by adding a parent directory to the files until
    // the path is unique
    bool uniquePaths = false;
    int lvl = 0;
    HashMap<String, String> sameFiles2;
    while(! uniquePaths)
    {
        SortedSet<String> tmpSet;
        ++lvl;
        for (HashMap<String, StringArray>::Iterator k(sameFiles); k.next();)
        {
            StringArray arr = k.getValue();
            int arrSize = arr.size();
            String tmpPath2;
            if(arrSize - lvl > 0)
            {
                StringArray tmpPath;
                for (int l = lvl; --l >= 0;)
                {
                    tmpPath.add(arr[arrSize - 1 - l]);
                }
                tmpPath2 = tmpPath.joinIntoString(File::separatorString);
            }
            else
            {
                tmpPath2 = k.getValue().joinIntoString(File::separatorString);
            }
            tmpSet.add(tmpPath2);
            sameFiles2.set(k.getKey(), tmpPath2);
        }
        if(tmpSet.size() == fileSet.size())
        {
            uniquePaths = true;
        }
    }
    for (HashMap<String, String>::Iterator it(sameFiles2); it.next();)
    {
        paths.set(it.getKey(), it.getValue());
    }
}
开发者ID:alessandrostone,项目名称:SaM-Designer,代码行数:73,代码来源:MiscUtilities.cpp

示例5: validateLines

void AccountNumbersConverter::validateLines(StringArray const lines) {
    if (lines.size() == 0) {
        throw invalid_argument("The file is empty!");
    }
}
开发者ID:gregmalcolm,项目名称:KataBankOCR,代码行数:5,代码来源:AccountNumbersConverter.cpp

示例6: _jobject_to_variant


//.........这里部分代码省略.........
		env->GetByteArrayRegion(arr,0,fCount,reinterpret_cast<signed char*>(w.ptr()));
		w = DVector<uint8_t>::Write();
		return sarr;
	};

	if (name == "java.lang.Float" || name == "java.lang.Double") {

		jclass nclass = env->FindClass("java/lang/Number");
		jmethodID doubleValue = env->GetMethodID(nclass, "doubleValue", "()D");
		double ret = env->CallDoubleMethod(obj, doubleValue);
		return ret;
	};

	if (name == "[D") {

		jdoubleArray arr = (jdoubleArray)obj;
		int fCount = env->GetArrayLength(arr);
		RealArray sarr;
		sarr.resize(fCount);

		RealArray::Write w = sarr.write();

		for (int i=0; i<fCount; i++) {

			double n;
			env->GetDoubleArrayRegion(arr, i, 1, &n);
			w.ptr()[i] = n;

		};
		return sarr;
	};

	if (name == "[F") {

		jfloatArray arr = (jfloatArray)obj;
		int fCount = env->GetArrayLength(arr);
		RealArray sarr;
		sarr.resize(fCount);


		RealArray::Write w = sarr.write();

		for (int i=0; i<fCount; i++) {

			float n;
			env->GetFloatArrayRegion(arr, i, 1, &n);
			w.ptr()[i] = n;

		};
		return sarr;
	};


	if (name == "[Ljava.lang.Object;") {

		jobjectArray arr = (jobjectArray)obj;
		int objCount = env->GetArrayLength(arr);
		Array varr(true);

		for (int i=0; i<objCount; i++) {
			jobject jobj = env->GetObjectArrayElement(arr, i);
			Variant v = _jobject_to_variant(env, jobj);
			varr.push_back(v);
			env->DeleteLocalRef(jobj);

		}

		return varr;
	};

    if (name == "java.util.HashMap" || name == "com.android.godot.Dictionary") {

		Dictionary ret(true);
		jclass oclass = c;
		jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;");
		jobjectArray arr = (jobjectArray)env->CallObjectMethod(obj, get_keys);

		StringArray keys = _jobject_to_variant(env, arr);
		env->DeleteLocalRef(arr);

		jmethodID get_values = env->GetMethodID(oclass, "get_values", "()[Ljava/lang/Object;");
		arr = (jobjectArray)env->CallObjectMethod(obj, get_values);

		Array vals = _jobject_to_variant(env, arr);
		env->DeleteLocalRef(arr);

		//print_line("adding " + String::num(keys.size()) + " to Dictionary!");
		for (int i=0; i<keys.size(); i++) {

			ret[keys[i]] = vals[i];
		};


		return ret;
	};

	env->DeleteLocalRef(c);

	return Variant();
};
开发者ID:AkshayaRaj,项目名称:godot,代码行数:101,代码来源:java_glue.cpp

示例7: getCommaOrWhitespaceSeparatedItems

StringArray getCommaOrWhitespaceSeparatedItems (const String& sourceString)
{
    StringArray s;
    s.addTokens (sourceString, ", \t\r\n", StringRef());
    return getCleanedStringArray (s);
}
开发者ID:ChrisJRoss,项目名称:JUCE,代码行数:6,代码来源:jucer_MiscUtilities.cpp

示例8: logReport

void UnitTests::logReport (StringArray const& report)
{
    for (int i = 0; i < report.size (); ++i)
        logMessage (report [i]);
}
开发者ID:Blizzard-,项目名称:rippled,代码行数:5,代码来源:UnitTest.cpp

示例9: DFW_RETVAL_D

  sp<Retval> MonDiskstats::loadData(sp<MonBase>& out, String& sLine)
  {
      sp<Retval> retval;

      StringArray ar;
      if( DFW_RET(retval, ar.split(sLine, "|")) )
          return DFW_RETVAL_D(retval);
      if( !(ar.size() > 1) )
          return DFW_RETVAL_NEW_MSG(DFW_ERROR, 0
                     , "Unknown format. ground-size=%d", ar.size());

      sp<String> ar1 = ar.getString(0);
      uint64_t d_sec = Long::parseLong(ar1->toChars());
      sp<MonDiskstats> dest = create(d_sec);

      // get datas
      String s_type, s_devtype, s_name;
      String s_rcount, s_rmerged, s_rsector, s_rtime;
      String s_wcount, s_wmerged, s_wsector, s_wtime;
      String s_iocount, s_iotime, s_iowtime;

      for(int k=1; k<ar.size(); k++){
          sp<String> arx = ar.getString(k);

          int round = 0;
          const char* v = NULL;
          const char* p = arx->toChars();
          do{
              if( *p == ' ' || *p == '\t' || *p == '|' || *p=='\0'){
                  if( v ){
                      switch(round){
                      case 0: s_type.set(v, p-v); break;
                      case 1: s_devtype.set(v, p-v); break;
                      case 2: s_name.set(v, p-v); break;
                      case 3: s_rcount.set(v, p-v); break;
                      case 4: s_rmerged.set(v, p-v); break;
                      case 5: s_rsector.set(v, p-v); break;
                      case 6: s_rtime.set(v, p-v); break;
                      case 7: s_wcount.set(v, p-v); break;
                      case 8: s_wmerged.set(v, p-v); break;
                      case 9: s_wsector.set(v, p-v); break;
                      case 10: s_wtime.set(v, p-v); break;
                      case 11: s_iocount.set(v, p-v); break;
                      case 12: s_iotime.set(v, p-v); break;
                      case 13: s_iowtime.set(v, p-v); break;
                      }
                      v= NULL;
                      round++;
                  }
                  if( *p=='\0' ) break;
              }else if(!v){
                  v = p;
              }
              p++;
          }while(true);
          if( round != 14 ){
              return DFW_RETVAL_NEW_MSG(DFW_ERROR, 0
                         , "Unknown format %s", sLine.toChars());
          }

          sp<Data> d = new Data();
          d->m_type    = Integer::parseInt(s_type);
          d->m_devtype = Integer::parseInt(s_devtype);
          d->m_sName = s_name;

          d->m_rcount = Long::parseLong(s_rcount);
          d->m_rmerged = Long::parseLong(s_rmerged);
          d->m_rsector = Long::parseLong(s_rsector);
          d->m_rtime = Long::parseLong(s_rtime);
          d->m_wcount = Long::parseLong(s_wcount);
          d->m_wmerged = Long::parseLong(s_wmerged);
          d->m_wsector = Long::parseLong(s_wsector);
          d->m_wtime = Long::parseLong(s_wtime);

          d->m_iocount = Long::parseLong(s_iocount);
          d->m_iotime = Long::parseLong(s_iotime);
          d->m_iowtime = Long::parseLong(s_iowtime);

          if( d->m_devtype == 0 ) {
              dest->m_all->m_rcount  += d->m_rcount;
              dest->m_all->m_rmerged += d->m_rmerged;
              dest->m_all->m_rsector += d->m_rsector;
              dest->m_all->m_rtime   += d->m_rtime;
              dest->m_all->m_wcount  += d->m_wcount;
              dest->m_all->m_wmerged += d->m_wmerged;
              dest->m_all->m_wsector += d->m_wsector;
              dest->m_all->m_wtime   += d->m_wtime;
              dest->m_all->m_iocount += d->m_iocount;
              dest->m_all->m_iotime  += d->m_iotime;
              dest->m_all->m_iowtime += d->m_iowtime;
          }

          if( DFW_RET(retval, dest->m_aLists.insert(d)) )
              return DFW_RETVAL_D(retval);
      }

      out = dest;
      return NULL;
  }
开发者ID:dframework,项目名称:cpp-common,代码行数:99,代码来源:MonDiskstats.cpp

示例10: getSearchPathsFromString

StringArray getSearchPathsFromString (const String& searchPath)
{
    StringArray s;
    s.addTokens (searchPath, ";\r\n", StringRef());
    return getCleanedStringArray (s);
}
开发者ID:ChrisJRoss,项目名称:JUCE,代码行数:6,代码来源:jucer_MiscUtilities.cpp

示例11: toFront

void ChildAlias::mouseDown (const MouseEvent& e)
{
 
//if (e.mods.isLeftButtonDown()){
((CabbageMainPanel*)(getTarget()->getParentComponent()))->setMouseState("down");
   toFront (true);
   if (e.eventComponent == resizer)
   {
   }
   else
   {
      //added a constrainer so that components can't be dragged off-screen
      constrainer->setMinimumOnscreenAmounts(getHeight(), getWidth(), getHeight(), getWidth());
      dragger.startDraggingComponent (this,e);
   }
   userAdjusting = true;
   startBounds = getBounds ();
   userStartedChangingBounds ();

   //get the bounds of each of the child components if we are dealing with a plant
   Component* c = (Component*) target.getComponent ();
   origBounds.clear();
   for(int i=0;i<c->getNumChildComponents();i++){
   origBounds.add(c->getChildComponent(i)->getBounds());
   }


   //update dimensions
   int offX = getProperties().getWithDefault(var::identifier("plantX"), 0);
   int offY = getProperties().getWithDefault(var::identifier("plantY"), 0);

   ((CabbageMainPanel*)(getTarget()->getParentComponent()))->setIndex(index);
   ((CabbageMainPanel*)(getTarget()->getParentComponent()))->currentBounds.setBounds(getPosition().getX()-offX,
																					 getPosition().getY()-offY,
																					 getWidth(),
																					 getHeight());

   ((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:Down");

#ifdef Cabbage_Build_Standalone
	if(e.mods.isRightButtonDown()){
		PopupMenu m;
		m.setLookAndFeel(&getParentComponent()->getLookAndFeel());
		m.addItem(2, "Delete");
		m.addItem(1, "Add to repository");
		int choice = m.show();
		if(choice==1){
			this->getTopLevelComponent()->setAlwaysOnTop(false);
			AlertWindow alert("Add to Repository", "Enter a name and hit 'escape'", AlertWindow::NoIcon, this->getTopLevelComponent()); 
			CabbageLookAndFeel basicLookAndFeel;
			alert.setLookAndFeel(&basicLookAndFeel);
			alert.setColour(TextEditor::textColourId, Colours::white);
			//alert.addTextBlock("Enter a name and hit 'escape'(The following symbols not premitted in names:"" $ % ^ & * ( ) - + )");
			alert.addTextEditor("textEditor", "name", "");
			alert.runModalLoop();
			this->getTopLevelComponent()->setAlwaysOnTop(true);
				bool clashingNames=false;
				int result; 
				
				String plantDir = appProperties->getUserSettings()->getValue("PlantFileDir", "");	
				Logger::writeToLog(plantDir);
				Array<File> tempfiles;
				StringArray plants;   
				addFileToPpopupMenu(m, tempfiles, plantDir, "*.plant");
				
				for(int i=0;i<tempfiles.size();i++){
				Logger::outputDebugString(tempfiles[i].getFullPathName());
				plants.add(tempfiles[i].getFileNameWithoutExtension());
				}
				
				for(int i=0;i<plants.size();i++)				
				if(plants[i]==alert.getTextEditorContents("textEditor"))
					clashingNames = true;

				if(clashingNames==true){
					result = CabbageUtils::showYesNoMessage("Do you wish to overwrite the existing plant?", &getLookAndFeel());	
					if(result == 0)
					((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:AddingPlant:"+alert.getTextEditorContents("textEditor"));
					else
						showMessage("Nothing written to repository", &getLookAndFeel());
				}
				else ((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:AddingPlant:"+alert.getTextEditorContents("textEditor"));

		}
		else if(choice==2){
			((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:delete:");
			}
		
		}
#endif

}
开发者ID:ngeiswei,项目名称:cabbage,代码行数:92,代码来源:ComponentLayoutEditor.cpp

示例12: filesDropped

 void filesDropped (const StringArray& files, int, int)
 {
     setText (getText() + files.joinIntoString (isMultiline ? "\n" : ", "), true);
     showEditor();
 }
开发者ID:0x4d52,项目名称:ugen,代码行数:5,代码来源:juce_TextPropertyComponent.cpp

示例13: previousWorkingDirectory

void FileChooser::showPlatformDialog (Array<File>& results,
                                      const String& title,
                                      const File& file,
                                      const String& filters,
                                      bool isDirectory,
                                      bool /* selectsFiles */,
                                      bool isSave,
                                      bool /* warnAboutOverwritingExistingFiles */,
                                      bool selectMultipleFiles,
                                      FilePreviewComponent* /* previewComponent */)
{
    String separator;
    StringArray args;

    const File previousWorkingDirectory (File::getCurrentWorkingDirectory());
    const bool isKdeFullSession = SystemStats::getEnvironmentVariable ("KDE_FULL_SESSION", String::empty)
                                    .equalsIgnoreCase ("true");

    if (exeIsAvailable ("kdialog") && (isKdeFullSession || ! exeIsAvailable ("zenity")))
    {
        // use kdialog for KDE sessions or if zenity is missing
        args.add ("kdialog");

        if (title.isNotEmpty())
            args.add ("--title=" + title);

        if (selectMultipleFiles)
        {
            separator = "\n";
            args.add ("--multiple");
            args.add ("--separate-output");
            args.add ("--getopenfilename");
        }
        else
        {
            if (isSave)             args.add ("--getsavefilename");
            else if (isDirectory)   args.add ("--getexistingdirectory");
            else                    args.add ("--getopenfilename");
        }

        String startPath;

        if (file.exists())
        {
            startPath = file.getFullPathName();
        }
        else if (file.getParentDirectory().exists())
        {
            startPath = file.getParentDirectory().getFullPathName();
        }
        else
        {
            startPath = File::getSpecialLocation (File::userHomeDirectory).getFullPathName();

            if (isSave)
                startPath += "/" + file.getFileName();
        }

        args.add (startPath);
        args.add (filters.replaceCharacter (';', ' '));
        args.add ("2>/dev/null");
    }
    else
    {
        // zenity
        args.add ("zenity");
        args.add ("--file-selection");

        if (title.isNotEmpty())
            args.add ("--title=" + title);

        if (selectMultipleFiles)
        {
            separator = ":";
            args.add ("--multiple");
            args.add ("--separator=" + separator);
        }
        else
        {
            if (isDirectory)  args.add ("--directory");
            if (isSave)       args.add ("--save");
        }

        if (file.isDirectory())
            file.setAsCurrentWorkingDirectory();
        else if (file.getParentDirectory().exists())
            file.getParentDirectory().setAsCurrentWorkingDirectory();
        else
            File::getSpecialLocation (File::userHomeDirectory).setAsCurrentWorkingDirectory();

        if (! file.getFileName().isEmpty())
            args.add ("--filename=" + file.getFileName());
    }

    ChildProcess child;

    if (child.start (args, ChildProcess::wantStdOut))
    {
        const String result (child.readAllProcessOutput().trim());

//.........这里部分代码省略.........
开发者ID:Merigusapo,项目名称:JUCE,代码行数:101,代码来源:juce_linux_FileChooser.cpp

示例14: main

int main(int argc, const char *argv[])
{
    InitModuleObjects();

    int ret = 0;
    bool dryRun = false;
    bool offline = false;
    StringAttr daliServer, envPath;

    enum CmdType { cmd_none, cmd_swap, cmd_auto, cmd_history, cmd_email, cmd_swapped, cmd_reset, cmd_resetspares, cmd_addspares, cmd_removespares, cmd_resethistory };
    CmdType cmd = cmd_none;

    ArgvIterator iter(argc, argv);

    try
    {
        bool stop=false;
        StringArray params;
        for (; !ret&&!iter.done(); iter.next())
        {
            const char *arg = iter.query();
            if ('-' == *arg)
            {
                bool value;
                if (iter.matchFlag(value, "-dryrun"))
                    dryRun = value;
                else if (iter.matchFlag(value, "-offline"))
                    offline = value;
                else
                {
                    PROGLOG("Unknown option");
                    ret = 2;
                    usage();
                    break;
                }
            }
            else
            {
                switch (cmd)
                {
                    case cmd_none:
                        if (strieq("swap", arg))
                            cmd = cmd_swap;
                        else if (strieq("auto", arg))
                            cmd = cmd_auto;
                        else if (strieq("history", arg))
                            cmd = cmd_history;
                        else if (strieq("email", arg))
                            cmd = cmd_email;
                        else if (strieq("swapped", arg))
                            cmd = cmd_swapped;
                        else if (strieq("reset", arg))
                            cmd = cmd_reset;
                        else if (strieq("resetspares", arg))
                            cmd = cmd_resetspares;
                        else if (strieq("addspares", arg))
                            cmd = cmd_addspares;
                        else if (strieq("removespares", arg))
                            cmd = cmd_removespares;
                        else if (strieq("resethistory", arg))
                            cmd = cmd_resethistory;
                        else
                        {
                            PROGLOG("Unknown command");
                            usage();
                            ret = 2;
                        }
                        break;
                    default:
                        params.append(iter.query());
                        break;
                }
            }
        }
        unsigned requiredParams=UINT_MAX;
        switch (cmd)
        {
            case cmd_swap:
                requiredParams = 4;
                break;
            case cmd_addspares:
            case cmd_removespares:
                requiredParams = 3;
                break;
            case cmd_auto:
            case cmd_history:
            case cmd_email:
            case cmd_swapped:
            case cmd_reset:
            case cmd_resetspares:
            case cmd_resethistory:
                requiredParams = 2;
                break;
        }
        if (params.ordinality() < requiredParams)
        {
            usage();
            ret = 2;
        }
        else
//.........这里部分代码省略.........
开发者ID:afishbeck,项目名称:HPCC-Platform,代码行数:101,代码来源:swapnode.cpp

示例15: LoadData

//------------------------------------------------------------------------------
// virtual void LoadData()
//------------------------------------------------------------------------------
void GroundTrackPlotPanel::LoadData()
{
   #if DEBUG_PANEL_LOAD
   MessageInterface::ShowMessage("GroundTrackPlotPanel::LoadData() entered.\n");
   #endif
   
   try
   {
      // Load data from the core engine
      wxString str;
      Real rval;
      
      // Load central body
      wxString centralBody = mGroundTrackPlot->GetStringParameter("CentralBody").c_str();
      mCentralBody = centralBody;
      
      #ifdef DEBUG_PANEL_LOAD
      MessageInterface::ShowMessage("   centralBody = '%s'\n", centralBody.c_str());
      #endif
      mCentralBodyComboBox->SetValue(centralBody);
      
      // Load space objects to draw
      StringArray objects = mGroundTrackPlot->GetStringArrayParameter("Add");
      int count = mObjectCheckListBox->GetCount();
      
      #ifdef DEBUG_PANEL_LOAD
      MessageInterface::ShowMessage("   There are %d items in ObjectCheckListBox\n", count);
      for (int i = 0; i < count; i++)
         MessageInterface::ShowMessage("      %d = '%s'\n", i, mObjectCheckListBox->GetString(i).c_str());
      MessageInterface::ShowMessage("   There are %d objects to draw\n", objects.size());
      for (unsigned int i = 0; i < objects.size(); i++)
         MessageInterface::ShowMessage("      %d = '%s'\n", i, objects[i].c_str());
      #endif

      
      std::string objName;
      // Load object drawing option and colors
      for (UnsignedInt i = 0; i < objects.size(); i++)
      {
         objName = objects[i];
         
         #ifdef __USE_COLOR_FROM_SUBSCRIBER__
         mOrbitColorMap[objName] = RgbColor(mGroundTrackPlot->GetColor("Orbit", objName));
         mTargetColorMap[objName] = RgbColor(mGroundTrackPlot->GetColor("Target", objName));
         #endif
         
         // Put check mark in the object list
         for (int j = 0; j < count; j++)
         {
            std::string itemName = mObjectCheckListBox->GetString(j).WX_TO_STD_STRING;
            if (itemName == objName)
            {
               mObjectCheckListBox->Check(j, true);
               break;
            }
         }
      }
      
      
      // Load drawing options
      str.Printf("%d", mGroundTrackPlot->GetIntegerParameter("DataCollectFrequency"));
      mDataCollectFreqTextCtrl->SetValue(str);
      str.Printf("%d", mGroundTrackPlot->GetIntegerParameter("UpdatePlotFrequency"));
      mUpdatePlotFreqTextCtrl->SetValue(str);
      str.Printf("%d", mGroundTrackPlot->GetIntegerParameter("NumPointsToRedraw"));
      mNumPointsToRedrawTextCtrl->SetValue(str);
      
      mShowPlotCheckBox->SetValue(mGroundTrackPlot->GetBooleanParameter("ShowPlot"));
      
      // Load solver iteration and texture map file
      mSolverIterComboBox->SetValue(mGroundTrackPlot->GetStringParameter("SolverIterations").c_str());
      mTextureFile = mGroundTrackPlot->GetStringParameter("TextureMap").c_str();
      mTextureMapTextCtrl->SetValue(mTextureFile);
      mTextureMapTextCtrl->SetInsertionPointEnd();
      
      // Select first object in the list to show color
      if (objects.size() > 0)
      {
         mObjectCheckListBox->SetSelection(0);
         #ifdef __USE_COLOR_FROM_SUBSCRIBER__
         ShowSpacePointColor(mObjectCheckListBox->GetStringSelection());
         #endif
      }
   }
   catch (BaseException &e)
   {
      MessageInterface::PopupMessage(Gmat::ERROR_, e.GetFullMessage().c_str());
   }
   
   EnableUpdate(false);
   
   #if DEBUG_PANEL_LOAD
   MessageInterface::ShowMessage("GroundTrackPlotPanel::LoadData() exiting.\n");
   #endif
}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:98,代码来源:GroundTrackPlotPanel.cpp


注:本文中的StringArray类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。