Action_Thermostats
Add_AtomRandomPerturbation
Add_RotateAroundBondAction
Add_SelectAtomByNameAction
Adding_Graph_to_ChangeBondActions
Adding_MD_integration_tests
Adding_StructOpt_integration_tests
AutomationFragmentation_failures
Candidate_v1.6.0
Candidate_v1.6.1
ChangeBugEmailaddress
ChangingTestPorts
ChemicalSpaceEvaluator
Combining_Subpackages
Debian_Package_split
Debian_package_split_molecuildergui_only
Disabling_MemDebug
Docu_Python_wait
EmpiricalPotential_contain_HomologyGraph_documentation
Enable_parallel_make_install
Enhance_userguide
Enhanced_StructuralOptimization
Enhanced_StructuralOptimization_continued
Example_ManyWaysToTranslateAtom
Exclude_Hydrogens_annealWithBondGraph
FitPartialCharges_GlobalError
Fix_ChronosMutex
Fix_StatusMsg
Fix_StepWorldTime_single_argument
Fix_Verbose_Codepatterns
ForceAnnealing_goodresults
ForceAnnealing_oldresults
ForceAnnealing_tocheck
ForceAnnealing_with_BondGraph
ForceAnnealing_with_BondGraph_continued
ForceAnnealing_with_BondGraph_continued_betteresults
ForceAnnealing_with_BondGraph_contraction-expansion
GeometryObjects
Gui_displays_atomic_force_velocity
IndependentFragmentGrids_IntegrationTest
JobMarket_RobustOnKillsSegFaults
JobMarket_StableWorkerPool
JobMarket_unresolvable_hostname_fix
ODR_violation_mpqc_open
PartialCharges_OrthogonalSummation
PythonUI_with_named_parameters
QtGui_reactivate_TimeChanged_changes
Recreated_GuiChecks
RotateToPrincipalAxisSystem_UndoRedo
StoppableMakroAction
Subpackage_levmar
Subpackage_vmg
ThirdParty_MPQC_rebuilt_buildsystem
TremoloParser_IncreasedPrecision
TremoloParser_MultipleTimesteps
Ubuntu_1604_changes
stable
Rev | Line | |
---|
[0b990d] | 1 | /* $Id: GetLongOpt.h,v 2.2 2003/02/06 01:02:13 cljanss Exp $ */
|
---|
| 2 | /* S Manoharan. Advanced Computer Research Institute. Lyon. France */
|
---|
| 3 |
|
---|
| 4 | #ifdef __GNUC__
|
---|
| 5 | #pragma interface
|
---|
| 6 | #endif
|
---|
| 7 |
|
---|
| 8 | #ifndef _GetLongOpt_h_
|
---|
| 9 | #define _GetLongOpt_h_
|
---|
| 10 |
|
---|
| 11 | #include <iostream>
|
---|
| 12 | #include <string.h>
|
---|
| 13 |
|
---|
| 14 | namespace sc {
|
---|
| 15 |
|
---|
| 16 | class GetLongOpt {
|
---|
| 17 | public:
|
---|
| 18 | enum OptType {
|
---|
| 19 | NoValue, OptionalValue, MandatoryValue
|
---|
| 20 | };
|
---|
| 21 | private:
|
---|
| 22 | struct Cell {
|
---|
| 23 | const char *option; // option name
|
---|
| 24 | OptType type; // option type
|
---|
| 25 | const char *description; // a description of option
|
---|
| 26 | const char *value; // value of option (string)
|
---|
| 27 | Cell *next; // pointer to the next cell
|
---|
| 28 |
|
---|
| 29 | Cell() { option = description = value = 0; next = 0; }
|
---|
| 30 | };
|
---|
| 31 | private:
|
---|
| 32 | Cell *table; // option table
|
---|
| 33 | const char *ustring; // usage message
|
---|
| 34 | char *pname; // program basename
|
---|
| 35 | char optmarker; // option marker
|
---|
| 36 |
|
---|
| 37 | int enroll_done; // finished enrolling
|
---|
| 38 | Cell *last; // last entry in option table
|
---|
| 39 |
|
---|
| 40 | private:
|
---|
| 41 | char *basename(char * const p) const;
|
---|
| 42 | int setcell(Cell *c, const char *valtoken, const char *nexttoken, const char *p);
|
---|
| 43 | public:
|
---|
| 44 | GetLongOpt(const char optmark = '-');
|
---|
| 45 | ~GetLongOpt();
|
---|
| 46 |
|
---|
| 47 | int parse(int argc, char * const *argv);
|
---|
| 48 | int parse(char * const str, char * const p);
|
---|
| 49 |
|
---|
| 50 | int enroll(const char * const opt, const OptType t,
|
---|
| 51 | const char * const desc, const char * const val);
|
---|
| 52 | const char *retrieve(const char * const opt) const;
|
---|
| 53 |
|
---|
| 54 | void usage(std::ostream &outfile = std::cout) const;
|
---|
| 55 | void usage(const char *str) { ustring = str; }
|
---|
| 56 | };
|
---|
| 57 |
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | #endif /* _GetLongOpt_h_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.