Ejemplo n.º 1
0
/*! Create all resources from XML string
 */
void CreateFromXML( const std::string &xml_sring, const std::string &source )
{
    XMLDocument _xml( xml_sring, source);
    for ( XMLIterator i=_xml.Root().StepInto(); !!i; ++i )
    {
        const std::string name = (*i)._name;

        if ( name == "include")
        {
            std::string oldPath;
            std::string newPath;
            if ( try_attribute( (*i)._attributes, "chroot", &newPath ))
            {   
                int brOpen = newPath.find("$(", 0 );
                if ( -1 != brOpen )
                {
                    int brClose = newPath.find(")", brOpen+2 );
                    if ( -1 != brClose )
                    {
                        std::string envName = newPath.substr( brOpen+2, brClose-( brOpen+2 ));
                        const char *cEnv = getenv( envName.c_str() );
                        if (! cEnv )
                        {
                            throw Error("$(%s) is not set.", envName.c_str() );
                        }
                        newPath = newPath.substr( 0, brOpen ) + cEnv + newPath.substr( brClose+1, -1 );
                    }
                }
                if ( !IFS::Instance().IsDir( newPath ))
                {
                    throw Error("\"%s\" is not directory.", newPath.c_str());
                }

                char cwd[_MAX_PATH];
                _getcwd( cwd, _MAX_PATH );
                oldPath = cwd;
                _chdir( newPath.c_str() );
            }
            std::string src = get_attribute( (*i)._attributes, "src");
            if ( s_includedFiles.insert( src ).second )
            {
                CreateFromXMLFile( src );
            }
            if ( !oldPath.empty() )
            {
                _chdir( oldPath.c_str() );
            }
        }
        else
        {
            CategoryFromXML( name, i );
        }
    }
}
Ejemplo n.º 2
0
// ============================================================================
StatusCode Gaudi::Utils::Histos::fromXml
( TProfile2D*& result , const std::string& input )
{
  if ( 0 != result ) { return fromXml ( *result , input ) ; }
  //
  _Xml<TProfile2D> _xml ;
  std::auto_ptr<TProfile2D> histo = _xml ( input ) ;
  if ( 0 == histo.get() ) { return StatusCode::FAILURE ; }       // RETURN
  //
  result = histo.release() ;                                     // ASSIGN
  //
  return StatusCode::SUCCESS ;
}
Ejemplo n.º 3
0
std::string CSvnController::log(const std::string& strURL, int nLimit, bool bXML, bool bVerbose)
{
	std::string _log;
	_log += log(strURL);
	_log += _limit(nLimit);

	if (bXML)
		_log += _xml();

	if (bVerbose)
		_log += _verbose();

	return _log;
	//return dispatchToString(_log);
}
Ejemplo n.º 4
0
std::string CSvnController::log(const std::string& strURL, bool bXML, bool bVerbose, int nStartRev, int nEndRev)
{
	std::string _log;
	_log += log(strURL);
	_log += _revision(nStartRev, nEndRev);

	if (bXML)
		_log += _xml();

	if (bVerbose)
		_log += _verbose();

	return _log;
	//return dispatchToString(_log);
}
Ejemplo n.º 5
0
// ============================================================================
StatusCode Gaudi::Utils::Histos::fromXml
( TProfile2D& result , const std::string& input )
{
  //
  result.Reset() ;                                 // RESET old histogram
  //
  _Xml<TProfile2D> _xml ;
  std::auto_ptr<TProfile2D> histo = _xml ( input ) ;
  if ( 0 == histo.get() ) { return StatusCode::FAILURE ; }        // RETURN
  //
  result.Reset() ;
  histo->Copy ( result ) ;
  //
  return StatusCode::SUCCESS ;
}
Ejemplo n.º 6
0
std::string CSvnController::log(const std::string& strURL, bool bXML, bool bVerbose, const std::vector<int>& vecRevisions)
{
	std::string _log;
	_log += log(strURL);

	for (unsigned int i = 0; i < vecRevisions.size(); ++i)
		_log += _revision(vecRevisions[i]);

	if (bXML)
		_log += _xml();

	if (bVerbose)
		_log += _verbose();

	return _log;
}
Ejemplo n.º 7
0
string XParam::xml(bool show_runtime, const int &indent, bool with_endl) const
{
	string endl = (with_endl) ? "\n" : "";
	return _xml(show_runtime, indent, endl);
}