Ejemplo n.º 1
0
ValidationRule::Params  ValidateCommand :: ReadParams(
											const string & line,
											unsigned int & pos ) const {
	ValidationRule::Params params;
	while( 	SkipSpaces( line, pos ) ) {
		char c = line[pos];
		if ( c == '\'' || c == '"' ) {
			ReadQuotedString( params, line, pos );
		}
		else {
			ReadWSTermString( params, line, pos );
		}
	}

	return params;
}
int CConfigurationFileSettingsDataAsciiIO::ReadFile( std::ifstream &stream )
{
int result;
std::string tokenid;

int entry_newconfigflag;
std::string entry_configsettingsfile;
int entry_autoreadheaderflags;
int entry_autoloadconfigflags;
int entry_autosaveconfigflags;

result = true;

if ( g_verbose )
	{
	ctrace << "Reading CConfigurationFileSettingsDataAsciiIO" << std::endl;
	}

while ( ReadOpenClosePar( stream ) != 0 )
	{
	ReadString( stream, tokenid );

	if ( g_verbose > 1 )
		{
		std::cout << "Read Token = <" << tokenid << ">\n";
		}

	switch( token_match( tokenid, token_list, token_num ) )
		{
		case TOKEN_NEWCONFIGFLAG:
			ReadInteger( stream, entry_newconfigflag );
			m_newconfigflag = entry_newconfigflag;

			if ( g_verbose )
				{
				std::cout << "Read <newconfigflag> = <" << entry_newconfigflag << ">\n";
				}
			break;

		case TOKEN_CONFIGSETTINGSFILE:
			ReadQuotedString( stream, entry_configsettingsfile );
			m_configfile = entry_configsettingsfile;

			if ( g_verbose )
				{
				std::cout << "Read <configsettingsfile> = <" << entry_configsettingsfile << ">\n";
				}
			break;

		case TOKEN_AUTOREADHEADERFLAGS:
			ReadInteger( stream, entry_autoreadheaderflags );
			m_autoreadheaderflags = entry_autoreadheaderflags;

			if ( g_verbose )
				{
				std::cout << "Read <autoreadheaderflags> = <" << entry_autoreadheaderflags << ">\n";
				}
			break;

		case TOKEN_AUTOLOADCONFIGFLAGS:
			ReadInteger( stream, entry_autoloadconfigflags );
			m_autoloadconfigflags = entry_autoloadconfigflags;

			if ( g_verbose )
				{
				std::cout << "Read <autoloadconfigflags> = <" << entry_autoloadconfigflags << ">\n";
				}
			break;

		case TOKEN_AUTOSAVECONFIGFLAGS:
			ReadInteger( stream, entry_autosaveconfigflags );
			m_autosaveconfigflags = entry_autosaveconfigflags;

			if ( g_verbose )
				{
				std::cout << "Read <autosaveconfigflags> = <" << entry_autosaveconfigflags << ">\n";
				}
			break;

		default:
			std::cout << "CConfigurationFileSettingsIO::Unknown token <" << tokenid << ">\n";
			break;
		}

	ReadClosePar( stream );
	}

stream.putback( '}' );

if ( g_verbose )
	{
	std::cout << "Reading complete." << std::endl << std::endl;
	}

return result;
}
int CExtensionSiteInfoIODataAsciiIO::ReadFile( std::ifstream &stream )
{
int result;
std::string tokenid;

std::string entry_description;
std::string entry_indexdirlocal;
std::string entry_indexpagenet;
std::string entry_indexpagelocal;
std::string entry_glheadernet;
std::string entry_glheaderlocal;
std::string entry_glxheadernet;
std::string entry_glxheaderlocal;
std::string entry_wglheadernet;
std::string entry_wglheaderlocal;
std::string entry_coreheadernet;
std::string entry_coreheaderlocal;
int entry_downloadflags;
std::string entry_filetypefilters;

result = true;


if ( g_verbose )
	{
	std::cout << "Reading CExtensionSiteInfoIODataAsciiIO" << std::endl;
	}

while ( ReadOpenClosePar( stream ) != 0 )
	{
	ReadString( stream, tokenid );

	if ( g_verbose > 1 )
		{
		std::cout << "Read Token = <" << tokenid << ">\n";
		}

	switch( token_match( tokenid, token_list, token_num ) )
		{
		case TOKEN_DESCRIPTION:
			ReadQuotedString( stream, entry_description );
			m_description = entry_description;

			if ( g_verbose )
				{
				std::cout << "Read <description> = <" << entry_description << ">\n";
				}
			break;

		case TOKEN_INDEXDIRLOCAL:
			ReadQuotedString( stream, entry_indexdirlocal );
			m_indexdirlocal = entry_indexdirlocal;

			if ( g_verbose )
				{
				std::cout << "Read <indexdirlocal> = <" << entry_indexdirlocal << ">\n";
				}
			break;

		case TOKEN_INDEXPAGENET:
			ReadQuotedString( stream, entry_indexpagenet );
			m_indexpagenet = entry_indexpagenet;

			if ( g_verbose )
				{
				std::cout << "Read <indexpagenet> = <" << entry_indexpagenet << ">\n";
				}
			break;

		case TOKEN_INDEXPAGELOCAL:
			ReadQuotedString( stream, entry_indexpagelocal );
			m_indexpagelocal = entry_indexpagelocal;

			if ( g_verbose )
				{
				std::cout << "Read <indexpagelocal> = <" << entry_indexpagelocal << ">\n";
				}
			break;

		case TOKEN_GLHEADERNET:
			ReadQuotedString( stream, entry_glheadernet );
			m_glheadernet = entry_glheadernet;

			if ( g_verbose )
				{
				std::cout << "Read <glheadernet> = <" << entry_glheadernet << ">\n";
				}
			break;

		case TOKEN_GLHEADERLOCAL:
			ReadQuotedString( stream, entry_glheaderlocal );
			m_glheaderlocal = entry_glheaderlocal;

			if ( g_verbose )
				{
				std::cout << "Read <glheaderlocal> = <" << entry_glheaderlocal << ">\n";
				}
			break;

		case TOKEN_GLXHEADERNET:
			ReadQuotedString( stream, entry_glxheadernet );
			m_glxheadernet = entry_glxheadernet;

			if ( g_verbose )
				{
				std::cout << "Read <glxheadernet> = <" << entry_glxheadernet << ">\n";
				}
			break;

		case TOKEN_GLXHEADERLOCAL:
			ReadQuotedString( stream, entry_glxheaderlocal );
			m_glxheaderlocal = entry_glxheaderlocal;

			if ( g_verbose )
				{
				std::cout << "Read <glxheaderlocal> = <" << entry_glxheaderlocal << ">\n";
				}
			break;

		case TOKEN_WGLHEADERNET:
			ReadQuotedString( stream, entry_wglheadernet );
			m_wglheadernet = entry_wglheadernet;

			if ( g_verbose )
				{
				std::cout << "Read <wglheadernet> = <" << entry_wglheadernet << ">\n";
				}
			break;

		case TOKEN_WGLHEADERLOCAL:
			ReadQuotedString( stream, entry_wglheaderlocal );
			m_wglheaderlocal = entry_wglheaderlocal;

			if ( g_verbose )
				{
				std::cout << "Read <wglheaderlocal> = <" << entry_wglheaderlocal << ">\n";
				}
			break;

		case TOKEN_COREHEADERNET:
			ReadQuotedString( stream, entry_coreheadernet );
			m_coreheadernet = entry_coreheadernet;

			if ( g_verbose )
				{
				std::cout << "Read <coreheadernet> = <" << entry_coreheadernet << ">\n";
				}
			break;

		case TOKEN_COREHEADERLOCAL:
			ReadQuotedString( stream, entry_coreheaderlocal );
			m_coreheaderlocal = entry_coreheaderlocal;

			if ( g_verbose )
				{
				std::cout << "Read <coreheaderlocal> = <" << entry_coreheaderlocal << ">\n";
				}
			break;

		case TOKEN_DOWNLOADFLAGS:
			ReadInteger( stream, entry_downloadflags );
			m_downloadflags = entry_downloadflags;

			if ( g_verbose )
				{
				std::cout << "Read <downloadflags> = <" << entry_downloadflags << ">\n";
				}
			break;

		case TOKEN_FILETYPEFILTERS:
			ReadQuotedString( stream, entry_filetypefilters );
			m_filetypefilter = entry_filetypefilters;

			if ( g_verbose )
				{
				std::cout << "Read <filetypefilters> = <" << entry_filetypefilters << ">\n";
				}
			break;

		default:
			std::cout << "CExtensionSiteInfoIO::Unknown token <" << tokenid << ">\n";
			break;
		}

	ReadClosePar( stream );
	}

stream.putback( '}' );

if ( g_verbose )
	{
	std::cout << "Reading complete." << std::endl << std::endl;
	}

return( result );
}