Esempio n. 1
0
void triSurf::writeToFMS(const fileName& fName) const
{
    OFstream fStream(fName);

    //- write patches
    fStream << triSurfFacets::patches_;

    fStream << nl;

    //- write points
    fStream << triSurfPoints::points_;

    fStream << nl;

    //- write triangles
    fStream << triSurfFacets::triangles_;

    fStream << nl;

    //- write feature edges
    fStream << triSurfFeatureEdges::featureEdges_;

    fStream << nl;

    //- write point subsets
    List<meshSubset> subsets;
    label i(0);
    subsets.setSize(pointSubsets_.size());
    forAllConstIter(Map<meshSubset>, pointSubsets_, it)
        subsets[i++] = it();
    fStream << subsets;

    fStream << nl;

    //- write subsets of facets
    subsets.setSize(triSurfFacets::facetSubsets_.size());
    i = 0;
    forAllConstIter(Map<meshSubset>, triSurfFacets::facetSubsets_, it)
        subsets[i++] = it();
    fStream << subsets;

    fStream << nl;

    //- write subets of feature edges
    subsets.setSize(triSurfFeatureEdges::featureEdgeSubsets_.size());
    i = 0;
    forAllConstIter
    (
        Map<meshSubset>,
        triSurfFeatureEdges::featureEdgeSubsets_,
        it
    )
        subsets[i++] = it();
    fStream << subsets;
}
Esempio n. 2
0
void triSurf::writeToFTR(const fileName& fName) const
{
    OFstream fStream(fName);

    fStream << triSurfFacets::patches_;

    fStream << nl;

    fStream << triSurfPoints::points_;

    fStream << nl;

    fStream << triSurfFacets::triangles_;
}
Esempio n. 3
0
std::string readShaderFromFile(const char *filePath) {
	std::string content;
	std::ifstream fStream(filePath);

	if (!fStream.is_open()) {
		std::cerr << "Could not open: " << filePath << ". Typos much??\n";
		return "";
	}

	std::string tmpLine = "";
	while (!fStream.eof()) {
		std::getline(fStream, tmpLine);
		content.append(tmpLine + "\n");
	}

	fStream.close();
	return content;
}
void SchedulerTester::initTimezone()
{
    QString kdehome = getenv("KDEHOME");
    QDir d(kdehome);
    d.mkpath("tjtest");
    d.cd("tjtest");

    QString dataDir = d.path();
    qDebug()<<dataDir;
    QFile f;
    f.setFileName(dataDir + QLatin1String( "/zone.tab" ) );
    f.open(QIODevice::WriteOnly);
    QTextStream fStream(&f);
    fStream << "DE  +5230+01322 Europe/Berlin\n"
               "EG  +3003+03115 Africa/Cairo\n"
               "FR  +4852+00220 Europe/Paris\n"
               "GB  +512830-0001845 Europe/London   Great Britain\n"
               "US  +340308-1181434 America/Los_Angeles Pacific Time\n";
    f.close();
    QVERIFY(QFile::exists( dataDir + QLatin1String("/zone.tab")));
    QDir dir(dataDir);
    QVERIFY(dir.mkdir("Africa"));
    QFile::copy(QString::fromLatin1(KDESRCDIR) + QLatin1String("zoneinfo/Cairo"), dataDir + QLatin1String("/Africa/Cairo"));
    QVERIFY(QFile::exists( dataDir + QLatin1String("/Africa/Cairo")));
    QVERIFY(dir.mkdir("America"));
    QFile::copy(QString::fromLatin1(KDESRCDIR) + QLatin1String("zoneinfo/Los_Angeles"), dataDir + QLatin1String("/America/Los_Angeles"));
    QVERIFY(QFile::exists( dataDir + QLatin1String("/America/Los_Angeles")));
    QVERIFY(dir.mkdir("Europe"));
    QFile::copy(QString::fromLatin1(KDESRCDIR) + QLatin1String("zoneinfo/Berlin"), dataDir + QLatin1String("/Europe/Berlin"));
    QVERIFY(QFile::exists( dataDir + QLatin1String("/Europe/Berlin")));
    QFile::copy(QString::fromLatin1(KDESRCDIR) + QLatin1String("zoneinfo/London"),dataDir + QLatin1String("/Europe/London"));
    QVERIFY(QFile::exists( dataDir + QLatin1String("/Europe/London")));
    QFile::copy(QString::fromLatin1(KDESRCDIR) + QLatin1String("zoneinfo/Paris"), dataDir + QLatin1String("/Europe/Paris"));
    QVERIFY(QFile::exists( dataDir + QLatin1String("/Europe/Paris")));

    // NOTE: QTEST_KDEMAIN_CORE puts the config file in QDir::homePath() + "/.kde-unit-test"
    //       and hence, this is common to all unit tests
    KConfig config("ktimezonedrc");
    KConfigGroup group(&config, "TimeZones");
    group.writeEntry("ZoneinfoDir", dataDir);
    group.writeEntry("Zonetab", dataDir + QString::fromLatin1("/zone.tab"));
    group.writeEntry("LocalZone", QString::fromLatin1("Europe/Berlin"));
    config.sync();
}
Esempio n. 5
0
void triSurf::readFromFMS(const fileName& fName)
{
    IFstream fStream(fName);

    //- read the list of patches defined on the surface mesh
    fStream >> triSurfFacets::patches_;

    //- read points
    fStream >> triSurfPoints::points_;

    //- read surface triangles
    fStream >> triSurfFacets::triangles_;

    //- read feature edges
    fStream >> triSurfFeatureEdges::featureEdges_;

    List<meshSubset> subsets;

    //- read point subsets
    fStream >> subsets;
    forAll(subsets, subsetI)
        triSurfPoints::pointSubsets_.insert(subsetI, subsets[subsetI]);

    subsets.clear();

    //- read facet subsets
    fStream >> subsets;
    forAll(subsets, subsetI)
        triSurfFacets::facetSubsets_.insert(subsetI, subsets[subsetI]);

    subsets.clear();

    //- read subsets on feature edges
    fStream >> subsets;
    forAll(subsets, subsetI)
        triSurfFeatureEdges::featureEdgeSubsets_.insert
        (
            subsetI,
            subsets[subsetI]
        );
}
JNIEXPORT jboolean JNICALL Java_org_cef_callback_CefSchemeRegistrar_1N_N_1AddCustomScheme
  (JNIEnv *env, jobject obj, jstring jSchemeName, jboolean jIsStandard, 
   jboolean jIsLocal, jboolean jIsDisplayIsolated) {

  CefRefPtr<CefSchemeRegistrar> registrar =
      GetCefFromJNIObject<CefSchemeRegistrar>(env, obj, "CefSchemeRegistrar");
  if (!registrar.get())
    return JNI_FALSE;
  CefString schemeName = GetJNIString(env, jSchemeName);
  bool result = registrar->AddCustomScheme(schemeName,
                                           jIsStandard != JNI_FALSE,
                                           jIsLocal != JNI_FALSE,
                                           jIsDisplayIsolated != JNI_FALSE);
  if (!result)
    return JNI_FALSE;

  // The registered scheme has to be forwarded to all other processes which will
  // be created by the browser process (e.g. the render-process). Otherwise
  // things like JS "localStorage" get/set will end up in a crashed
  // render process.
  std::string tmpName = util::GetTempFileName("scheme", false);

  std::ofstream fStream(tmpName.c_str(), std::ofstream::out |
      std::ofstream::app);

  if (fStream.is_open()) {
    // 1) Write the scheme name and the params to the file.
    fStream << schemeName.ToString().c_str() << "," <<
        (jIsStandard != JNI_FALSE) << (jIsLocal != JNI_FALSE) <<
        (jIsDisplayIsolated != JNI_FALSE);
    fStream.close();

    // 2) Register file to be deleted in CefShutdown()
    ClientApp::registerTempFile(tmpName);
  }
  return JNI_TRUE;
}