filedef : process

As above, but write a file out to the folder passed in. Progress messages are written to the stream.

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.

path : pathtype

Not sure.

C++

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

Process a file definition. This method output's the results directly 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_file_visitor v(this, root, path, 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_file_visitor v(this, root, path, ignoreset, _console, _stream);
				return obj->accept(&v);
			}
			else
			{
				// use the object's name if no classname specified.
				std::string classname = obj->get("classname");
				if (classname == "")
					classname = obj->name();
				
				return process(obj, make_filename(path, classname), true);
			}
		}
		else
			return true;
	}
	
	*_console << "Reached the end of process somehow." << std::endl;
	return false;

Generated: Wed Apr 5 23:54:05 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.