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


C++ TStrings::size方法代码示例

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


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

示例1: GetReletivePath

std::string TPathUtil::GetReletivePath(const std::string& completePath, const std::string& base)
{
    if (base.empty()) {
        return completePath;
    }
    
    TStrings baseCoponents = TStringUtils::Split(base, "/");
    TStrings pathCoponents = TStringUtils::Split(completePath, "/");
    
    for (size_t i = 0; i < baseCoponents.size(); ++ i) {
        if (i < pathCoponents.size() && !baseCoponents.at(i).empty()) {
            if (baseCoponents.at(i) == pathCoponents.at(i)) {
                pathCoponents[i] = "";
            } else {
                pathCoponents.insert(pathCoponents.begin(), "..");
            }
        }
    }
    
    std::string reletivePath;
    for (size_t i = 0; i < pathCoponents.size(); ++ i) {
        if (pathCoponents.at(i).empty()) {
            continue;
        }
        
        if (!reletivePath.empty()) {
            reletivePath += "/";
        }
        reletivePath += pathCoponents.at(i);
    }
    return reletivePath;
}
开发者ID:wqx081,项目名称:mpr_mq,代码行数:32,代码来源:TPathUtil.cpp

示例2: onCallback


//.........这里部分代码省略.........
			bool res;
			l>>res;
			if(res) return;
		}
#endif
	if(w.mId=="update")
	{
		mPDFwin->pageChanged();
		mPDFwin->redraw();
	}
	else if(w.mId=="Use automatic segmentation")
	{
		if(w.checkButton()->value())
		{
			findLayout("Automatic segmentation")->activate();
			redraw();
		}
		else
		{
			findLayout("Automatic segmentation")->deactivate();
			redraw();
		}
	}
	else if(w.mId=="Option")
	{
		TString fn=FlChooseFile("Choose option", "script","*.lua");
		if(fn.length())
		{
			TString ff, dir;
			ff=sz1::filename(fn, dir);
			find<Fl_Input>("Option_Input")->value(processOption(ff.left(-4)));
			redraw();
		}

	}
	else if(w.mId=="Load a PDF file")
	{
#ifndef NO_SHOW_WIN
		Fl_Native_File_Chooser *chooser = new Fl_Native_File_Chooser();
		chooser->type(Fl_Native_File_Chooser::BROWSE_FILE);   // let user browse a single file
		chooser->title("Open a file");                        // optional title
		//chooser->preset_file("/var/tmp/somefile.txt");        // optional filename preset
		chooser->filter("PDF Files\t*.pdf");                 // optional filter
		TString fn;
		switch ( chooser->show() ) {
			case -1:    // ERROR
			fprintf(stderr, "*** ERROR show() failed:%s\n", chooser->errmsg());
			break;
			case 1:     // CANCEL
			fprintf(stderr, "*** CANCEL\n");
			break;
			default:    // USER PICKED A FILE
			fn=chooser->filename();
			break;
		}
		//TString fn=fl_file_chooser("Choose a PDF file", "*.pdf", NULL);
		if(fn.length())
		{
			mPDFwin->load(fn);

		}
#endif
	}
	else if(w.mId=="Batch process")
	{
#ifndef NO_SHOW_WIN
		Fl_Native_File_Chooser *chooser = new Fl_Native_File_Chooser();
		chooser->type(Fl_Native_File_Chooser::BROWSE_MULTI_FILE);   // let user browse a single file
		chooser->title("Open files");                        // optional title
		//chooser->preset_file("/var/tmp/somefile.txt");        // optional filename preset
		chooser->filter("PDF Files\t*.pdf");                 // optional filter
		TStrings fn;
		switch ( chooser->show() ) {
			case -1:    // ERROR
			fprintf(stderr, "*** ERROR show() failed:%s\n", chooser->errmsg());
			break;
			case 1:     // CANCEL
			fprintf(stderr, "*** CANCEL\n");
			break;
			default:    // USER PICKED A FILE
				{
					fn.resize(chooser->count());
					for (int n = 0; n < chooser->count(); n++ ) 
      				fn[n]=chooser->filename(n);
				}
			break;
		}
		//TString fn=fl_file_chooser("Choose a PDF file", "*.pdf", NULL);
		if(fn.size())
		{

			for(int i=0; i<fn.size(); i++)
			{
				mPDFwin->load(fn[i]);
				onCallback(findWidget("Process all pages"), w.widgetRaw(), 0);
			}
		}
#endif
	}
}
开发者ID:VitorRetamal,项目名称:papercrop,代码行数:101,代码来源:RightPanel.cpp


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