DGD Library
Version: 0.1.0.14 | Updated: Thu Aug 10 16:59:03 2006
Home
DGD News
FAQ
Code Documentation
DGD Installation Guide
Bugs-n-Features
DGD at Sourceforge.net
Download DGD
Subversion
Code Documentation
Documentation
Namespaces
Class Hierarchy
Class List
File List
Namespace Members
Functions
Globals
Tutorial
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

dgOptionFilter.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00016 //
00017 // This file is part of Depression Glass library.
00018 //
00019 // Copyright (c) 2002. Dimitry Kloper <kloper@users.sf.net> . 
00020 //
00021 // dgOptionFilter.h -- simple class which can separate command line 
00022 //                     options into sets
00023 //
00024 
00025 #ifndef _dgOptionFilter_h_
00026 #define _dgOptionFilter_h_
00027 
00033 #include <vector>
00034 
00035 namespace DGD {
00036 
00055 class option_filter {
00056    public:
00057       class option_set_type {
00058          public:
00059 
00060             int argc;
00061             char** argv;
00062 
00063             option_set_type() : argc(0), argv(NULL) {}
00064             option_set_type( int _argc, char** _argv ) {
00065                allocate( _argc );
00066                argc = _argc;
00067                std::copy( _argv, _argv+_argc, argv );
00068             }
00069 
00070             void allocate( int n ) {
00071                argc = n;
00072                argv = new char*[ argc + 1 ];
00073                std::fill( argv, argv + argc + 1, (char*)NULL );
00074             }
00075 
00076             ~option_set_type() {
00077                if( argv ) delete [] argv;
00078             }
00079       };
00080 
00081       typedef std::vector<option_set_type> option_set_container;
00082 
00083       option_set_container* operator () ( int argc, char** argv,
00084                                           int filtc, char** filtv );
00085 };
00086 
00087 }; // end of namespace DGD
00088 
00089 #endif /* _dgOptionFilter_h_ */
00090 
00091 /* 
00092  * Local Variables:
00093  * compile-command: "make dgOptionFilter.obj"
00094  * End:
00095  */
00096 
00097 

Generated on Thu Aug 10 16:48:28 2006 for DGD Library by doxygen1.3

SourceForge.net Logo Powered by Mason Powered by Perl
Web design derived from Pasilda design found on www.oswd.org.
Copyright (c) 2002, 2003. Dimitry Kloper <kloper@users.sourceforge.net>