Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/progbase/test_prog.cxx

Go to the documentation of this file.
00001 // Filename: test_prog.cxx
00002 // Created by:  drose (14Feb00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "programBase.h"
00020 
00021 #include <notify.h>
00022 
00023 class TestProgram : public ProgramBase {
00024 public:
00025   TestProgram();
00026 
00027   bool _bool_a;
00028   int _count_b;
00029   int _int_c;
00030 };
00031 
00032 TestProgram::
00033 TestProgram() {
00034   set_program_description
00035     ("This is a simple test program to verify the effectiveness of the "
00036      "ProgramBase base class as a base class for simple programs.  It "
00037      "includes some simple options and some description strings that are "
00038      "long enough to require word-wrapping.\r"
00039      "Don't expect anything fancy, though.");
00040   add_runline("[opts]");
00041 
00042   add_option
00043     ("bog", "", 90,
00044      "This is test option 'bog'.  It is a simple boolean toggle; if it appears "
00045      "at all, it sets a boolean flag to indicate that.  If it does not "
00046      "appear, it leaves the boolean flag alone.\r"
00047      "There's not a whole lot of point to this option, when you come down "
00048      "to it.",
00049      &TestProgram::dispatch_none, &_bool_a);
00050 
00051   add_option
00052     ("b", "", 90, "Test option b",
00053      &TestProgram::dispatch_count, NULL, &_count_b);
00054   _count_b = 0;
00055 
00056   add_option
00057     ("c", "integer_parameter", 90,
00058      "This is test option 'c'.  It takes an integer parameter.",
00059      &TestProgram::dispatch_int, NULL, &_int_c);
00060   _int_c = 0;
00061 }
00062 
00063 
00064 int main(int argc, char *argv[]) {
00065   TestProgram t;
00066   t.parse_command_line(argc, argv);
00067 
00068   nout << "Executed successfully.\n"
00069        << "  _bool_a = " << t._bool_a << "\n"
00070        << "  _count_b = " << t._count_b << "\n"
00071        << "  _int_c = " << t._int_c << "\n";
00072   return 0;
00073 }

Generated on Fri May 2 03:21:31 2003 for Panda-Tool by doxygen1.3