delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2002/03/26/23:27:04

Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm
Sender: cygwin-apps-owner AT cygwin DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT cygwin DOT com>
List-Help: <mailto:cygwin-apps-help AT cygwin DOT com>, <http://sources.redhat.com/lists.html#faqs>
Mail-Followup-To: cygwin-apps AT cygwin DOT com
Delivered-To: mailing list cygwin-apps AT cygwin DOT com
content-class: urn:content-classes:message
Subject: Command line options for setup
MIME-Version: 1.0
Date: Wed, 27 Mar 2002 15:26:51 +1100
Message-ID: <FC169E059D1A0442A04C40F86D9BA76008ABBF@itdomain003.itdomain.net.au>
X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: "Cygwin-Apps" <cygwin-apps AT sources DOT redhat DOT com>
Cc: "keith_starsmeare" <kxs AT breathemail DOT net>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g2R4R3V24463

Hi Keith, 
	I hope I haven't stolen your thunder, but I've checked into HEAD
the framework for command line options for setup. I've not used what you
put together, because it was too procedural.

Instead, we have:
GetOption - a singleton class that abstracts the getopt() mechanics.
Each option registers with it at process startup, and main() calls
GetOption::GetInstance().Process(argc, argv);

This means that main.cc is completely unaffected by addition and removal
of options.

Secondly, there is an abstract class Option that each option inherits
from (we can probably look at a template at some point). The concrete
classes need to be singletons, to ensure their registration at process
startup. (Their constructor calls
GetOption::GetInstance().Register(this);).

See desktop.h and desktop.cc for a sample option (--no-shortcuts or -n).

Anyway, this will hopefully act as a seed, and allow you (or anyone else
interested in adding command line options) to do so without having to
invent the infrastructure as well.

Cheers,
Rob

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019