filedef : process

Process the object through this file definition, outputing "structure" to the stream provided, and sending any errors to the console. Commands can be embedded in the structure according to the definitions in the class.

Any other method of any other object can call this method. This is called 'public' access.

The data-type returned is "booltype"; Returns true if the function is successful.

This method is contained in the object "filedef".

The method takes the following arguments:

schema : Pointer to object

Not sure.

objname : stringtype

Not sure.

C++

The files "schema/schema_object.hpp", "tgl_list_parser.hpp", "tgl_filedef_console_visitor.hpp" and "tgl_block_parser.hpp" are included.

Process a file definition. This method output's the results directly to the console rather than to a file. If the objname is "*", then all objects are processed except those in the ignoreset. Otherwise, just the object specified will be processed.

	ph::tools::schema::schema_object *root = get_root(schema, _root, _console);
	if (!root)
	{
		*_console << "Could not find object [" << _root << "] in schema." << std::endl;
		return false;
	}
	
	tgl_list_parser p;
	std::set<std::string> ignoreset;
	if (!p.parse_to_set(_ignoreobjects, &ignoreset))
	{
		*_console << "Badly formed ignoreobjects list." << std::endl;
		return false;
	}

	if (objname == "*")
	{
		tgl_filedef_console_visitor v(this, root, ignoreset, _console, _stream);
		return root->accept(&v);
	}
	else
	{
		bool descendants = false;
		std::string oname = "";
		if (objname[objname.length()-1] == '+')
		{
			oname = objname.substr(0, objname.length()-1);
			descendants = true;
		}
		else
			oname = objname;
			
		ph::tools::schema::schema_object *obj = 
			dynamic_cast<ph::tools::schema::schema_object *>(schema->findwithtype("object", oname));
		if (!obj)
		{
			*_console << "Could not find object [" << oname << "] in schema." << std::endl;
			return false;
		}
		
		// make sure that the objects ultimate superclass is actually on the root
		// that is specified.
		ph::xmlobj::xmlobj *p = obj->parent();
		while (p && p != root)
			p = p->parent();
		if (p == root)
		{
			if (descendants)
			{
				tgl_filedef_console_visitor v(this, root, ignoreset, _console, _stream);
				return obj->accept(&v);
			}
			else
			{
				tgl_block_parser parser(this, obj, false, false, 
					_stream, _console, get_path(), _filepath);
				return parser.write_output(_structure);
			}
		}
		else
			return true;
	}
	
	*_console << "Reached the end of process somehow." << std::endl;
	return false;

Generated: Thu Apr 6 00:00:44 EST 2006 using "xsltproc ... docbook.xsl". Copyright (c) 2003, 2004, 2005; Paul Hamilton; pHamtec P/L. Use, modification, and distribution is provided free of any limitations.