Exemple #1
0
    int Ecppc::run()
    {
      // componentname from inputfilename
      if (_componentname.empty())
      {
        if (_multibinary)
        {
          std::cerr << "warning: no componentname passed (with -n) - using \"images\"" << std::endl;
          _componentname = "images";
        }
        else
        {
          _componentname = _inputfile;

          std::string::size_type pos_slash = _componentname.find_last_of("\\/");
          std::string::size_type pos_dot = _componentname.find_last_of(".");

          // read file name extension
          if (pos_dot != std::string::npos && (pos_slash == std::string::npos || pos_slash < pos_dot))
            _extname = _componentname.substr(pos_dot + 1);
          log_debug("componentname=" << _componentname << " extname=" << _extname);

          // remove path unless disabled
          if (!_keepPath &&  pos_slash != std::string::npos)
              _componentname.erase(0, pos_slash + 1);
          log_debug("componentname(1)=" << _componentname);

          // remove extension .ecpp
          bool ecpp = _componentname.size() >= 4 && _componentname.compare(_componentname.size() - 5, 5, ".ecpp") == 0;
          if (ecpp)
            _componentname.erase(_componentname.size() - 5);
          log_debug("componentname(2)=" << _componentname << " ecpp=" << ecpp);

          if (_ofile.empty() && !_generateDependencies)
          {
            _ofile = _inputfile;
            if (ecpp)
              _ofile.erase(_ofile.size() - 5);
            _ofile += ".cpp";
          }
          log_debug("ofile=" << _ofile);

          if (_componentname.empty())
          {
            std::cerr << "cannot derive component name from filename. Use -n" << std::endl;
            return -1;
          }
        }
      }

      if (_ofile.empty() && !_generateDependencies)
        _ofile = _componentname;

      if (_generateDependencies)
        return runDependencies();
      else
        return runGenerator();
    }
Exemple #2
0
int Ecppc::run()
{
    // requestname from inputfilename
    if (requestname.empty())
    {
        if (multibinary)
        {
            std::cerr << "warning: no requestname passed (with -n) - using \"images\"" << std::endl;
            requestname = "images";
        }
        else
        {
            std::string input = inputfile;
            std::string::size_type pos_dot = input.find_last_of(".");
            if (pos_dot != std::string::npos)
            {
                std::string::size_type pos_slash;
                if (keepPath || (pos_slash = input.find_last_of("\\/")) == std::string::npos)
                    requestname = input.substr(0, pos_dot);
                else if (pos_slash < pos_dot)
                    requestname = input.substr(pos_slash + 1, pos_dot - pos_slash - 1);

                if (ofile.empty() && !generateDependencies)
                    ofile = input.substr(0, pos_dot);

                extname = input.substr(pos_dot + 1);
            }
            else
            {
                requestname = input;
            }

            if (requestname.empty())
            {
                std::cerr << "cannot derive component name from filename. Use -n" << std::endl;
                return -1;
            }
        }
    }

    if (ofile.empty() && !generateDependencies)
        ofile = requestname;

    if (generateDependencies)
        return runDependencies();
    else
        return runGenerator();
}
Exemple #3
0
int
xsdEngineRun (xmlNodePtr xsdNode, const char *destDir)
{


  xsdSetDestDir (destDir);

  if (xsdNode != NULL)
  {
    runGenerator (xsdNode);
    objRegistryEnumComplexType (declareStructs);
    objRegistryEnumComplexType (writeSource);
  }


  return 0;
}