15 #include "xFileTrans.h"
30 _preferred_extension =
".x";
32 set_program_brief(
"reads and writes DirectX .x files");
33 set_program_description
34 (
"This program reads a DirectX retained-mode file (.x) and writes an "
35 "essentially equivalent .x file. It is primarily useful for "
36 "debugging the X file parser that is part of the Pandatool library.");
39 add_runline(
"[opts] input.x output.x");
40 add_runline(
"[opts] -o output.x input.x");
44 "Specify the filename to which the resulting .x file will be written. "
45 "If this option is omitted, the last parameter name is taken to be the "
46 "name of the output file.",
47 &XFileTrans::dispatch_filename, &_got_output_filename, &_output_filename);
58 nout <<
"Reading " << _input_filename <<
"\n";
61 if (!file.
read(_input_filename)) {
62 nout <<
"Unable to read.\n";
67 nout <<
"Unable to write.\n";
80 if (!check_last_arg(args, 1)) {
85 nout <<
"You must specify the .x file to read on the command line.\n";
88 }
else if (args.size() != 1) {
89 nout <<
"You must specify only one .x file to read on the command line.\n";
93 _input_filename = args[0];
99 int main(
int argc,
char *argv[]) {
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
bool write(Filename filename) const
Opens the indicated filename for output and writes a parseable description of all the known distribut...
A program to read a X file and output an essentially similar X file.
bool read(Filename filename)
Opens and reads the indicated .x file by name.
This is the bare functionality (intended to be inherited from along with ProgramBase or some derivati...
ostream & get_output()
Returns an output stream that corresponds to the user's intended egg file output–either stdout...
This represents the complete contents of an X file (file.x) in memory.