Esempio n. 1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void PMFileGenerator::generateOutput()
{
//  std::cout << "PMFileGenerator::generateOutput" << std::endl;
  if (doesGenerateOutput() == false)
  {
    return;
  }

  //Get text field values from widget
  QString pluginName = getPluginName();
  QString pluginDir = getOutputDir();

  if (pluginName.isEmpty() == true || pluginDir.isEmpty() == true)
  {
      return;
  }

//  QString classNameLowerCase = m_ClassName.toLower();

  //Open file
    QFile rfile(getCodeTemplateResourcePath());
    if ( rfile.open(QIODevice::ReadOnly | QIODevice::Text) ) {
      QTextStream in(&rfile);
      QString text = in.readAll();
      text.replace("@PluginName@", pluginName);
      QFileInfo fi(m_FileName);
      QString className = fi.baseName();
      text.replace("@ClassName@", className);
      text.replace("@MD_FILE_NAME@", m_FileName);
      text.replace("@ClassNameLowerCase@", className.toLower());
      text.replace("@FilterGroup@", pluginName);
      text.replace("@FilterSubgroup@", pluginName);

      QString parentPath = getOutputDir() + QDir::separator() + getPathTemplate().replace("@PluginName@", getPluginName());
      parentPath = QDir::toNativeSeparators(parentPath);

      QDir dir(parentPath);
      dir.mkpath(parentPath);

      parentPath = parentPath + QDir::separator() + m_FileName;
      //Write to file
      QFile f(parentPath);
      if ( f.open(QIODevice::WriteOnly | QIODevice::Text) ) {
        QTextStream out(&f);
        out << text;
      }
    }
}
Esempio n. 2
0
void GhostScr::exec()
{
    QString command = "gs";
    QStringList args;
    args << "-SDEVICE=jpeg" << "-r1200x1200" << "-sPAPERSIZE=letter" << "-dNOPAUSE" << "-dBATCH";
    if ((!getStopPage().isEmpty()) || (getStopPage().toInt() > 0)) {
        if (getStartPage().toInt() == 0)
              this->setStartPage("1");
        args << QString("-dFirstPage=").append(getStartPage()) << QString("-dLastPage=").append(getStopPage());
    }
    if (!getOutputDir().endsWith("/"))
        setOutputDir(getOutputDir().append('/'));
    setOutputPrefix(getOutputDir().append("page"));
    args << QString("-sOutputFile=").append(getOutputPrefix()).append("_%04d.jpg");
    args << "--" << this->getSourcePDF();
    setOutputExtension("jpg");
    execInternal(command, args);
}
Esempio n. 3
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString PMFileGenerator::getFileContents(QString replaceStr)
{
  //Get text feature values from widget
  QString pluginName = getPluginName();
  QString pluginDir = getOutputDir();
  QString text = "";

  if (pluginName.isEmpty() == true)
  {
    return text;
  }

  //Open file
  QFile rfile(getCodeTemplateResourcePath());
  if (rfile.open(QIODevice::ReadOnly | QIODevice::Text))
  {
    QTextStream in(&rfile);
    text = in.readAll();
    text.replace("@PluginName@", pluginName);
    QFileInfo fi(m_FileName);
    QString className = fi.baseName();
    QString filterName = className;
    //filterName = filterName.remove("Test");   // For the test files
    text.replace("@ClassName@", className);
    text.replace("@FilterName@", filterName);
    text.replace("@MD_FILE_NAME@", m_FileName);
    text.replace("@ClassNameLowerCase@", className.toLower());
    text.replace("@FilterGroup@", pluginName);
    text.replace("@FilterSubgroup@", pluginName);

    // Replace function contents with the string that we have stored
    text.replace("@SetupFPContents@", setupFPContents);
    text.replace("@FPContents@", fpContents);
    text.replace("@ReadFPContents@", readFPContents);
    text.replace("@WriteFPContents@", writeFPContents);
    text.replace("@DataCheckContents@", dataCheckContents);
    text.replace("@InitList@", initListContents);
    text.replace("@Filter_H_Includes@", filterHIncludesContents);
    text.replace("@Filter_CPP_Includes@", filterCPPIncludesContents);

    if (replaceStr.isEmpty() == false)
    {
      text.replace("@AddTestText@", replaceStr);    // Replace token for Test/CMakeLists.txt file
      text.replace("@Namespaces@", replaceStr);   // Replace token for Test/TestFileLocations.h.in file
    }

    rfile.close();
  }

  return text;
}
Esempio n. 4
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void PMFileGenerator::generateOutput()
{
//  qDebug() << "PMFileGenerator::generateOutput" << "\n";
  if (doesGenerateOutput() == false)
  {
    return;
  }

  //Get text feature values from widget
  QString pluginName = getPluginName();
  QString pluginDir = getOutputDir();

  if (pluginName.isEmpty() == true || pluginDir.isEmpty() == true)
  {
    return;
  }

  QString contents = getFileContents(QString());

  if (contents.isEmpty() == false)
  {
    QString parentPath = getOutputDir() + QDir::separator() + getPathTemplate().replace("@PluginName@", getPluginName());
    parentPath = QDir::toNativeSeparators(parentPath);

    QDir dir(parentPath);
    dir.mkpath(parentPath);

    parentPath = parentPath + QDir::separator() + m_FileName;

    //Write to file
    QFile f(parentPath);
    if ( f.open(QIODevice::WriteOnly | QIODevice::Text) )
    {
      QTextStream out(&f);
      out << contents;
    }
  }
}
Esempio n. 5
0
static CString getFontsPath()
{
    CString webkitOutputDir = getOutputDir();
    GUniquePtr<char> fontsPath(g_build_filename(webkitOutputDir.data(), "DependenciesGTK", "Root", "webkitgtk-test-fonts", nullptr));
    if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
        return fontsPath.get();

    // Try alternative fonts path.
    fontsPath.reset(g_build_filename(webkitOutputDir.data(), "webkitgtk-test-fonts", NULL));
    if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
        return fontsPath.get();

    return CString();
}
Esempio n. 6
0
void PDF2PPT::exec()
{
    QString command = "pdftoppm";
    QStringList args;
    args << "-jpeg";
    if (getStopPage() > 0) {
        if (getStartPage() == 0)
            this->setStartPage("1");
        args << "-f" << QString::number(getStartPage()) << "-l" << QString::number(getStopPage());
    }
    args << "-rx" << "600" << "-ry" << "600" << this->getSourcePDF();
    setOutputPrefix(getOutputDir().append("page"));
    args << getOutputPrefix();
    setOutputExtension("jpg");
    execInternal(command, args);
}
Esempio n. 7
0
int main(int argc, char** argv) {
    if (argc < 2) {
        doHelp();
        return 0;
    }

    std::vector<plString> fFiles;

    plDebug::Init(plDebug::kDLAll);
    plResManager rm;
    plPageInfo* page;
    plString outDir, outFile;
    bool exVtx = true, exTex = true, noHdr = false;
    for (int i=1; i<argc; i++) {
        if (argv[i][0] == '-') {
            if (argv[i][1] == '-') argv[i]++;
            if (strcmp(argv[i], "-help") == 0) {
                doHelp();
                return 0;
            } else if (strcmp(argv[i], "-vtx") == 0) {
                exVtx = false;
                fprintf(stderr, "Warning: Including Vertex data\n");
            } else if (strcmp(argv[i], "-tex") == 0) {
                exTex = false;
                fprintf(stderr, "Note: Texture data unsupported. -tex will "
                                "be ignored for this export\n");
            } else if (strcmp(argv[i], "-nohdr") == 0) {
                noHdr = true;
            } else {
                fprintf(stderr, "Error: Unrecognized option %s\n", argv[i]);
                return 1;
            }
        } else {
            fFiles.push_back(plString(argv[i]));
        }
    }

    for (size_t i=0; i<fFiles.size(); i++) {
        try {
            page = rm.ReadPage(fFiles[i]);
        } catch (hsException& e) {
            fprintf(stderr, "%s:%lu: %s\n", e.File(), e.Line(), e.what());
            return 1;
        } catch (std::exception& e) {
            fprintf(stderr, "PrcExtract Exception: %s\n", e.what());
            return 1;
        } catch (...) {
            fprintf(stderr, "Undefined error!\n");
            return 1;
        }
        outDir = getOutputDir(fFiles[i], page);
        outFile = outDir + filenameConvert(fFiles[i]);
      #ifdef WIN32
        CreateDirectory(outDir.cstr(), NULL);
      #else
        mkdir(outDir.cstr(), S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
      #endif

        printf("Writing %s\n", outFile.cstr());
        hsFileStream* S = new hsFileStream();
        if (!S->open(outFile, fmWrite)) {
            fprintf(stderr, "Error opening %s for writing!\n", outFile.cstr());
            delete S;
            return 1;
        }
        S->setVer(rm.getVer());
        pfPrcHelper* prc = new pfPrcHelper(S);
        if (exVtx) prc->exclude(pfPrcHelper::kExcludeVertexData);
        if (exTex) prc->exclude(pfPrcHelper::kExcludeTextureData);
        if (!noHdr) {
            prc->writeComment("Generator: PrcExtract");
            prc->writeComment(plString("Source: ") + fFiles[i]);
            time_t ts = time(NULL);
            char buf[256];
            strftime(buf, 256, "Created: %Y/%m/%d %H:%M:%S", localtime(&ts));
            prc->writeComment(buf);
            S->writeStr("\n");
        }
        try {
            rm.WritePagePrc(prc, page);
        } catch (hsException& e) {
            fprintf(stderr, "%s:%lu: %s\n", e.File(), e.Line(), e.what());
            return 1;
        } catch (std::exception& e) {
            fprintf(stderr, "PrcExtract Exception: %s\n", e.what());
            return 1;
        } catch (...) {
            fprintf(stderr, "Undefined error!\n");
            return 1;
        }

        delete prc;
        S->close();
        delete S;
    }

    return 0;
}
Esempio n. 8
0
int main(int argc, char* argv[]) {
    if (argc < 2 || argc > 3) {
        doHelp();
        return 0;
    }

    eDirection direction = kRepack;
    ST::string filename = argv[1];
    ST_ssize_t dotLoc = filename.find_last('.');
    if (argc == 3) {
        if (strcmp(argv[1], "-c") == 0)
            direction = kCreate;
        else if (strcmp(argv[1], "-x") == 0)
            direction = kExtract;
        else if (strcmp(argv[1], "-r") == 0)
            direction = kRepack;
        else {
            doHelp();
            return 1;
        }
        filename = argv[2];
    } else if (dotLoc >= 0 && filename.substr(dotLoc) == ".prd") {
        direction = kCreate;
    }

    plResManager rm;
    hsFileStream S, OS;
    if (!S.open(filename, fmRead)) {
        ST::printf(stderr, "Error opening {} for reading!", filename);
        return 1;
    }
    plPageInfo* page = new plPageInfo();

    //int len;
    short maj = 63, min = 11;
    unsigned int i, j;
    if (direction == kExtract || direction == kRepack) {
        S.close();
        delete page;
        page = rm.ReadPage(filename, true);
        OS.open(filenameConvert(filename, kExtract), fmCreate);
        OS.write(4, "PRD");
        OS.writeShort(page->getAge().size());
        OS.writeStr(page->getAge());
        OS.writeShort(page->getPage().size());
        OS.writeStr(page->getPage());
        if (rm.getVer().isUniversal()) {
            maj = 0x7FFF;
            min = 0x7FFF;
        } else  if (rm.getVer().isEoa()) {
            maj = -1;
            min = 1;
        } else if (rm.getVer().isHexIsle()) {
            maj = -1;
            min = 2;
        } else {
            maj = rm.getVer().revMajor();
            min = rm.getVer().revMinor();
        }
        OS.writeShort(maj);
        OS.writeShort(min);
        plLocation loc = page->getLocation();
        loc.write(&OS);
        OS.close();

        std::vector<short> types = rm.getTypes(loc);
      #ifdef _WIN32
        CreateDirectoryW(getOutputDir(filename, page).to_wchar().data(), NULL);
      #else
        mkdir(getOutputDir(filename, page).c_str(), S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
      #endif
        for (i=0; i<types.size(); i++) {
            std::vector<plKey> objs = rm.getKeys(loc, types[i]);
            for (j=0; j<objs.size(); j++) {
                ST::string po_file = ST::format("{}[{04X}]{}.po", getOutputDir(filename, page),
                                                types[i], CleanFileName(objs[j]->getName()));
                OS.open(po_file, fmCreate);
                OS.setVer(rm.getVer());
                rm.WriteCreatable(&OS, objs[j]->getObj());
                OS.close();
            }
        }
    }
    if (direction == kRepack) {
        filename = filenameConvert(filename, kExtract);
        S.open(filename, fmRead);
    }
    if (direction == kCreate || direction == kRepack) {
        OS.open(filenameConvert(filename, kCreate), fmCreate);
        char sig[4];
        S.read(4, sig);
        if (strncmp(sig, "PRD", sizeof(sig)) != 0) {
            fputs("Error: Invalid input file!\n", stderr);
            OS.close();
            S.close();
            return 1;
        }
        ST::string ageName = S.readStr(S.readShort());
        ST::string pageName = S.readStr(S.readShort());
        page->setAge(ageName);
        page->setPage(pageName);
        maj = S.readShort();
        min = S.readShort();
        if (maj == 0x7FFF) {
            OS.setVer(PlasmaVer::pvUniversal);
        } else if (maj == -1) {
            if (min == 1)
                OS.setVer(PlasmaVer::pvEoa);
            else if (min == 2)
                OS.setVer(PlasmaVer::pvHex);
        } else if (maj == 70) {
            OS.setVer(PlasmaVer::pvMoul);
        } else if (maj == 63) {
            if (min == 11)
                OS.setVer(PlasmaVer::pvPrime);
            if (min == 12)
                OS.setVer(PlasmaVer::pvPots);
        } else {
            ST::printf(stderr, "Error: Invalid Plasma version: {}.{}\n", maj, min);
            OS.close();
            S.close();
            return 1;
        }
        S.setVer(OS.getVer());
        plLocation loc;
        loc.read(&S);
        page->setLocation(loc);
        page->setReleaseVersion(0);
        page->setFlags(plPageInfo::kBasicChecksum);
        S.close();

        std::vector<ST::string> inFiles;
        std::vector<short> inClasses;
        hsFileStream PS;
        PS.setVer(OS.getVer());
      #ifdef _WIN32
        ST::string pattern = ST::format("{}*.po", getOutputDir(filename, page));
        WIN32_FIND_DATAW fd;
        HANDLE fr = FindFirstFileW(pattern.to_wchar().data(), &fd);
        if (fr != NULL) {
            do {
                ST::string po_file = getOutputDir(filename, page) + fd.cFileName;
                inFiles.push_back(po_file);
                PS.open(po_file, fmRead);
                short classType = PS.readShort();
                PS.close();
                bool haveClass = false;
                for (j=0; j<inClasses.size(); j++)
                    if (inClasses[j] == classType) {
                        haveClass = true;
                }
                if (!haveClass)
                    inClasses.push_back(classType);
            } while (FindNextFileW(fr, &fd));
            FindClose(fr);
        }
      #else
        dirent** des;
        unsigned int nEntries = scandir(getOutputDir(filename, page).c_str(), &des, &selPO, &alphasort);
        for (i=0; i<nEntries; i++) {
            ST::string po_file = getOutputDir(filename, page) + des[i]->d_name;
            inFiles.push_back(po_file);
            PS.open(po_file, fmRead);
            short classType = PS.readShort();
            PS.close();
            bool haveClass = false;
            for (j=0; j<inClasses.size(); j++)
                if (inClasses[j] == classType) {
                    haveClass = true;
            }
            if (!haveClass)
                inClasses.push_back(classType);
        }
      #endif
        page->setClassList(inClasses);
        page->write(&OS);
        page->setDataStart(OS.pos());
        plKeyCollector keys;

        for (i=0; i<inFiles.size(); i++) {
            plKey key = new plKeyData();
            PS.open(inFiles[i], fmRead);
            PS.setVer(S.getVer());
            unsigned int poLen = PS.size();
            uint8_t* objBuf = new uint8_t[poLen];
            key->setFileOff(OS.pos());
            key->setObjSize(poLen);
            PS.read(poLen, objBuf);
            OS.write(poLen, objBuf);
            delete[] objBuf;
            PS.seek(2);
            key->readUoid(&PS);
            PS.close();
            keys.add(key);
        }

        page->setIndexStart(OS.pos());
        keys.sortKeys(page->getLocation());
        std::vector<short> types = keys.getTypes(page->getLocation());
        //if (types != inClasses)
        //    throw "Wtf, mate?";
        OS.writeInt(types.size());
        for (i=0; i<types.size(); i++) {
            std::vector<plKey> kList = keys.getKeys(page->getLocation(), types[i]);
            OS.writeShort(pdUnifiedTypeMap::MappedToPlasma(types[i], OS.getVer()));
            unsigned int lenPos = OS.pos();
            if (!OS.getVer().isUruSP() && !OS.getVer().isUniversal()) {
                OS.writeInt(0);
                OS.writeByte(0);
            }
            OS.writeInt(kList.size());
            for (j=0; j<kList.size(); j++)
                kList[j]->write(&OS);
            if (!OS.getVer().isUruSP() && !OS.getVer().isUniversal()) {
                unsigned int nextPos = OS.pos();
                OS.seek(lenPos);
                OS.writeInt(nextPos - lenPos - 4);
                OS.seek(nextPos);
            }
        }
        if (OS.getVer().isNewPlasma())
            page->setChecksum(OS.pos());
        else
            page->setChecksum(OS.pos() - page->getDataStart());
        page->writeSums(&OS);
        OS.close();
    }

    // Delete temp files with the repack option
    if (direction == kRepack) {
      #ifdef _WIN32
        ST::string pattern = ST::format("{}*.po", getOutputDir(filename, page));
        WIN32_FIND_DATAW rfd;
        HANDLE rfr = FindFirstFileW(pattern.to_wchar().data(), &rfd);
        if (rfr != NULL) {
            do {
                ST::string po_file = getOutputDir(filename, page) + rfd.cFileName;
                DeleteFileW(po_file.to_wchar().data());
            } while (FindNextFileW(rfr, &rfd));
            FindClose(rfr);
        }
        RemoveDirectoryW(getOutputDir(filename, page).to_wchar().data());
        DeleteFileW(filename.to_wchar().data());
      #else
        dirent** rdes;
        unsigned int nEntries = scandir(getOutputDir(filename, page).c_str(), &rdes, &selAll, &alphasort);
        for (i=0; i<nEntries; i++) {
            ST::string po_file = getOutputDir(filename, page) + rdes[i]->d_name;
            unlink(po_file.c_str());
        }
        rmdir(getOutputDir(filename, page).c_str());
        unlink(filename.c_str());
      #endif
    }

    return 0;
}
Esempio n. 9
0
void dxf2shpConverterGui::on_btnBrowseOutputDir_clicked()
{
  getOutputDir();
}
Esempio n. 10
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void PMFileGenerator::generateOutputWithFilterNames(QSet<QString> names)
{
  //  qDebug() << "PMFileGenerator::generateOutput" << "\n";
  if (doesGenerateOutput() == false)
  {
    return;
  }

  //Get text feature values from widget
  QString pluginName = getPluginName();
  QString pluginDir = getOutputDir();

  if (pluginName.isEmpty() == true || pluginDir.isEmpty() == true)
  {
    return;
  }

  //  QString classNameLowerCase = m_ClassName.toLower();

  //Open file
  QFile rfile(getCodeTemplateResourcePath());
  if (rfile.open(QIODevice::ReadOnly | QIODevice::Text))
  {
    QTextStream in(&rfile);
    QString text = in.readAll();

    text.replace("@PluginName@", pluginName);
    QFileInfo fi(m_FileName);
    QString className = fi.baseName();
    text.replace("@ClassName@", className);
    text.replace("@MD_FILE_NAME@", m_FileName);
    text.replace("@ClassNameLowerCase@", className.toLower());
    text.replace("@FilterGroup@", pluginName);
    text.replace("@FilterSubgroup@", pluginName);

    if (names.isEmpty() == false)
    {
      if (getFileName() == "TestFileLocations.h.in")
      {
        QString replaceStr = createReplacementString(TESTFILELOCATIONS, names);
        text.replace("@Namespaces@", replaceStr);   // Replace token for Test/TestFileLocations.h.in file
      }
      else if (getFileName() == "CMakeLists.txt")
      {
        QString replaceStr = createReplacementString(CMAKELISTS, names);
        text.replace("@AddTestText@", replaceStr);    // Replace token for Test/CMakeLists.txt file
      }
    }
    else
    {
      text.replace("\n  @Namespaces@\n", "");   // Replace token for Test/TestFileLocations.h.in file
      text.replace("\n@AddTestText@\n", "");    // Replace token for Test/CMakeLists.txt file
    }

    QString parentPath = getOutputDir() + QDir::separator() + getPathTemplate().replace("@PluginName@", getPluginName());
    parentPath = QDir::toNativeSeparators(parentPath);

    QDir dir(parentPath);
    dir.mkpath(parentPath);

    parentPath = parentPath + QDir::separator() + m_FileName;
    //Write to file
    QFile f(parentPath);
    if (f.open(QIODevice::WriteOnly | QIODevice::Text))
    {
      QTextStream out(&f);
      out << text;
    }
  }
}
Esempio n. 11
0
bool
ZDriver::writeHeader( void )
{
	const std::string &tokenType = getValue( "token_type" ).first;
	const std::string &prefix = getValue( "token_prefix" ).first;
	std::string fileName = getOutputDir();
	std::ofstream out;
	bool isOk = false;

	getFileName( fileName, ".h" );

	out.open( fileName.c_str() );
	if ( out.is_open() )
	{
		size_t i, nSym;

		myCurLineNum = 0;
		myPimplName = "priv";
		myPimplName.append( getParserName() );
		myPimplName.append( "Impl" );


		std::string nsStart, nsEnd;
		std::string poundDef = "_";

		if ( ! myNameSpace.empty() )
		{
			std::string::size_type nsPos, oldPos;

			nsStart = myNameSpace;

			// Cheat so we get the proper number of :: replacements...
			if ( *(nsStart.end() - 1) != ':' )
				nsStart.append( "::" );

			oldPos = 0;
			nsPos = nsStart.find( "::" );
			while ( nsPos != std::string::npos )
			{
				poundDef.append( nsStart.begin() + oldPos,
								 nsStart.begin() + nsPos );
				poundDef.push_back( '_' );
				nsStart.replace( nsPos, 2, "\n{\n" );
				nsStart.insert( oldPos, "namespace " );
				nsEnd.append( "\n} // namespace\n" );
				oldPos = nsPos + 13; // len("namespace ") + len("\n{\n")
				nsPos = nsStart.find( "::", nsPos );
			}
		}

		poundDef.append( getParserName() );
		poundDef.append( "_h_" );

		out << "// This file auto-generated from " << getParserName()
			<< ".lem by " << VersionInfo::appName() << " version "
			<< VersionInfo::appVersion() << endl();
		out << "// Editing of this file strongly discouraged." << endl();

		out << endl() << "#ifndef " << poundDef << endl();
		out << "#define " << poundDef << endl();

		emitValue( getValue( "header_include" ), out );
		out << endl() << "class " << myPimplName << ";" << endl();

		out << endl() << endl() << nsStart << endl();
		myCurLineNum += std::count_if( nsStart.begin(), nsStart.end(),
									   std::bind2nd( std::equal_to<char>(), '\n' ) );

		out << "class " << getParserName() << endl() << "{" << endl()
			<< "public:" << endl();

		// Generate the terminal tokens that the lexer will feed us
		int idx = 1;

		nSym = SymbolTable::get()->getNumSymbols();
		out << endl() << "    enum Terminal" << endl() << "    {" << endl();
		out << "        " << prefix << "EOF = 0";
		for ( i = 0; i < nSym; ++i )
		{
			Symbol *sp = SymbolTable::get()->getNthSymbol( i );

			if ( Symbol::TERMINAL == sp->getType() )
			{
				out << "," << endl();
				out << "        " << prefix << sp->getName() << " = " << idx;
				++idx;
			}
		}
		out << endl() << "    };";

		// Finish out the file
		out << endl() << endl() << "    " << getParserName() << "( void );"
			<< endl();
		out << "    ~" << getParserName() << "( void );" << endl();
		out << endl() << endl();
		out << "    void parse( " << getParserName() << "::Terminal tok, ";

		if ( tokenType.empty() )
			out << "void *value";
		else
		{
			out << tokenType;
			if ( *(tokenType.end() - 1) != '*' && *(tokenType.end() - 1) != '&' )
				out << " value";
			else
				out << "value";
		}
		out << myExtraArg;
		out << " );" << endl();

		out << endl() << "private:" << endl();
		out << "	// No copying of this class" << endl();
		out << "	" << getParserName() << "( const " << getParserName()
			<< " & );" << endl();
		out << "	" << getParserName() << " &operator=( const "
			<< getParserName() << " & );" << endl();
		out << "    ValuePtr<" << myPimplName << "> myImplementation;" << endl();
		out << endl() << endl() << "};" << endl();
		out << endl() << nsEnd << endl() << endl();
		myCurLineNum += std::count_if( nsEnd.begin(), nsEnd.end(),
									   std::bind2nd( std::equal_to<char>(), '\n' ) );
		out << "#endif /* " << poundDef << " */ " << endl();
		out.close();
		isOk = true;
	}

	return isOk;
}