• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: IwGxSetViewMatrix

//-----------------------------------------------------------------------------
bool HexMapTest::Update()
{
	int16 sprite1_pos_x,sprite1_pos_y;
	int16 sprite2_pos_x,sprite2_pos_y;
	if (mouse_mode == MOUSE_MODE_CHECKING)
		mouse_mode  = MOUSE_MODE_DOWN;

	// UI processing
	if (((s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_PRESSED)) && mouse_mode == MOUSE_MODE_IDLE)
		mouse_mode = MOUSE_MODE_IDLE;
	if ((s3ePointerGetState(S3E_POINTER_BUTTON_SELECT) & S3E_POINTER_STATE_RELEASED))
		mouse_mode = MOUSE_MODE_CHECKING;

//	UpdateKey();

	IwGxSetViewMatrix(&s_viewMatrix);

    // Generate a ray pointing to the view plane from the camera
    CIwVec3 dir(s3ePointerGetX() - IwGxGetScreenWidth()/2, 
        s3ePointerGetY() - IwGxGetScreenHeight()/2, 
        IwGxGetPerspMul());
    
    // Rotate into camera space
    dir = s_viewMatrix.RotateVec(dir);

	// Update pointer system
	g_Input.Update();
	if (g_Input.finger1IsDown()) {
		if (g_Input.overThreshold()) {
			if (!g_Input.finger1Continuing()) {
				s_ModelMatrix_initial = s_ModelMatrix;
				CIwVec3 vectCenter = getWorldCoords(0, 0);
				zoom_initial = zoom;
				rotation_initial = rotation;
				screenTranslationX_initial = screenTranslationX;
				screenTranslationY_initial = screenTranslationY;
				if (!g_Input.isMultiTouch()) {
					if (g_Input.finger1MovedTo(sprite1_pos_x, sprite1_pos_y)) {
						if (sprite1_pos_x > int(IwGxGetScreenWidth()) - SCREEN_MARGIN) {
							zooming = true;
						}
						if (sprite1_pos_y > int(IwGxGetScreenHeight()) - SCREEN_MARGIN) {
							rotating = true;
						}
					}
				}
			}
			if (!g_Input.finger2IsDown() && g_Input.finger1MovedTo(sprite1_pos_x, sprite1_pos_y)) {
				if (g_Input.finger1Continuing()) {
					if (zooming) {
						if (sprite1_pos_x > int(IwGxGetScreenWidth()) - SCREEN_MARGIN) {
							int16 dsprite1_pos_x, dsprite1_pos_y;
							if (g_Input.finger1MovementDelta(dsprite1_pos_x, dsprite1_pos_y)) {
								float deltaZoom = 1.0f - 1.0f*(dsprite1_pos_y)/IwGxGetScreenHeight();
								SetZoom(deltaZoom, 8);
							}
						}
					} else if (rotating) {
						if (sprite1_pos_y > int(IwGxGetScreenHeight()) - SCREEN_MARGIN) {
							int16 dsprite1_pos_x, dsprite1_pos_y;
							if (g_Input.finger1MovementDelta(dsprite1_pos_x, dsprite1_pos_y)) {
								float deltaRotation = 360.0f*(dsprite1_pos_x)/IwGxGetScreenWidth();
								SetRotation(deltaRotation);
							}
						}
					} else {
						SetTranslation();
					}
				}
			} else {
				if (g_Input.finger1MovedTo(sprite1_pos_x, sprite1_pos_y)) {
					if (g_Input.finger2MovedTo(sprite2_pos_x, sprite2_pos_y)) {
						if (!g_Input.finger2Continuing()) {
							screenTranslationX_initial = screenTranslationX;
							screenTranslationY_initial = screenTranslationY;
							g_Input.resetInitial(0);
						} else {
							int16 sprite1_pos_x_initial,sprite1_pos_y_initial,sprite2_pos_x_initial,sprite2_pos_y_initial;
							g_Input.finger1Initial(sprite1_pos_x_initial,sprite1_pos_y_initial);
							g_Input.finger2Initial(sprite2_pos_x_initial,sprite2_pos_y_initial);
							int d12x=sprite1_pos_x-sprite2_pos_x;
							int d12y=sprite1_pos_y-sprite2_pos_y;
							int d12x_initial=sprite1_pos_x_initial-sprite2_pos_x_initial;
							int d12y_initial=sprite1_pos_y_initial-sprite2_pos_y_initial;
							int Delta_initial = d12x_initial*d12x_initial+d12y_initial*d12y_initial;
							int Delta = d12x*d12x+d12y*d12y;
							float newZoom = float(sqrt(1.0*Delta)/sqrt(Delta_initial));
							SetZoom(newZoom, 1);
							float oldRotation = float(atan2(float(d12y_initial), float(d12x_initial)));
							float newRotation = float(atan2(float(d12y), float(d12x)));
							SetRotation(180.0f*(oldRotation-newRotation)/PI);
							{
								char string[256];
								//sprintf(string, "`1`a  del %04d, %04d",d1x,d2x);
								//IwGxPrintString(2, 96, string);
								sprintf(string, "`1`a  zoo %5.2f, %5.2f, %5.2f",newZoom,oldRotation,newRotation);
								IwGxPrintString(2, 96, string);
							}
						}
//.........这里部分代码省略.........
开发者ID:ralphtrickey,项目名称:Hex-Map,代码行数:101,代码来源:HexMapTest.cpp


示例2: main

void main()
{
   char x[512];
   char buffer[512];
   int size;

   while(1)
   {
      interrupt(33,0,"cxxxx][===blackdos===> \0",0,0);

      /* Takes command line input */
      SCANS(x);
      PRINTS("\r\n\0");

      if(strcmp(x,"boot\0") == 1)
      {
         BOOT;
      }
      else if(strcmp(x,"cls\0") == 1)
      {
         clr();
      }
      else if(strcmp(x,"help\0") == 1)
      {
         help();
      }
      else if(strcmp(x,"echo\0") == 1)
      {
         echo(x+5);
      }
      else if(strcmp(x,"type\0") == 1)
      {
         loadF(x+5,buffer,size);
      }
      else if(strcmp(x,"run\0") == 1)
      {
         runF(x+4);
      }
      else if(strcmp(x,"del\0") == 1)
      {
         delF(x+4);
      }
      else if(strcmp(x,"dir\0") == 1)
      {
         dir();
      }
      else if(strcmp(x,"tweet\0") == 1)
      {
         tweet(x+6);
      }
      else if(strcmp(x,"cp\0") == 1)
      {
         copy(x+3);
      }
      else
      {
         interrupt(33,0,"\r\nBad command or filename\r\n\0",0,0);
      }
      interrupt(33,0,"\r\n\0",0,0);
   }
   END;
}
开发者ID:Ryan345,项目名称:OperatingSystem,代码行数:62,代码来源:Shell.c


示例3: LOG

void RSSEditPopup::slotSave(QNetworkReply* reply)
{
    QDomDocument document;
    document.setContent(reply->read(reply->bytesAvailable()), true);

    QString text = document.toString();

    QString title = m_titleEdit->GetText();
    QString description = m_descEdit->GetText();
    QString author = m_authorEdit->GetText();
    QString file = m_thumbImage->GetFilename();

    LOG(VB_GENERAL, LOG_DEBUG, QString("Text to Parse: %1").arg(text));

    QDomElement root = document.documentElement();
    QDomElement channel = root.firstChildElement ("channel");
    if (!channel.isNull ())
    {
        Parse parser;
        if (title.isEmpty())
            title = channel.firstChildElement("title").text().trimmed();
        if (description.isEmpty())
            description = channel.firstChildElement("description").text();
        if (author.isEmpty())
            author = parser.GetAuthor(channel);
        if (author.isEmpty())
            author = channel.firstChildElement("managingEditor").text();
        if (author.isEmpty())
            author = channel.firstChildElement("webMaster").text();

        QString thumbnailURL = channel.firstChildElement("image").attribute("url");
        if (thumbnailURL.isEmpty())
        {
            QDomElement thumbElem = channel.firstChildElement("image");
            if (!thumbElem.isNull())
                thumbnailURL = thumbElem.firstChildElement("url").text();
        }
        if (thumbnailURL.isEmpty())
        {
            QDomNodeList nodes = channel.elementsByTagNameNS(
                           "http://www.itunes.com/dtds/podcast-1.0.dtd", "image");
            if (nodes.size())
            {
                thumbnailURL = nodes.at(0).toElement().attributeNode("href").value();
                if (thumbnailURL.isEmpty())
                    thumbnailURL = nodes.at(0).toElement().text();
            }
        }

        bool download;
        if (m_download->GetCheckState() == MythUIStateType::Full)
            download = true;
        else
            download = false;

        QDateTime updated = QDateTime::currentDateTime();
        QString filename("");

        if (file.isEmpty())
            filename = file;

        QString link = m_urlEdit->GetText();

        if (!thumbnailURL.isEmpty() && filename.isEmpty())
        {
            QString fileprefix = GetConfDir();

            QDir dir(fileprefix);
            if (!dir.exists())
                    dir.mkdir(fileprefix);

            fileprefix += "/MythNetvision";

            dir = QDir(fileprefix);
            if (!dir.exists())
                dir.mkdir(fileprefix);

            fileprefix += "/sitecovers";

            dir = QDir(fileprefix);
            if (!dir.exists())
                dir.mkdir(fileprefix);

            QFileInfo fi(thumbnailURL);
            QString rawFilename = fi.fileName();

            filename = QString("%1/%2").arg(fileprefix).arg(rawFilename);

            bool exists = QFile::exists(filename);
            if (!exists)
                HttpComms::getHttpFile(filename, thumbnailURL, 20000, 1, 2);
        }
        if (insertInDB(new RSSSite(title, filename, VIDEO_PODCAST, description, link,
                author, download, QDateTime::currentDateTime())))
            emit saving();
    }
    Close();
}
开发者ID:josephlord,项目名称:mythtv,代码行数:98,代码来源:rsseditor.cpp


示例4: Setup

//
// Framework Functions
//
bool Setup()
{
	//
	// Create objects.
	//

	D3DXCreateTeapot(Device, &Objects[0], 0);
	D3DXCreateSphere(Device, 1.0f, 20, 20, &Objects[1], 0);
	D3DXCreateTorus(Device, 0.5f, 1.0f, 20, 20, &Objects[2], 0);
	D3DXCreateCylinder(Device, 0.5f, 0.5f, 2.0f, 20, 20, &Objects[3], 0);

	//
	// Build world matrices - position the objects in world space.
	//

	D3DXMatrixTranslation(&Worlds[0], 0.0f, 2.0f, 0.0f);
	D3DXMatrixTranslation(&Worlds[1], 0.0f, -2.0f, 0.0f);
	D3DXMatrixTranslation(&Worlds[2], -3.0f, 0.0f, 0.0f);
	D3DXMatrixTranslation(&Worlds[3], 3.0f, 0.0f, 0.0f);

	//
	// Setup the object's materials.
	//

	Mtrls[0] = d3d::RED_MTRL;
	Mtrls[1] = d3d::BLUE_MTRL;
	Mtrls[2] = d3d::GREEN_MTRL;
	Mtrls[3] = d3d::YELLOW_MTRL;

	//
	// Setup a directional light.
	//

	D3DXVECTOR3 dir(1.0f, -0.0f, 0.25f);
	D3DXCOLOR   c = d3d::WHITE;
	D3DLIGHT9 dirLight = d3d::InitDirectionalLight(&dir, &c);

	//
	// Set and Enable the light.
	//

	Device->SetLight(0, &dirLight);
	Device->LightEnable(0, true);

	//
	// Set lighting related render states.
	//

	Device->SetRenderState(D3DRS_NORMALIZENORMALS, true);
	Device->SetRenderState(D3DRS_SPECULARENABLE, false);

	//
	// Set the projection matrix.
	//

	D3DXMATRIX proj;
	D3DXMatrixPerspectiveFovLH(
		&proj,
		D3DX_PI * 0.25f, // 45 - degree
		(float)Width / (float)Height,
		1.0f,
		1000.0f);
	Device->SetTransform(D3DTS_PROJECTION, &proj);

	return true;
}
开发者ID:natsu1211,项目名称:D2DRVO2Render,代码行数:69,代码来源:Render.cpp


示例5: Application

    Application(int &argc, char **argv)
        : QApplication(argc, argv)
    {
        QDir dir(applicationDirPath());
#ifdef Q_OS_MAC
        dir.cdUp();
        dir.cd("PlugIns");
        dir.cd("qt");
#else
        dir.cd("lib");
        dir.cd("qt5");
#endif
        addLibraryPath(dir.absolutePath());
        setOrganizationName("Meltytech");
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
        setOrganizationDomain("shotcut.org");
        setDesktopFileName("org.shotcut.Shotcut");
#else
        setOrganizationDomain("meltytech.com");
#endif
        setApplicationName("Shotcut");
        setApplicationVersion(SHOTCUT_VERSION);
        setAttribute(Qt::AA_UseHighDpiPixmaps);
        setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#if defined(Q_OS_MAC)
        setAttribute(Qt::AA_DontShowIconsInMenus);
#endif

        // Process command line options.
        QCommandLineParser parser;
        parser.addHelpOption();
        parser.addVersionOption();
#ifndef Q_OS_WIN
        QCommandLineOption fullscreenOption("fullscreen",
            QCoreApplication::translate("main", "Fill the screen with the Shotcut window."));
        parser.addOption(fullscreenOption);
#endif
        QCommandLineOption noupgradeOption("noupgrade",
            QCoreApplication::translate("main", "Hide upgrade prompt and menu item."));
        parser.addOption(noupgradeOption);
        QCommandLineOption gpuOption("gpu",
            QCoreApplication::translate("main", "Use GPU processing."));
        parser.addOption(gpuOption);
        QCommandLineOption clearRecentOption("clear-recent",
            QCoreApplication::translate("main", "Clear Recent on Exit"));
        parser.addOption(clearRecentOption);
        QCommandLineOption appDataOption("appdata",
            QCoreApplication::translate("main", "The directory for app configuration and data."),
            QCoreApplication::translate("main", "directory"));
        parser.addOption(appDataOption);
        QCommandLineOption scaleOption("QT_SCALE_FACTOR",
            QCoreApplication::translate("main", "The scale factor for a high-DPI screen"),
            QCoreApplication::translate("main", "number"));
        parser.addOption(scaleOption);
        scaleOption = QCommandLineOption("QT_SCREEN_SCALE_FACTORS",
            QCoreApplication::translate("main", "A semicolon-separated list of scale factors for each screen"),
            QCoreApplication::translate("main", "list"));
        parser.addOption(scaleOption);
        parser.addPositionalArgument("[FILE]...",
            QCoreApplication::translate("main", "Zero or more files or folders to open"));
        parser.process(arguments());
#ifdef Q_OS_WIN
        isFullScreen = false;
#else
        isFullScreen = parser.isSet(fullscreenOption);
#endif
        setProperty("noupgrade", parser.isSet(noupgradeOption));
        setProperty("clearRecent", parser.isSet(clearRecentOption));
        if (!parser.value(appDataOption).isEmpty()) {
            appDirArg = parser.value(appDataOption);
            ShotcutSettings::setAppDataForSession(appDirArg);
        }
        if (parser.isSet(gpuOption))
            Settings.setPlayerGPU(true);
        if (!parser.positionalArguments().isEmpty())
            resourceArg = parser.positionalArguments();

        // Startup logging.
        dir = Settings.appDataLocation();
        if (!dir.exists()) dir.mkpath(dir.path());
        const QString logFileName = dir.filePath("shotcut-log.txt");
        QFile::remove(logFileName);
        FileAppender* fileAppender = new FileAppender(logFileName);
        fileAppender->setFormat("[%{type:-7}] <%{function}> %{message}\n");
        cuteLogger->registerAppender(fileAppender);
#ifndef NDEBUG
        // Only log to console in dev debug builds.
        ConsoleAppender* consoleAppender = new ConsoleAppender();
        consoleAppender->setFormat(fileAppender->format());
        cuteLogger->registerAppender(consoleAppender);

        mlt_log_set_level(MLT_LOG_VERBOSE);
#else
        mlt_log_set_level(MLT_LOG_INFO);
#endif
        mlt_log_set_callback(mlt_log_handler);
        cuteLogger->logToGlobalInstance("qml", true);

        // Log some basic info.
        LOG_INFO() << "Starting Shotcut version" << SHOTCUT_VERSION;
//.........这里部分代码省略.........
开发者ID:bmatherly,项目名称:shotcut,代码行数:101,代码来源:main.cpp


示例6: main

int main(int argc, char *argv[])
{
	if (argc < 2) {
		std::cerr << "Need Resource Dir !" << std::endl;
		return 1;
	}

// 	if (argc < 3) {
// 		std::cerr << "Need Resource Dir & Extrude size !" << std::endl;
// 		return 1;
// 	}

	std::string dirpath = argv[1];
	wxArrayString files;
	DirTraverser traverser(files);

	wxDir dir(dirpath);
	dir.Traverse(traverser);

	std::map<std::string, ee::Rect> map_name2rect;

	double size = 1;
//	wxString(argv[2]).ToDouble(&size);
	try {
		for (size_t i = 0, n = files.size(); i < n; ++i)
		{
			wxFileName filename(files[i]);
			filename.Normalize();
			wxString filepath = filename.GetFullPath();
			
			if (ee::FileNameParser::isType(filepath, ee::FileNameParser::e_image))
			{
				coceditor::ExtrudeImg extrude(filepath.ToStdString());
				extrude.Trigger((int)size);
				map_name2rect.insert(std::make_pair(extrude.GetFileName(), extrude.GetRectTrimed()));
			}
		}

		for (size_t i = 0, n= files.size(); i < n; ++i)
		{
			wxFileName filename(files[i]);
			filename.Normalize();
			wxString filepath = filename.GetFullPath();

			if (ee::FileNameParser::isType(filepath, ee::FileNameParser::e_complex))
			{
				Json::Value value;
				Json::Reader reader;
				std::locale::global(std::locale(""));
				std::ifstream fin(filepath.fn_str());
				std::locale::global(std::locale("C"));
				reader.parse(fin, value);
				fin.close();

				bool dirty = false;

				int i = 0;
				Json::Value spriteValue = value["sprite"][i++];
				while (!spriteValue.isNull()) {

					std::string path = spriteValue["filepath"].asString();
					path = ee::FilenameTools::getFilenameWithExtension(path);
					std::map<std::string, ee::Rect>::iterator itr = map_name2rect.find(path);
					if (itr != map_name2rect.end()) {
						dirty = true;

						const float x = spriteValue["position"]["x"].asDouble(),
							y = spriteValue["position"]["y"].asDouble();
						value["sprite"][i-1]["position"]["x"] = x + itr->second.xCenter() * spriteValue["x scale"].asDouble();
						value["sprite"][i-1]["position"]["y"] = y + itr->second.yCenter() * spriteValue["y scale"].asDouble();
					}
					spriteValue = value["sprite"][i++];
				}

				if (dirty)
				{
					Json::StyledStreamWriter writer;
					std::locale::global(std::locale(""));
					std::ofstream fout(filepath.fn_str());
					std::locale::global(std::locale("C"));					
					writer.write(fout, value);
					fout.close();
				}
			}
		}
	} catch (ee::Exception& e) {
		std::cerr << e.what() << std::endl;
	}

	return 0;
}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:91,代码来源:main.cpp


示例7: readFile

int readFile(string& filename)
{
  float stime[8][1024];
  float wave[8][1024];
  int nsample=0;
  string dir("data/");
  //filename=dir+filename;
  printf("Reading file:%s \n ",filename.c_str());
  ifstream file;
  file.open(filename.c_str());
  if(!file){
    printf("%s : cannot be opened.\n",filename.c_str());
    return 1;
  }else{
    printf("%s : opened successfully.\n",filename.c_str());
  }
  //anal.SetWaveTime(0,stime[0],wave[0]);
  //anal.SetWaveTime(1,stime[1],wave[1]);
  //anal.SetWaveTime((float**) stime,(float**) wave);
  string line;
  bool dflag=0,eflag=0;
  int nlines=0,ndat=0;
  int nmaxsample=NDIM;
  if(nsample>0) nmaxsample=nsample;
  nsample=0;
  while (getline(file,line)) {
       //if(nlines<10)printf("%s \n", line.c_str()); 
       //printf("%s \n", line.c_str()); 
       if(line.find("Event") != string::npos){
          printf("%s \n", line.c_str()); 
          eflag=1;
          continue;
       }
       if(line.find("t1[ns]") != string::npos){
          if(!eflag){
            printf("Error: unexpected line sequence.\n");
            return 1;
          }
          eflag=0;
          if(dflag){
            printf("close sample %i \n",ndat);
            if(ndat != NDIM){
             printf("ErrorL ndat= %i \n",ndat);
             return 1;
            }
    	    anal.Compare2Waves(0,1);
            ndat=0;
            nsample++;
            if(nsample>=nmaxsample){
             printf("Warning:  nsample=%i \n",nsample);
             return 0;
            }
          }
          printf("open sample \n");
          dflag=1;
          continue;
       }
       // take data
       vector<string> items;
       splitstring(line,items," ");
       int nitems=items.size();
       if((nitems != 4) && (nitems != 8)){
         printf("Expexted number of items in line != 4 : %i \n",nitems);
         return 1;
       }
       double t1,t2;
       //cout << atof(items[0].c_str()) << endl;
       t1=atof(items[0].c_str());
       wave[0][ndat]=atof(items[1].c_str());
       t2=atof(items[2].c_str());
       wave[1][ndat]=atof(items[3].c_str());
       stime[0][ndat]=t1;
       stime[1][ndat]=t2;
       //if(t1 != t2){
       //  printf("Warning: t1 != t2 %f %f \n",t1,t2);
       //}
       if(ndat >= NDIM){
         printf("Error: unexpected size of data %i \n",ndat);
         return 1;
       }
       nlines++;
       ndat++;
  }
  if(dflag){
    printf("close sample %i \n",ndat);
    if(ndat != NDIM){
       printf("ErrorL ndat= %i \n",ndat);
       return 1;
    }
    //anal.Compare2Waves(0,1);
    nsample++;
  }
  Float_t* tt1=stime[0];
  Float_t* tt2=stime[1];
  Float_t* w1=wave[0];
  Float_t* w2=wave[1];
  DrawWaves(tt1,tt2,w1,w2);
  printf("All samples read nsample: %i \n",nsample);
  return 0;

//.........这里部分代码省略.........
开发者ID:AakaFosfor,项目名称:trigger,代码行数:101,代码来源:scopeN.C


示例8: wxMessageBox

void tcToolPanel::OnImportTable(wxCommandEvent& event)
{
    if (!tcDatabaseManager::Get()->IsOpen())
    {
        wxMessageBox("Database is not open", "Import Failed");
        return;
    }

    wxTextCtrl* dirTextCtrl = dirPicker->GetTextCtrl();

    wxString csvDir = dirPicker->GetPath();

    if (dirTextCtrl->IsModified())
    {
        csvDir = dirTextCtrl->GetValue();
    }

    bool inputValid = false;

    if (wxDir::Exists(csvDir))
    {
        wxDir dir(csvDir);
        if (dir.HasFiles("*.csv"))
        {
            inputValid = true;
        }
    }

    if (!inputValid)
    {
        wxString msg(wxString::Format("Input directory has no CSV files (%s)", csvDir.c_str()));
        wxMessageBox(msg, "Error", wxICON_ERROR);
        //SetStatusText(msg);
        return;
    }

	wxFileDialog dialog(this, "Choose table file", csvDir, "", "*.csv", wxFD_OPEN | wxFD_FILE_MUST_EXIST, wxDefaultPosition, wxDefaultSize, "filedlg");

	wxString fileToImport("");

    if (dialog.ShowModal() == wxID_OK)
    {    
		fileToImport = dialog.GetPath().c_str();
    }
	else
	{
		return;
	}

    textDisplay->Clear();

    sqlite3_connection& sqlConnection = tcDatabaseManager::Get()->GetConnection();

    tcDatabaseTranslator translator;
    bool success = translator.ImportTableFromCSV(sqlConnection, fileToImport);

    wxString msg;
    if (success)
    {
		msg.Printf("Imported CSV %s data from  \"%s\"  to database", fileToImport.c_str(), csvDir.c_str());
        if (translator.statusRows.size() > 0)
        {
            textDisplay->AppendText("IMPORT LOG:\n\n");
            for (size_t n=0; n<translator.statusRows.size(); n++)
            {
                textDisplay->AppendText(translator.statusRows[n]);
            }
        }
        
    }
    else
    {
        msg.Printf("ERROR importing CSV data from \"%s\"  to database", csvDir.c_str());
    }
    //SetStatusText(msg);

}
开发者ID:WarfareCode,项目名称:gcblue,代码行数:77,代码来源:ToolPanel.cpp


示例9: switch

    // Make one closed path by adding the points of the inner path
    void Stroker::endStroke()
    {
        switch(endType_)
        {
            // Simplest case, just add the inner points
            case cButtEnd:
            {
                for(vplUint i = innerPoints_.getItemCount(); i > 0;i-=2)
                {
                    outerPoints_.add(innerPoints_[i - 2]);
                    outerPoints_.add(innerPoints_[i - 1]);
                }

                // Close the path
                outerPoints_.add(outerPoints_[0]);
                outerPoints_.add(outerPoints_[1]);
            }
                break;

            // End outer path with an arc, then add the inner points.
            // Finalize with a closing arc to the first point
            case cRoundEnd:
            {
                Winding winding = determineWinding(normal_,invert(normal_));

                generateArc(currentPoint_,normal_,invert(normal_),
                             winding,&outerPoints_);

                for(vplUint i = innerPoints_.getItemCount(); i > 0;i-=2)
                {
                    outerPoints_.add(innerPoints_[i - 2]);
                    outerPoints_.add(innerPoints_[i - 1]);
                }

                winding = determineWinding(invert(firstNormal_),firstNormal_);

                generateArc(firstPoint_,invert(firstNormal_),firstNormal_,
                            winding,&outerPoints_);

                // Close the path
                outerPoints_.add(outerPoints_[0]);
                outerPoints_.add(outerPoints_[1]);
            }
                break;

            // Add a rectangle with sides stroke width/2 x stroke width
            case cSquareEnd:
            {
                // Use the normals for calculation of the ends
                Vector dir(-normal_.y_,normal_.x_);
                Vector firstDir(-firstNormal_.y_,firstNormal_.x_);

                dir.normalize();
                firstDir.normalize();

                scale_.transform(dir);
                scale_.transform(firstDir);

                dir *= size_ / 2;
                firstDir *= size_ / 2;

                Vector v1 = currentPoint_ + normal_ + dir;
                Vector v2 = currentPoint_ - normal_ + dir;

                addPoint(&outerPoints_,v1);
                addPoint(&outerPoints_,v2);

                for(vplUint i = innerPoints_.getItemCount(); i > 0;i-=2)
                {
                    outerPoints_.add(innerPoints_[i - 2]);
                    outerPoints_.add(innerPoints_[i - 1]);
                }

                v1 = firstPoint_ - firstNormal_ - firstDir;
                v2 = firstPoint_ + firstNormal_ - firstDir;

                addPoint(&outerPoints_,v1);
                addPoint(&outerPoints_,v2);

                // Close the path
                outerPoints_.add(outerPoints_[0]);
                outerPoints_.add(outerPoints_[1]);
            }
                break;
        }

        innerPoints_.clear();
    }
开发者ID:msahlen,项目名称:vpl,代码行数:89,代码来源:vplStroke.cpp


示例10: assert

Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
	assert(engine);

	const ADGameDescription *agdDesc = 0;
	Common::Language language = Common::UNK_LANG;
	Common::Platform platform = Common::kPlatformUnknown;
	Common::String extra;

	if (ConfMan.hasKey("language"))
		language = Common::parseLanguage(ConfMan.get("language"));
	if (ConfMan.hasKey("platform"))
		platform = Common::parsePlatform(ConfMan.get("platform"));
	if (_flags & kADFlagUseExtraAsHint) {
		if (ConfMan.hasKey("extra"))
			extra = ConfMan.get("extra");
	}

	Common::String gameid = ConfMan.get("gameid");

	Common::String path;
	if (ConfMan.hasKey("path")) {
		path = ConfMan.get("path");
	} else {
		path = ".";

		// This situation may happen only when game was
		// launched from a command line with wrong target and
		// no path was provided.
		//
		// A dummy entry will get created and will keep game path
		// We mark this entry, so it will not be added to the
		// config file.
		//
		// Fixes bug #1544799
		ConfMan.setBool("autoadded", true);

		warning("No path was provided. Assuming the data files are in the current directory");
	}
	Common::FSNode dir(path);
	Common::FSList files;
	if (!dir.isDirectory() || !dir.getChildren(files, Common::FSNode::kListAll, true)) {
		warning("Game data path does not exist or is not a directory (%s)", path.c_str());
		return Common::kNoGameDataFoundError;
	}

	if (files.empty())
		return Common::kNoGameDataFoundError;

	// Compose a hashmap of all files in fslist.
	FileMap allFiles;
	composeFileHashMap(allFiles, files, (_maxScanDepth == 0 ? 1 : _maxScanDepth));

	// Run the detector on this
	ADGameDescList matches = detectGame(files.begin()->getParent(), allFiles, language, platform, extra);

	if (cleanupPirated(matches))
		return Common::kNoGameDataFoundError;

	if (_singleid == NULL) {
		// Find the first match with correct gameid.
		for (uint i = 0; i < matches.size(); i++) {
			if (matches[i]->gameid == gameid) {
				agdDesc = matches[i];
				break;
			}
		}
	} else if (matches.size() > 0) {
		agdDesc = matches[0];
	}

	if (agdDesc == 0) {
		// Use fallback detector if there were no matches by other means
		agdDesc = fallbackDetect(allFiles, files);
		if (agdDesc != 0) {
			// Seems we found a fallback match. But first perform a basic
			// sanity check: the gameid must match.
			if (_singleid == NULL && agdDesc->gameid != gameid)
				agdDesc = 0;
		}
	}

	if (agdDesc == 0)
		return Common::kNoGameDataFoundError;

	// If the GUI options were updated, we catch this here and update them in the users config
	// file transparently.
	Common::String lang = getGameGUIOptionsDescriptionLanguage(agdDesc->language);
	if (agdDesc->flags & ADGF_ADDENGLISH)
		lang += " " + getGameGUIOptionsDescriptionLanguage(Common::EN_ANY);

	Common::updateGameGUIOptions(agdDesc->guioptions | _guioptions, lang);

	GameDescriptor gameDescriptor = toGameDescriptor(*agdDesc, _gameids);

	bool showTestingWarning = false;

#ifdef RELEASE_BUILD
	showTestingWarning = true;
#endif

//.........这里部分代码省略.........
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:101,代码来源:advancedDetector.cpp


示例11: dir

bool DirectoryWork::hasDirectory(const QString path)
{
    QDir dir(path);
    return dir.exists();
}
开发者ID:leonneon89,项目名称:CodingTextFiles,代码行数:5,代码来源:directoryWork.cpp


示例12: main

int main(int argc, char *argv[])
#endif
{
#ifndef LITEAPP_LIBRARY
    #if defined(_MSC_VER) && defined(_DEBUG)
        _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
    #endif
#endif
    QApplication::setGraphicsSystem("native");
    QApplication app(argc, argv);

#if QT_VERSION >= 0x050100
    app.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif

    //QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
    QTranslator translator;
    QTranslator qtTranslator;

    QString resPath = LiteApp::getResoucePath();
    QString locale = QLocale::system().name();
    QString qss;
    QSettings global(resPath+"/liteapp/config/global.ini",QSettings::IniFormat);
    bool storeLocal = global.value(LITEIDE_STORELOCAL,false).toBool();
    if (storeLocal) {
        const QSettings settings(resPath+"/liteapp/config/liteide.ini", QSettings::IniFormat);
        locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
        qss = settings.value(LITEAPP_QSS,"default.qss").toString();
    } else {
        const QSettings settings(QSettings::IniFormat,QSettings::UserScope,"liteide","liteide");
        locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
        qss = settings.value(LITEAPP_QSS,"default.qss").toString();
    }

    if (!locale.isEmpty()) {
        const QString &liteideTrPath = resPath+"/translations";
        if (translator.load(QLatin1String("liteide_") + locale, liteideTrPath)) {
            const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
            const QString &qtTrFile = QLatin1String("qt_") + locale;
            // Binary installer puts Qt tr files into creatorTrPath            
            app.installTranslator(&translator);
            if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, liteideTrPath)) {
                app.installTranslator(&qtTranslator);
            }
            app.setProperty("liteide_locale", locale);
        }
    }
    if (!qss.isEmpty()) {
        QFile f(resPath+"/liteapp/qss/"+qss);
        if (f.open(QFile::ReadOnly)) {
            QString styleSheet = QLatin1String(f.readAll());
            app.setStyleSheet(styleSheet);
        }
    }

    QDir::addSearchPath("icon",resPath);
    QDir::addSearchPath("icon",resPath+"/liteapp");
    QDir::addSearchPath("icon",":/");
#if QT_VERSION >= 0x050000
    QString storage = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#else
    QString storage = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#endif
    QDir dir(storage);
    dir.mkdir("liteide");

    QStringList argList;
    QStringList fileList;
    if (argc >= 2) {
        for (int i = 1; i < argc; i++) {
            QString arg = argv[i];
            if (arg.startsWith("-")) {
                argList.append(arg);
                continue;
            } else {
                fileList.append(arg);
            }
        }
    }

    IApplication *liteApp = LiteApp::NewApplication(true,0);

    if (fileList.size() == 1) {
        QString file = fileList.at(0);
        QFileInfo f(file);
        if (f.isFile()) {
            liteApp->fileManager()->addFolderList(f.path());
            liteApp->fileManager()->openEditor(file);
        } else if (f.isDir()) {
            liteApp->fileManager()->addFolderList(file);
        }
    } else {
        foreach(QString file, fileList) {
            QFileInfo f(file);
            if (f.isFile()) {
                liteApp->fileManager()->openEditor(file);
            } else if (f.isDir()) {
                liteApp->fileManager()->addFolderList(file);
            }
        }
//.........这里部分代码省略.........
开发者ID:alessio,项目名称:liteide,代码行数:101,代码来源:main.cpp


示例13: CGT_DeleteFiles

extern "C" bool CGT_DeleteFiles(
    CGT_CDiagMsg*pdm,
    const TCHAR* pszDir,
    const TCHAR* pszPattern,
    const TCHAR* pszExcFiles,
    bool         bSubDirs,
    const TCHAR* pszExcDirs
)
{
    bool            bOk;
    HANDLE          hd;
    HRESULT         hr;
    WIN32_FIND_DATA findFileData;    
    FC_CString      dir(MAX_PATH);
    FC_CString      file(MAX_PATH);


    if(pszDir && !FC_StringIsAbsPath(pszPattern))
        file.appendDir(pszDir);

    file.appendDir(pszPattern);

    dir.load(file).stripFilePart();


    //force absolute path:
    if(!FC_StringIsAbsPath(file))
    {
        CGT_IERR(pdm, _T("CGT_DeleteFiles called for relative path")); 
        return false;
    }


    //be carefull !
    //don't allow * pattern unless looks at least like gen dir:
    if(_tcschr(file, _T('*')) && !_tcsstr(file, _T("\\gen\\")))
    {
        CGT_IERR(pdm, _T("CGT_DeleteFiles called with '*' pattern but path contains no '\\gen\\'")); 
        return false;
    }

    //don't allow recursive unless looks at least like gen dir:
    if(bSubDirs && !_tcsstr(file, _T("\\gen\\")))
    {
        CGT_IERR(pdm, _T("CGT_DeleteFiles called with bSubDirs==true but path contains no '\\gen\\'")); 
        return false;
    }

    
    //dirty work:
    hd = FindFirstFile(file, &findFileData);
    if(hd == INVALID_HANDLE_VALUE)
    {
        hr = GetLastError();
        bOk = hr==ERROR_FILE_NOT_FOUND || hr==ERROR_PATH_NOT_FOUND; 
        if(!bOk)
            pdm->sysErr(GetLastError(), NULL, _T("FindFirstFile in folder:"), dir);
        return bOk;
    }
    
    if((findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)==0)
    {
        if(!pszExcFiles || !FC_StringMatchFilePattern(findFileData.cFileName, pszExcFiles))
        {
            file.load(dir).appendDir(findFileData.cFileName);
            if(!DeleteFile(file))
            {
                pdm->msg1(CG_E_FILE_DELETE, NULL, file);
                goto Error;
            }
        }
    }
    else if(bSubDirs && !IsDotDotDir(findFileData.cFileName))
    {
        if(!pszExcDirs || !FC_StringMatchFilePattern(findFileData.cFileName, pszExcDirs))
        {
            dir.appendDir(findFileData.cFileName);
            bOk = CGT_DeleteFiles(pdm, dir, FC_StringGetFilePart(pszPattern), 
                                  pszExcFiles, bSubDirs, pszExcDirs
                  );
            dir.stripFilePart();
            if(!bOk)
               goto Error;
        }
    }
    
    while(FindNextFile(hd , &findFileData))
    {
        if((findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)==0)
        {
            if(!pszExcFiles || !FC_StringMatchFilePattern(findFileData.cFileName, pszExcFiles))
            {
                file.load(dir).appendDir(findFileData.cFileName);
                if(!DeleteFile(file))
                {
                    pdm->msg1(CG_E_FILE_DELETE, NULL, file);
                    goto Error;
                }
            }
        }
//.........这里部分代码省略.........
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:101,代码来源:cgt_misc.cpp


示例14: wxBoxSizer

mxProfile::mxProfile(wxWindow *parent):wxDialog(parent,wxID_ANY,_Z("Opciones del Lenguaje"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER),old_config(LS_INIT) {
	
	text=NULL; // para que no procese el evento de seleccion al crear la lista
	
	old_config=config->lang;
	old_profile=config->profile;
	
	wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
	
	wxBoxSizer *search_sizer = new wxBoxSizer(wxHORIZONTAL);
	search=new wxTextCtrl(this,wxID_FIND,"");
	search_sizer->Add(new wxStaticText(this,wxID_ANY,_Z("Buscar: ")),wxSizerFlags().Center());
	search_sizer->Add(search,wxSizerFlags().Proportion(1).Expand());
	
	sizer->Add(search_sizer,wxSizerFlags().Proportion(0).Expand().Border(wxALL,5));
	
	wxBoxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL);

	wxDir dir(config->profiles_dir);
	if ( dir.IsOpened() ) {
		wxString filename;
		wxString spec;
		bool cont = dir.GetFirst(&filename, spec , wxDIR_FILES);
		while ( cont ) {
			perfiles.Add(filename);
			cont = dir.GetNext(&filename);
		}
	}
	perfiles.Sort(comp_nocase);
	for(unsigned int i=0;i<perfiles.GetCount();i++) { 
		LangSettings l(LS_INIT); l.Load(DIR_PLUS_FILE(config->profiles_dir,perfiles[i]));
		descripciones.Add(l.descripcion.c_str());
	}
	
	list = new wxListCtrl(this,wxID_ANY,wxDefaultPosition,wxSize(200,200),wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL);
	list->InsertColumn(0,_Z("Perfil"));
	wxImageList *iml = new wxImageList(24,24,true);
	wxBitmap noimage(DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),"null.png"),wxBITMAP_TYPE_PNG);
	for(unsigned int i=0;i<perfiles.GetCount();i++) {
		wxString ficon=DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),perfiles[i]+".png");
		if (wxFileName::FileExists(ficon))
			iml->Add(wxBitmap(ficon,wxBITMAP_TYPE_PNG));
		else
			iml->Add(noimage);
	}
	iml->Add(wxBitmap(DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),"personalizado.png"),wxBITMAP_TYPE_PNG));
	list->AssignImageList(iml,wxIMAGE_LIST_SMALL);
	
	Search();
	
	text = new wxTextCtrl(this,wxID_ANY,_T(""),wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY);
	LoadProfile();
	
	wxButton *options_button = new mxBitmapButton (this, wxID_ABOUT, bitmaps->buttons.next, _Z("Personalizar..."));
	wxButton *ok_button = new mxBitmapButton (this, wxID_OK, bitmaps->buttons.ok, _Z("Aceptar"));
	wxButton *cancel_button = new mxBitmapButton (this, wxID_CANCEL, bitmaps->buttons.cancel, _Z("Cancelar"));
	button_sizer->Add(options_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand());
	button_sizer->AddStretchSpacer(1);
	button_sizer->Add(cancel_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand());
	button_sizer->Add(ok_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand());
	
	sizer->Add(new wxStaticText(this,wxID_ANY,_Z(" Seleccione un perfil para configurar las reglas del lenguaje: ")),wxSizerFlags().Expand().Proportion(0).Border(wxTOP,5));
	sizer->Add(list,wxSizerFlags().Expand().Proportion(3).FixedMinSize());
	sizer->Add(new wxStaticText(this,wxID_ANY,_Z("")),wxSizerFlags().Expand().Proportion(0));
	sizer->Add(new wxStaticText(this,wxID_ANY,_Z(" Descripción del perfil seleccionado:")),wxSizerFlags().Expand().Proportion(0));
	sizer->Add(text,wxSizerFlags().Expand().Proportion(1).FixedMinSize());
	sizer->Add(new wxStaticText(this,wxID_ANY,""),wxSizerFlags().Expand().Proportion(0));
	sizer->Add(button_sizer,wxSizerFlags().Expand().Proportion(0));
	
	ok_button->SetDefault();
	SetEscapeId(wxID_CANCEL);
	
	SetSizerAndFit(sizer);
	
	this->Layout(); // para ajustar el tamaño de la columna de la lista
	list->SetColumnWidth(0,list->GetSize().GetWidth()-32);
	
	search->SetFocus();
	
	ShowModal();
}
开发者ID:retrography,项目名称:git-import-test,代码行数:81,代码来源:mxProfile.cpp


示例15: dir

void SearchSet::addDirectory(const String &name, const String &directory, int priority, int depth, bool flat) {
	FSNode dir(directory);
	addDirectory(name, dir, priority, depth, flat);
}
开发者ID:jvprat,项目名称:residual,代码行数:4,代码来源:archive.cpp


示例16: keyName

static WCHAR *GetGhostscriptPath()
{
    WCHAR *gsProducts[] = {
        L"AFPL Ghostscript",
        L"Aladdin Ghostscript",
        L"GPL Ghostscript",
        L"GNU Ghostscript",
    };

    // find all installed Ghostscript versions
    WStrVec versions;
    REGSAM access = KEY_READ | KEY_WOW64_32KEY;
TryAgain64Bit:
    for (int i = 0; i < dimof(gsProducts); i++) {
        HKEY hkey;
        ScopedMem<WCHAR> keyName(str::Join(L"Software\\", gsProducts[i]));
        if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, access, &hkey) != ERROR_SUCCESS)
            continue;
        WCHAR subkey[32];
        for (DWORD ix = 0; RegEnumKey(hkey, ix, subkey, dimof(subkey)) == ERROR_SUCCESS; ix++)
            versions.Append(str::Dup(subkey));
        RegCloseKey(hkey);
    }
    if ((access & KEY_WOW64_32KEY)) {
        // also look for 64-bit Ghostscript versions under 64-bit Windows
        access = KEY_READ | KEY_WOW64_64KEY;
#ifndef _WIN64
        // (unless this is 32-bit Windows)
        if (IsRunningInWow64())
#endif
        goto TryAgain64Bit;
    }
    versions.SortNatural();

    // return the path to the newest installation
    for (size_t ix = versions.Count(); ix > 0; ix--) {
        for (int i = 0; i < dimof(gsProducts); i++) {
            ScopedMem<WCHAR> keyName(str::Format(L"Software\\%s\\%s",
                                                 gsProducts[i], versions. 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dir1函数代码示例发布时间:2022-05-30
下一篇:
C++ dimof函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap