LibMusicXML  3.18
oahBasicTypes.h
1 /*
2  MusicXML Library
3  Copyright (C) Grame 2006-2013
4 
5  This Source Code Form is subject to the terms of the Mozilla Public
6  License, v. 2.0. If a copy of the MPL was not distributed with this
7  file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10  research@grame.fr
11 */
12 
13 #ifndef ___optionsBasicTypes___
14 #define ___optionsBasicTypes___
15 
16 #include "list"
17 #include "vector"
18 #include "map"
19 #include "set"
20 
21 #include "smartpointer.h"
22 #include "rational.h"
23 
24 #include "tree_browser.h"
25 #include "visitor.h"
26 
27 #include "msrMidi.h"
28 
29 #include "utilities.h"
30 
31 #include "msrBasicTypes.h"
32 #include "lpsrBasicTypes.h"
33 
34 #include "setTraceOahIfDesired.h"
35 
36 #include "oahElements.h"
37 
38 using namespace std;
39 
40 namespace MusicXML2
41 {
42 
43 // PRE-declarations for class dependencies
44 //______________________________________________________________________________
45 class oahValuedAtom;
46 typedef SMARTP<oahValuedAtom> S_oahValuedAtom;
47 
48 class oahSubGroup;
49 typedef SMARTP<oahSubGroup> S_oahSubGroup;
50 
51 class oahGroup;
52 typedef SMARTP<oahGroup> S_oahGroup;
53 
54 class EXP oahHandler;
55 typedef SMARTP<oahHandler> S_oahHandler;
56 
57 //______________________________________________________________________________
58 class oahAtom : public oahElement
59 {
60  public:
61 
62  // creation
63  // ------------------------------------------------------
64 
65  static SMARTP<oahAtom> create (
66  string shortName,
67  string longName,
68  string description);
69 
70  protected:
71 
72  // constructors/destructor
73  // ------------------------------------------------------
74 
75  oahAtom (
76  string shortName,
77  string longName,
78  string description);
79 
80  virtual ~oahAtom ();
81 
82  public:
83 
84  // set and get
85  // ------------------------------------------------------
86 
87  void setSubGroupUpLink (
88  S_oahSubGroup subGroup);
89 
90  S_oahSubGroup getSubGroupUpLink () const
91  { return fSubGroupUpLink; }
92 
93  public:
94 
95  // services
96  // ------------------------------------------------------
97 
98  void registerAtomInHandler (
99  S_oahHandler handler);
100 
101  public:
102 
103  // visitors
104  // ------------------------------------------------------
105 
106  virtual void acceptIn (basevisitor* v);
107  virtual void acceptOut (basevisitor* v);
108 
109  virtual void browseData (basevisitor* v);
110 
111  public:
112 
113  // print
114  // ------------------------------------------------------
115 
116  void print (ostream& os) const;
117 
118  virtual void printAtomOptionsValues (
119  ostream& os,
120  int valueFieldWidth) const;
121 
122  protected:
123 
124  // fields
125  // ------------------------------------------------------
126 
127  S_oahSubGroup fSubGroupUpLink;
128 };
129 typedef SMARTP<oahAtom> S_oahAtom;
130 EXP ostream& operator<< (ostream& os, const S_oahAtom& elt);
131 
132 //______________________________________________________________________________
133 class oahAtomSynonym : public oahAtom
134 {
135  public:
136 
137  // creation
138  // ------------------------------------------------------
139 
140  static SMARTP<oahAtomSynonym> create (
141  string shortName,
142  string longName,
143  string description,
144  S_oahAtom originalOahAtom);
145 
146  protected:
147 
148  // constructors/destructor
149  // ------------------------------------------------------
150 
152  string shortName,
153  string longName,
154  string description,
155  S_oahAtom originalOahAtom);
156 
157  virtual ~oahAtomSynonym ();
158 
159  public:
160 
161  // set and get
162  // ------------------------------------------------------
163 
164  S_oahAtom getOriginalOahAtom () const
165  { return fOriginalOahAtom; }
166 
167  public:
168 
169  // services
170  // ------------------------------------------------------
171 
172  public:
173 
174  // visitors
175  // ------------------------------------------------------
176 
177  virtual void acceptIn (basevisitor* v);
178  virtual void acceptOut (basevisitor* v);
179 
180  virtual void browseData (basevisitor* v);
181 
182  public:
183 
184  // print
185  // ------------------------------------------------------
186 
187  void print (ostream& os) const;
188 
189  void printAtomOptionsValues (
190  ostream& os,
191  int valueFieldWidth) const;
192 
193  private:
194 
195  // fields
196  // ------------------------------------------------------
197 
198  S_oahAtom fOriginalOahAtom;
199 };
201 EXP ostream& operator<< (ostream& os, const S_oahAtomSynonym& elt);
202 
203 //______________________________________________________________________________
205 {
206  public:
207 
208  // creation
209  // ------------------------------------------------------
210 
211  static SMARTP<oahOptionsUsageAtom> create (
212  string shortName,
213  string longName,
214  string description);
215 
216  protected:
217 
218  // constructors/destructor
219  // ------------------------------------------------------
220 
222  string shortName,
223  string longName,
224  string description);
225 
226  virtual ~oahOptionsUsageAtom ();
227 
228  public:
229 
230  // set and get
231  // ------------------------------------------------------
232 
233  public:
234 
235  // services
236  // ------------------------------------------------------
237 
238  S_oahValuedAtom handleOptionUnderName (
239  string optionName,
240  ostream& os);
241 
242  public:
243 
244  // visitors
245  // ------------------------------------------------------
246 
247  virtual void acceptIn (basevisitor* v);
248  virtual void acceptOut (basevisitor* v);
249 
250  virtual void browseData (basevisitor* v);
251 
252  public:
253 
254  // print
255  // ------------------------------------------------------
256 
257  void print (ostream& os) const;
258 
259 // void printOptionsUsage (ostream& os) const;
260 
261  void printAtomOptionsValues (
262  ostream& os,
263  int valueFieldWidth) const;
264 
265  private:
266 
267  // fields
268  // ------------------------------------------------------
269 };
271 EXP ostream& operator<< (ostream& os, const S_oahOptionsUsageAtom& elt);
272 
273 //______________________________________________________________________________
275 {
276  public:
277 
278  // creation
279  // ------------------------------------------------------
280 
281  static SMARTP<oahOptionsSummaryAtom> create (
282  string shortName,
283  string longName,
284  string description);
285 
286  protected:
287 
288  // constructors/destructor
289  // ------------------------------------------------------
290 
292  string shortName,
293  string longName,
294  string description);
295 
296  virtual ~oahOptionsSummaryAtom ();
297 
298  public:
299 
300  // set and get
301  // ------------------------------------------------------
302 
303  public:
304 
305  // services
306  // ------------------------------------------------------
307 
308  S_oahValuedAtom handleOptionUnderName (
309  string optionName,
310  ostream& os);
311 
312  public:
313 
314  // visitors
315  // ------------------------------------------------------
316 
317  virtual void acceptIn (basevisitor* v);
318  virtual void acceptOut (basevisitor* v);
319 
320  virtual void browseData (basevisitor* v);
321 
322  public:
323 
324  // print
325  // ------------------------------------------------------
326 
327  void print (ostream& os) const;
328 
329  void printOptionsSummary (ostream& os) const;
330 
331  void printAtomOptionsValues (
332  ostream& os,
333  int valueFieldWidth) const;
334 
335  private:
336 
337  // fields
338  // ------------------------------------------------------
339 };
341 EXP ostream& operator<< (ostream& os, const S_oahOptionsSummaryAtom& elt);
342 
343 //______________________________________________________________________________
345 {
346  public:
347 
348  // creation
349  // ------------------------------------------------------
350 
351  static SMARTP<oahAtomWithVariableName> create (
352  string shortName,
353  string longName,
354  string description,
355  string variableName);
356 
357  protected:
358 
359  // constructors/destructor
360  // ------------------------------------------------------
361 
363  string shortName,
364  string longName,
365  string description,
366  string variableName);
367 
368  virtual ~oahAtomWithVariableName ();
369 
370  public:
371 
372  // set and get
373  // ------------------------------------------------------
374 
375  string getVariableName () const
376  { return fVariableName; }
377 
378  public:
379 
380  // services
381  // ------------------------------------------------------
382 
383  virtual int fetchVariableNameLength () const
384  { return fVariableName.size (); }
385 
386  public:
387 
388  // visitors
389  // ------------------------------------------------------
390 
391  virtual void acceptIn (basevisitor* v);
392  virtual void acceptOut (basevisitor* v);
393 
394  virtual void browseData (basevisitor* v);
395 
396  public:
397 
398  // print
399  // ------------------------------------------------------
400 
401  void print (ostream& os) const;
402 
403  void printAtomOptionsValues (
404  ostream& os,
405  int valueFieldWidth) const;
406 
407  protected:
408 
409  // fields
410  // ------------------------------------------------------
411 
412  string fVariableName;
413 };
415 EXP ostream& operator<< (ostream& os, const S_oahAtomWithVariableName& elt);
416 
417 //______________________________________________________________________________
419 {
420  public:
421 
422  // creation
423  // ------------------------------------------------------
424 
425  static SMARTP<oahBooleanAtom> create (
426  string shortName,
427  string longName,
428  string description,
429  string variableName,
430  bool& booleanVariable);
431 
432  protected:
433 
434  // constructors/destructor
435  // ------------------------------------------------------
436 
438  string shortName,
439  string longName,
440  string description,
441  string variableName,
442  bool& booleanVariable);
443 
444  virtual ~oahBooleanAtom ();
445 
446  public:
447 
448  // set and get
449  // ------------------------------------------------------
450 
451  void setBooleanVariable (
452  bool value)
453  { fBooleanVariable = value; }
454 
455  public:
456 
457  // services
458  // ------------------------------------------------------
459 
460  S_oahValuedAtom handleOptionUnderName (
461  string optionName,
462  ostream& os);
463 
464  public:
465 
466  // visitors
467  // ------------------------------------------------------
468 
469  virtual void acceptIn (basevisitor* v);
470  virtual void acceptOut (basevisitor* v);
471 
472  virtual void browseData (basevisitor* v);
473 
474  public:
475 
476  // print
477  // ------------------------------------------------------
478 
479  void print (ostream& os) const;
480 
481  void printAtomOptionsValues (
482  ostream& os,
483  int valueFieldWidth) const;
484 
485  protected:
486 
487  // fields
488  // ------------------------------------------------------
489 
490  bool& fBooleanVariable;
491 };
493 EXP ostream& operator<< (ostream& os, const S_oahBooleanAtom& elt);
494 
495 //______________________________________________________________________________
497 {
498  public:
499 
500  // creation
501  // ------------------------------------------------------
502 
503  static SMARTP<oahTwoBooleansAtom> create (
504  string shortName,
505  string longName,
506  string description,
507  string variableName,
508  bool& booleanVariable,
509  bool& booleanSecondaryVariable);
510 
511  protected:
512 
513  // constructors/destructor
514  // ------------------------------------------------------
515 
517  string shortName,
518  string longName,
519  string description,
520  string variableName,
521  bool& booleanVariable,
522  bool& booleanSecondaryVariable);
523 
524  virtual ~oahTwoBooleansAtom ();
525 
526  public:
527 
528  // set and get
529  // ------------------------------------------------------
530 
531  void setTwoBooleansVariables (
532  bool value)
533  {
534  fBooleanVariable =
535  value;
536  fBooleanSecondaryVariable =
537  value;
538  }
539 
540  public:
541 
542  // services
543  // ------------------------------------------------------
544 
545  S_oahValuedAtom handleOptionUnderName (
546  string optionName,
547  ostream& os);
548 
549  public:
550 
551  // visitors
552  // ------------------------------------------------------
553 
554  virtual void acceptIn (basevisitor* v);
555  virtual void acceptOut (basevisitor* v);
556 
557  virtual void browseData (basevisitor* v);
558 
559  public:
560 
561  // print
562  // ------------------------------------------------------
563 
564  void print (ostream& os) const;
565 
566  void printAtomOptionsValues (
567  ostream& os,
568  int valueFieldWidth) const;
569 
570  private:
571 
572  // fields
573  // ------------------------------------------------------
574 
575  bool& fBooleanSecondaryVariable;
576 };
578 EXP ostream& operator<< (ostream& os, const S_oahTwoBooleansAtom& elt);
579 
580 //______________________________________________________________________________
582 {
583  public:
584 
585  // creation
586  // ------------------------------------------------------
587 
588  static SMARTP<oahThreeBooleansAtom> create (
589  string shortName,
590  string longName,
591  string description,
592  string variableName,
593  bool& booleanVariable,
594  bool& booleanSecondaryVariable,
595  bool& booleanTertiaryVariable);
596 
597  protected:
598 
599  // constructors/destructor
600  // ------------------------------------------------------
601 
603  string shortName,
604  string longName,
605  string description,
606  string variableName,
607  bool& booleanVariable,
608  bool& booleanSecondaryVariable,
609  bool& booleanTertiaryVariable);
610 
611  virtual ~oahThreeBooleansAtom ();
612 
613  public:
614 
615  // set and get
616  // ------------------------------------------------------
617 
618  void setThreeBooleansVariables (
619  bool value)
620  {
621  fBooleanVariable =
622  value;
623  fBooleanSecondaryVariable =
624  value;
625  fBooleanTertiaryVariable =
626  value;
627  }
628 
629  public:
630 
631  // services
632  // ------------------------------------------------------
633 
634  S_oahValuedAtom handleOptionUnderName (
635  string optionName,
636  ostream& os);
637 
638  public:
639 
640  // visitors
641  // ------------------------------------------------------
642 
643  virtual void acceptIn (basevisitor* v);
644  virtual void acceptOut (basevisitor* v);
645 
646  virtual void browseData (basevisitor* v);
647 
648  public:
649 
650  // print
651  // ------------------------------------------------------
652 
653  void print (ostream& os) const;
654 
655  void printAtomOptionsValues (
656  ostream& os,
657  int valueFieldWidth) const;
658 
659  private:
660 
661  // fields
662  // ------------------------------------------------------
663 
664  bool& fBooleanSecondaryVariable;
665  bool& fBooleanTertiaryVariable;
666 };
668 EXP ostream& operator<< (ostream& os, const S_oahThreeBooleansAtom& elt);
669 
670 //______________________________________________________________________________
672 {
673  public:
674 
675  // creation
676  // ------------------------------------------------------
677 
678  static SMARTP<oahCombinedBooleansAtom> create (
679  string shortName,
680  string longName,
681  string description,
682  string variableName,
683  bool& booleanVariable);
684 
685  protected:
686 
687  // constructors/destructor
688  // ------------------------------------------------------
689 
691  string shortName,
692  string longName,
693  string description,
694  string variableName,
695  bool& booleanVariable);
696 
697  virtual ~oahCombinedBooleansAtom ();
698 
699  public:
700 
701  // set and get
702  // ------------------------------------------------------
703 
704  const list<S_oahBooleanAtom>&
705  getBooleanAtomsList ()
706  { return fBooleanAtomsList; }
707 
708  // services
709  // ------------------------------------------------------
710 
711  void addBooleanAtom (
712  S_oahBooleanAtom booleanAtom);
713 
714  void addBooleanAtomByName (
715  string name);
716 
717  void setCombinedBooleanVariables (
718  bool value);
719 
720  S_oahValuedAtom handleOptionUnderName (
721  string optionName,
722  ostream& os);
723 
724  public:
725 
726  // visitors
727  // ------------------------------------------------------
728 
729  virtual void acceptIn (basevisitor* v);
730  virtual void acceptOut (basevisitor* v);
731 
732  virtual void browseData (basevisitor* v);
733 
734  public:
735 
736  // print
737  // ------------------------------------------------------
738 
739  void print (ostream& os) const;
740 
741  void printHelp (ostream& os);
742 
743  void printAtomOptionsValues (
744  ostream& os,
745  int valueFieldWidth) const;
746 
747  private:
748 
749  // fields
750  // ------------------------------------------------------
751 
752  bool& fBooleanVariable;
753 
754  list<S_oahBooleanAtom>
755  fBooleanAtomsList;
756 };
758 EXP ostream& operator<< (ostream& os, const S_oahCombinedBooleansAtom& elt);
759 
760 //______________________________________________________________________________
761 class oahPrefix;
763 
764 class oahPrefix : public smartable
765 /*
766 An options prefix 'trace' --> 'trace-' allows:
767  -trace=abc,def,gh
768 to be developped into :
769  -trace-abc -trace-def -trace-gh
770 */
771 {
772  public:
773 
774  // creation
775  // ------------------------------------------------------
776 
777  static SMARTP<oahPrefix> create (
778  string prefixName,
779  string prefixErsatz,
780  string prefixDescription);
781 
782  protected:
783 
784  // constructors/destructor
785  // ------------------------------------------------------
786 
787  oahPrefix (
788  string prefixName,
789  string prefixErsatz,
790  string prefixDescription);
791 
792  virtual ~oahPrefix ();
793 
794  public:
795 
796  // set and get
797  // ------------------------------------------------------
798 
799  string getPrefixName () const
800  { return fPrefixName; }
801 
802  string getPrefixErsatz () const
803  { return fPrefixErsatz; }
804 
805  string getPrefixDescription () const
806  { return fPrefixDescription; }
807 
808  public:
809 
810  // public services
811  // ------------------------------------------------------
812 
813  private:
814 
815  // private services
816  // ------------------------------------------------------
817 
818  string prefixNames () const;
819  string prefixNamesInColumns (
820  int subGroupsShortNameFieldWidth) const;
821 
822  string prefixNamesBetweenParentheses () const;
823  string prefixNamesInColumnsBetweenParentheses (
824  int subGroupsShortNameFieldWidth) const;
825 
826  string operator () () const
827  { return fPrefixErsatz; }
828 
829  public:
830 
831  // visitors
832  // ------------------------------------------------------
833 
834  virtual void acceptIn (basevisitor* v);
835  virtual void acceptOut (basevisitor* v);
836 
837  virtual void browseData (basevisitor* v);
838 
839  public:
840 
841  // print
842  // ------------------------------------------------------
843 
844  virtual void printPrefixHeader (ostream& os) const;
845 
846  virtual void printPrefixEssentials (
847  ostream& os,
848  int fieldWidth) const;
849 
850  virtual void print (ostream& os) const;
851 
852  virtual void printHelp (ostream& os);
853 
854  protected:
855 
856  // fields
857  // ------------------------------------------------------
858 
859  string fPrefixName;
860  string fPrefixErsatz;
861  string fPrefixDescription;
862 };
863 EXP ostream& operator<< (ostream& os, const S_oahPrefix& elt);
864 
865 //______________________________________________________________________________
867 {
868  public:
869 
870  // creation
871  // ------------------------------------------------------
872 
873  static SMARTP<oahMultiplexBooleansAtom> create (
874  string description,
875  string shortSuffixDescriptor,
876  string longSuffixDescriptor,
877  S_oahPrefix shortNamesPrefix,
878  S_oahPrefix longNamesPrefix);
879 
880  protected:
881 
882  // constructors/destructor
883  // ------------------------------------------------------
884 
886  string description,
887  string shortSuffixDescriptor,
888  string longSuffixDescriptor,
889  S_oahPrefix shortNamesPrefix,
890  S_oahPrefix longNamesPrefix);
891 
892  virtual ~oahMultiplexBooleansAtom ();
893 
894  public:
895 
896  // set and get
897  // ------------------------------------------------------
898 
899  const list<S_oahBooleanAtom>&
900  getBooleanAtomsList ()
901  { return fBooleanAtomsList; }
902 
903  // services
904  // ------------------------------------------------------
905 
906  void addBooleanAtom (
907  S_oahBooleanAtom booleanAtom);
908 
909  void addBooleanAtomByName (
910  string name);
911 
912  S_oahValuedAtom handleOptionUnderName (
913  string optionName,
914  ostream& os);
915 
916  public:
917 
918  // visitors
919  // ------------------------------------------------------
920 
921  virtual void acceptIn (basevisitor* v);
922  virtual void acceptOut (basevisitor* v);
923 
924  virtual void browseData (basevisitor* v);
925 
926  public:
927 
928  // print
929  // ------------------------------------------------------
930 
931  void print (ostream& os) const;
932 
933  void printHelp (ostream& os);
934 
935  void printAtomOptionsValues (
936  ostream& os,
937  int valueFieldWidth) const;
938 
939  private:
940 
941  // fields
942  // ------------------------------------------------------
943 
944  S_oahPrefix fShortNamesPrefix;
945  S_oahPrefix fLongNamesPrefix;
946 
947  string fShortSuffixDescriptor;
948  string fLongSuffixDescriptor;
949 
950  list<S_oahBooleanAtom>
951  fBooleanAtomsList;
952 
953  string fShortNamesPrefixName;
954  string fLongNamesPrefixName;
955 
956  list<string> fShortNamesSuffixes;
957  list<string> fLongNamesSuffixes;
958 };
960 EXP ostream& operator<< (ostream& os, const S_oahMultiplexBooleansAtom& elt);
961 
962 //______________________________________________________________________________
964 {
965  public:
966 
967  // data types
968  // ------------------------------------------------------
969 
970  enum oahValuedAtomKind { // JMI ???
971  kAtomHasNoArgument,
972  kAtomHasARequiredArgument,
973  kAtomHasAnOptionsArgument };
974 
975  static string oahAtomKindAsString (
976  oahValuedAtomKind oahAtomKind);
977 
978  // creation
979  // ------------------------------------------------------
980 
981  static SMARTP<oahValuedAtom> create (
982  string shortName,
983  string longName,
984  string description,
985  string valueSpecification,
986  string variableName);
987 
988  protected:
989 
990  // constructors/destructor
991  // ------------------------------------------------------
992 
993  oahValuedAtom (
994  string shortName,
995  string longName,
996  string description,
997  string valueSpecification,
998  string variableName);
999 
1000  virtual ~oahValuedAtom ();
1001 
1002  public:
1003 
1004  // set and get
1005  // ------------------------------------------------------
1006 
1007  oahValuedAtomKind
1008  getValuedAtomKind () const
1009  { return fValuedAtomKind; }
1010 
1011  string getValueSpecification () const
1012  { return fValueSpecification; }
1013 
1014  void setValueIsOptional ();
1015 
1016  bool getValueIsOptional () const
1017  { return fValueIsOptional; }
1018 
1019  public:
1020 
1021  // services
1022  // ------------------------------------------------------
1023 
1024  virtual void handleValue (
1025  string theString,
1026  ostream& os) = 0;
1027 
1028  virtual void handleDefaultValue ();
1029  // used only if fValueIsOptional is true
1030 
1031  public:
1032 
1033  // visitors
1034  // ------------------------------------------------------
1035 
1036  virtual void acceptIn (basevisitor* v);
1037  virtual void acceptOut (basevisitor* v);
1038 
1039  virtual void browseData (basevisitor* v);
1040 
1041  public:
1042 
1043  // print
1044  // ------------------------------------------------------
1045 
1046  virtual void printValuedAtomEssentials (
1047  ostream& os,
1048  int fieldWidth) const;
1049 
1050  void print (ostream& os) const;
1051 
1052  void printHelp (ostream& os);
1053 
1054  virtual void printAtomOptionsValues (
1055  ostream& os,
1056  int valueFieldWidth) const;
1057 
1058  protected:
1059 
1060  // fields
1061  // ------------------------------------------------------
1062 
1063  oahValuedAtomKind fValuedAtomKind; // JMI
1064 
1065  string fValueSpecification;
1066 
1067  bool fValueIsOptional;
1068 };
1070 EXP ostream& operator<< (ostream& os, const S_oahValuedAtom& elt);
1071 
1072 // optional values style
1073 //______________________________________________________________________________
1074 enum oahOptionalValuesStyleKind {
1075  kOptionalValuesStyleGNU, // default value
1076  kOptionalValuesStyleOAH };
1077 
1078 string oahOptionalValuesStyleKindAsString (
1079  oahOptionalValuesStyleKind optionalValuesStyleKind);
1080 
1081 extern map<string, oahOptionalValuesStyleKind>
1082  gOahOptionalValuesStyleKindsMap;
1083 
1084 string existingOahOptionalValuesStyleKinds (int namesListMaxLength);
1085 
1086 void initializeOahOptionalValuesStyleKindsMap ();
1087 
1088 //______________________________________________________________________________
1090 {
1091  public:
1092 
1093  // creation
1094  // ------------------------------------------------------
1095 
1096  static SMARTP<oahIntegerAtom> create (
1097  string shortName,
1098  string longName,
1099  string description,
1100  string valueSpecification,
1101  string variableName,
1102  int& integerVariable);
1103 
1104  protected:
1105 
1106  // constructors/destructor
1107  // ------------------------------------------------------
1108 
1109  oahIntegerAtom (
1110  string shortName,
1111  string longName,
1112  string description,
1113  string valueSpecification,
1114  string variableName,
1115  int& integerVariable);
1116 
1117  protected:
1118 
1119 
1120  virtual ~oahIntegerAtom ();
1121 
1122  public:
1123 
1124  // set and get
1125  // ------------------------------------------------------
1126 
1127  void setIntegerVariable (
1128  int value)
1129  { fIntegerVariable = value; }
1130 
1131  public:
1132 
1133  // services
1134  // ------------------------------------------------------
1135 
1136  S_oahValuedAtom handleOptionUnderName (
1137  string optionName,
1138  ostream& os);
1139 
1140  void handleValue (
1141  string theString,
1142  ostream& os);
1143 
1144  public:
1145 
1146  // visitors
1147  // ------------------------------------------------------
1148 
1149  virtual void acceptIn (basevisitor* v);
1150  virtual void acceptOut (basevisitor* v);
1151 
1152  virtual void browseData (basevisitor* v);
1153 
1154  public:
1155 
1156  // print
1157  // ------------------------------------------------------
1158 
1159  string asShortNamedOptionString () const;
1160  string asActualLongNamedOptionString () const;
1161 
1162  void print (ostream& os) const;
1163 
1164  void printAtomOptionsValues (
1165  ostream& os,
1166  int valueFieldWidth) const;
1167  protected:
1168 
1169  // fields
1170  // ------------------------------------------------------
1171 
1172  int& fIntegerVariable;
1173 };
1175 EXP ostream& operator<< (ostream& os, const S_oahIntegerAtom& elt);
1176 
1177 //______________________________________________________________________________
1179 {
1180  public:
1181 
1182  // creation
1183  // ------------------------------------------------------
1184 
1185  static SMARTP<oahTwoIntegersAtom> create (
1186  string shortName,
1187  string longName,
1188  string description,
1189  string valueSpecification,
1190  string variableName,
1191  int& integerVariable,
1192  int& integerSecondaryVariable);
1193 
1194  protected:
1195 
1196  // constructors/destructor
1197  // ------------------------------------------------------
1198 
1200  string shortName,
1201  string longName,
1202  string description,
1203  string valueSpecification,
1204  string variableName,
1205  int& integerVariable,
1206  int& integerSecondaryVariable);
1207 
1208  protected:
1209 
1210 
1211  virtual ~oahTwoIntegersAtom ();
1212 
1213  public:
1214 
1215  // set and get
1216  // ------------------------------------------------------
1217 
1218  void setIntegerVariable (
1219  int value)
1220  { fIntegerVariable = value; }
1221 
1222  public:
1223 
1224  // services
1225  // ------------------------------------------------------
1226 
1227  S_oahValuedAtom handleOptionUnderName (
1228  string optionName,
1229  ostream& os);
1230 
1231  void handleValue (
1232  string theString,
1233  ostream& os);
1234 
1235  public:
1236 
1237  // visitors
1238  // ------------------------------------------------------
1239 
1240  virtual void acceptIn (basevisitor* v);
1241  virtual void acceptOut (basevisitor* v);
1242 
1243  virtual void browseData (basevisitor* v);
1244 
1245  public:
1246 
1247  // print
1248  // ------------------------------------------------------
1249 
1250  string asShortNamedOptionString () const;
1251  string asActualLongNamedOptionString () const;
1252 
1253  void print (ostream& os) const;
1254 
1255  void printAtomOptionsValues (
1256  ostream& os,
1257  int valueFieldWidth) const;
1258  private:
1259 
1260  // fields
1261  // ------------------------------------------------------
1262 
1263  int& fIntegerSecondaryVariable;
1264 };
1266 EXP ostream& operator<< (ostream& os, const S_oahTwoIntegersAtom& elt);
1267 
1268 //______________________________________________________________________________
1270 {
1271  public:
1272 
1273  // creation
1274  // ------------------------------------------------------
1275 
1276  static SMARTP<oahFloatAtom> create (
1277  string shortName,
1278  string longName,
1279  string description,
1280  string valueSpecification,
1281  string variableName,
1282  float& floatVariable);
1283 
1284  protected:
1285 
1286  // constructors/destructor
1287  // ------------------------------------------------------
1288 
1289  oahFloatAtom (
1290  string shortName,
1291  string longName,
1292  string description,
1293  string valueSpecification,
1294  string variableName,
1295  float& floatVariable);
1296 
1297  virtual ~oahFloatAtom ();
1298 
1299  public:
1300 
1301  // set and get
1302  // ------------------------------------------------------
1303 
1304  void setFloatVariable (
1305  float value)
1306  { fFloatVariable = value; }
1307 
1308  public:
1309 
1310  // services
1311  // ------------------------------------------------------
1312 
1313  S_oahValuedAtom handleOptionUnderName (
1314  string optionName,
1315  ostream& os);
1316 
1317  void handleValue (
1318  string theString,
1319  ostream& os);
1320 
1321  public:
1322 
1323  // visitors
1324  // ------------------------------------------------------
1325 
1326  virtual void acceptIn (basevisitor* v);
1327  virtual void acceptOut (basevisitor* v);
1328 
1329  virtual void browseData (basevisitor* v);
1330 
1331  public:
1332 
1333  // print
1334  // ------------------------------------------------------
1335 
1336  string asShortNamedOptionString () const;
1337  string asActualLongNamedOptionString () const;
1338 
1339  void print (ostream& os) const;
1340 
1341  void printAtomOptionsValues (
1342  ostream& os,
1343  int valueFieldWidth) const;
1344 
1345  private:
1346 
1347  // fields
1348  // ------------------------------------------------------
1349 
1350  float& fFloatVariable;
1351 };
1353 EXP ostream& operator<< (ostream& os, const S_oahFloatAtom& elt);
1354 
1355 //______________________________________________________________________________
1357 {
1358  public:
1359 
1360  // creation
1361  // ------------------------------------------------------
1362 
1363  static SMARTP<oahStringAtom> create (
1364  string shortName,
1365  string longName,
1366  string description,
1367  string valueSpecification,
1368  string variableName,
1369  string& stringVariable);
1370 
1371  protected:
1372 
1373  // constructors/destructor
1374  // ------------------------------------------------------
1375 
1376  oahStringAtom (
1377  string shortName,
1378  string longName,
1379  string description,
1380  string valueSpecification,
1381  string variableName,
1382  string& stringVariable);
1383 
1384  virtual ~oahStringAtom ();
1385 
1386  public:
1387 
1388  // set and get
1389  // ------------------------------------------------------
1390 
1391  void setStringVariable (
1392  string value)
1393  { fStringVariable = value; }
1394 
1395  public:
1396 
1397  // services
1398  // ------------------------------------------------------
1399 
1400  S_oahValuedAtom handleOptionUnderName (
1401  string optionName,
1402  ostream& os);
1403 
1404  void handleValue (
1405  string theString,
1406  ostream& os);
1407 
1408  public:
1409 
1410  // visitors
1411  // ------------------------------------------------------
1412 
1413  virtual void acceptIn (basevisitor* v);
1414  virtual void acceptOut (basevisitor* v);
1415 
1416  virtual void browseData (basevisitor* v);
1417 
1418  public:
1419 
1420  // print
1421  // ------------------------------------------------------
1422 
1423  string asShortNamedOptionString () const;
1424  string asActualLongNamedOptionString () const;
1425 
1426  void print (ostream& os) const;
1427 
1428  void printAtomOptionsValues (
1429  ostream& os,
1430  int valueFieldWidth) const;
1431 
1432  protected:
1433 
1434  // fields
1435  // ------------------------------------------------------
1436 
1437  string& fStringVariable;
1438 };
1440 EXP ostream& operator<< (ostream& os, const S_oahStringAtom& elt);
1441 
1442 //______________________________________________________________________________
1444 {
1445  public:
1446 
1447  // creation
1448  // ------------------------------------------------------
1449 
1450  static SMARTP<oahMonoplexStringAtom> create (
1451  string description,
1452  string atomNameDescriptor,
1453  string stringValueDescriptor);
1454 
1455  protected:
1456 
1457  // constructors/destructor
1458  // ------------------------------------------------------
1459 
1461  string description,
1462  string atomNameDescriptor,
1463  string stringValueDescriptor);
1464 
1465  virtual ~oahMonoplexStringAtom ();
1466 
1467  public:
1468 
1469  // set and get
1470  // ------------------------------------------------------
1471 
1472  const list<S_oahStringAtom>&
1473  getStringAtomsList ()
1474  { return fStringAtomsList; }
1475 
1476  // services
1477  // ------------------------------------------------------
1478 
1479  void addStringAtom (
1480  S_oahStringAtom stringAtom);
1481 
1482  void addStringAtomByName (
1483  string name);
1484 
1485  S_oahValuedAtom handleOptionUnderName (
1486  string optionName,
1487  ostream& os);
1488 
1489  public:
1490 
1491  // visitors
1492  // ------------------------------------------------------
1493 
1494  virtual void acceptIn (basevisitor* v);
1495  virtual void acceptOut (basevisitor* v);
1496 
1497  virtual void browseData (basevisitor* v);
1498 
1499  public:
1500 
1501  // print
1502  // ------------------------------------------------------
1503 
1504  void print (ostream& os) const;
1505 
1506  void printHelp (ostream& os);
1507 
1508  void printAtomOptionsValues (
1509  ostream& os,
1510  int valueFieldWidth) const;
1511 
1512  private:
1513 
1514  // fields
1515  // ------------------------------------------------------
1516 
1517  string fAtomNameDescriptor;
1518  string fStringValueDescriptor;
1519 
1520  list<S_oahStringAtom>
1521  fStringAtomsList;
1522 
1523  list<string> fAtomNamesList;
1524 };
1526 EXP ostream& operator<< (ostream& os, const S_oahMonoplexStringAtom& elt);
1527 
1528 //______________________________________________________________________________
1530 {
1531  public:
1532 
1533  // creation
1534  // ------------------------------------------------------
1535 
1537  string shortName,
1538  string longName,
1539  string description,
1540  string valueSpecification,
1541  string variableName,
1542  string& stringVariable,
1543  string defaultStringValue);
1544 
1545  protected:
1546 
1547  // constructors/destructor
1548  // ------------------------------------------------------
1549 
1551  string shortName,
1552  string longName,
1553  string description,
1554  string valueSpecification,
1555  string variableName,
1556  string& stringVariable,
1557  string defaultStringValue);
1558 
1559  virtual ~oahStringWithDefaultValueAtom ();
1560 
1561  public:
1562 
1563  // set and get
1564  // ------------------------------------------------------
1565 
1566  void setStringVariable (
1567  string value)
1568  { oahStringAtom::setStringVariable (value); }
1569 
1570  public:
1571 
1572  // services
1573  // ------------------------------------------------------
1574 
1575  S_oahValuedAtom handleOptionUnderName (
1576  string optionName,
1577  ostream& os);
1578 
1579  void handleValue (
1580  string theString,
1581  ostream& os);
1582 
1583  public:
1584 
1585  // visitors
1586  // ------------------------------------------------------
1587 
1588  virtual void acceptIn (basevisitor* v);
1589  virtual void acceptOut (basevisitor* v);
1590 
1591  virtual void browseData (basevisitor* v);
1592 
1593  public:
1594 
1595  // print
1596  // ------------------------------------------------------
1597 
1598  string asShortNamedOptionString () const;
1599  string asActualLongNamedOptionString () const;
1600 
1601  void print (ostream& os) const;
1602 
1603  void printAtomOptionsValues (
1604  ostream& os,
1605  int valueFieldWidth) const;
1606 
1607  protected:
1608 
1609  // fields
1610  // ------------------------------------------------------
1611 
1612  string fDefaultStringValue;
1613 };
1615 EXP ostream& operator<< (ostream& os, const S_oahStringWithDefaultValueAtom& elt);
1616 
1617 //______________________________________________________________________________
1619 {
1620  public:
1621 
1622  // creation
1623  // ------------------------------------------------------
1624 
1625  static SMARTP<oahRationalAtom> create (
1626  string shortName,
1627  string longName,
1628  string description,
1629  string valueSpecification,
1630  string variableName,
1631  rational& rationalVariable);
1632 
1633  protected:
1634 
1635  // constructors/destructor
1636  // ------------------------------------------------------
1637 
1638  oahRationalAtom (
1639  string shortName,
1640  string longName,
1641  string description,
1642  string valueSpecification,
1643  string variableName,
1644  rational& rationalVariable);
1645 
1646  virtual ~oahRationalAtom ();
1647 
1648  public:
1649 
1650  // set and get
1651  // ------------------------------------------------------
1652 
1653  void setRationalVariable (
1654  rational value)
1655  { fRationalVariable = value; }
1656 
1657  public:
1658 
1659  // services
1660  // ------------------------------------------------------
1661 
1662  S_oahValuedAtom handleOptionUnderName (
1663  string optionName,
1664  ostream& os);
1665 
1666  void handleValue (
1667  string theString,
1668  ostream& os);
1669 
1670  public:
1671 
1672  // visitors
1673  // ------------------------------------------------------
1674 
1675  virtual void acceptIn (basevisitor* v);
1676  virtual void acceptOut (basevisitor* v);
1677 
1678  virtual void browseData (basevisitor* v);
1679 
1680  public:
1681 
1682  // print
1683  // ------------------------------------------------------
1684 
1685  string asShortNamedOptionString () const;
1686  string asActualLongNamedOptionString () const;
1687 
1688  void print (ostream& os) const;
1689 
1690  void printAtomOptionsValues (
1691  ostream& os,
1692  int valueFieldWidth) const;
1693 
1694  private:
1695 
1696  // fields
1697  // ------------------------------------------------------
1698 
1699  rational& fRationalVariable;
1700 };
1702 EXP ostream& operator<< (ostream& os, const S_oahRationalAtom& elt);
1703 
1704 //______________________________________________________________________________
1706 {
1707  public:
1708 
1709  // creation
1710  // ------------------------------------------------------
1711 
1712  static SMARTP<oahNaturalNumbersSetAtom> create (
1713  string shortName,
1714  string longName,
1715  string description,
1716  string valueSpecification,
1717  string variableName,
1718  set<int>& naturalNumbersSetVariable);
1719 
1720  protected:
1721 
1722  // constructors/destructor
1723  // ------------------------------------------------------
1724 
1726  string shortName,
1727  string longName,
1728  string description,
1729  string valueSpecification,
1730  string variableName,
1731  set<int>& naturalNumbersSetVariable);
1732 
1733  virtual ~oahNaturalNumbersSetAtom ();
1734 
1735  public:
1736 
1737  // set and get
1738  // ------------------------------------------------------
1739 
1740  void setNaturalNumbersSetVariable (
1741  set<int> value)
1742  { fNaturalNumbersSetVariable = value; }
1743 
1744  public:
1745 
1746  // services
1747  // ------------------------------------------------------
1748 
1749  S_oahValuedAtom handleOptionUnderName (
1750  string optionName,
1751  ostream& os);
1752 
1753  void handleValue (
1754  string theString,
1755  ostream& os);
1756 
1757  public:
1758 
1759  // visitors
1760  // ------------------------------------------------------
1761 
1762  virtual void acceptIn (basevisitor* v);
1763  virtual void acceptOut (basevisitor* v);
1764 
1765  virtual void browseData (basevisitor* v);
1766 
1767  public:
1768 
1769  // print
1770  // ------------------------------------------------------
1771 
1772  string asShortNamedOptionString () const;
1773  string asActualLongNamedOptionString () const;
1774 
1775  void print (ostream& os) const;
1776 
1777  void printAtomOptionsValues (
1778  ostream& os,
1779  int valueFieldWidth) const;
1780 
1781  private:
1782 
1783  // fields
1784  // ------------------------------------------------------
1785 
1786  set<int>& fNaturalNumbersSetVariable;
1787 };
1789 EXP ostream& operator<< (ostream& os, const S_oahNaturalNumbersSetAtom& elt);
1790 
1791 //______________________________________________________________________________
1793 {
1794  public:
1795 
1796  // creation
1797  // ------------------------------------------------------
1798 
1799  static SMARTP<oahRGBColorAtom> create (
1800  string shortName,
1801  string longName,
1802  string description,
1803  string valueSpecification,
1804  string variableName,
1805  msrRGBColor& RGBColorVariable,
1806  bool& hasBeenSetVariable);
1807 
1808  protected:
1809 
1810  // constructors/destructor
1811  // ------------------------------------------------------
1812 
1813  oahRGBColorAtom (
1814  string shortName,
1815  string longName,
1816  string description,
1817  string valueSpecification,
1818  string variableName,
1819  msrRGBColor& RGBColorVariable,
1820  bool& hasBeenSetVariable);
1821 
1822  virtual ~oahRGBColorAtom ();
1823 
1824  public:
1825 
1826  // set and get
1827  // ------------------------------------------------------
1828 
1829  void setRGBColorVariable (
1830  msrRGBColor value)
1831  { fRGBColorVariable = value; }
1832 
1833  public:
1834 
1835  // services
1836  // ------------------------------------------------------
1837 
1838  S_oahValuedAtom handleOptionUnderName (
1839  string optionName,
1840  ostream& os);
1841 
1842  void handleValue (
1843  string theString,
1844  ostream& os);
1845 
1846  public:
1847 
1848  // visitors
1849  // ------------------------------------------------------
1850 
1851  virtual void acceptIn (basevisitor* v);
1852  virtual void acceptOut (basevisitor* v);
1853 
1854  virtual void browseData (basevisitor* v);
1855 
1856  public:
1857 
1858  // print
1859  // ------------------------------------------------------
1860 
1861  string asShortNamedOptionString () const;
1862  string asActualLongNamedOptionString () const;
1863 
1864  void print (ostream& os) const;
1865 
1866  void printAtomOptionsValues (
1867  ostream& os,
1868  int valueFieldWidth) const;
1869 
1870  private:
1871 
1872  // fields
1873  // ------------------------------------------------------
1874 
1875  msrRGBColor& fRGBColorVariable;
1876  bool& fHasBeenSetVariable;
1877 };
1879 EXP ostream& operator<< (ostream& os, const S_oahRGBColorAtom& elt);
1880 
1881 //______________________________________________________________________________
1883 {
1884  public:
1885 
1886  // creation
1887  // ------------------------------------------------------
1888 
1889  static SMARTP<oahIntSetAtom> create (
1890  string shortName,
1891  string longName,
1892  string description,
1893  string valueSpecification,
1894  string variableName,
1895  set<int>& intSetVariable);
1896 
1897  protected:
1898 
1899  // constructors/destructor
1900  // ------------------------------------------------------
1901 
1902  oahIntSetAtom (
1903  string shortName,
1904  string longName,
1905  string description,
1906  string valueSpecification,
1907  string variableName,
1908  set<int>& intSetVariable);
1909 
1910  virtual ~oahIntSetAtom ();
1911 
1912  public:
1913 
1914  // set and get
1915  // ------------------------------------------------------
1916 
1917  const set<int>& getIntSetVariable ()
1918  { return fIntSetVariable; }
1919 
1920  public:
1921 
1922  // services
1923  // ------------------------------------------------------
1924 
1925  S_oahValuedAtom handleOptionUnderName (
1926  string optionName,
1927  ostream& os);
1928 
1929  void handleValue (
1930  string theString,
1931  ostream& os);
1932 
1933  public:
1934 
1935  // visitors
1936  // ------------------------------------------------------
1937 
1938  virtual void acceptIn (basevisitor* v);
1939  virtual void acceptOut (basevisitor* v);
1940 
1941  virtual void browseData (basevisitor* v);
1942 
1943  public:
1944 
1945  // print
1946  // ------------------------------------------------------
1947 
1948  string asShortNamedOptionString () const;
1949  string asActualLongNamedOptionString () const;
1950 
1951  void print (ostream& os) const;
1952 
1953  void printAtomOptionsValues (
1954  ostream& os,
1955  int valueFieldWidth) const;
1956 
1957  private:
1958 
1959  // fields
1960  // ------------------------------------------------------
1961 
1962  set<int>& fIntSetVariable;
1963 };
1965 EXP ostream& operator<< (ostream& os, const S_oahIntSetAtom& elt);
1966 
1967 //______________________________________________________________________________
1969 {
1970  public:
1971 
1972  // creation
1973  // ------------------------------------------------------
1974 
1975  static SMARTP<oahStringSetAtom> create (
1976  string shortName,
1977  string longName,
1978  string description,
1979  string valueSpecification,
1980  string variableName,
1981  set<string>& stringSetVariable);
1982 
1983  protected:
1984 
1985  // constructors/destructor
1986  // ------------------------------------------------------
1987 
1989  string shortName,
1990  string longName,
1991  string description,
1992  string valueSpecification,
1993  string variableName,
1994  set<string>& stringSetVariable);
1995 
1996  virtual ~oahStringSetAtom ();
1997 
1998  public:
1999 
2000  // set and get
2001  // ------------------------------------------------------
2002 
2003  void setStringSetVariable (
2004  string partName)
2005  { fStringSetVariable.insert (partName); }
2006 
2007  const set<string>& getStringSetVariable ()
2008  { return fStringSetVariable; }
2009 
2010  public:
2011 
2012  // services
2013  // ------------------------------------------------------
2014 
2015  S_oahValuedAtom handleOptionUnderName (
2016  string optionName,
2017  ostream& os);
2018 
2019  void handleValue (
2020  string theString,
2021  ostream& os);
2022 
2023  public:
2024 
2025  // visitors
2026  // ------------------------------------------------------
2027 
2028  virtual void acceptIn (basevisitor* v);
2029  virtual void acceptOut (basevisitor* v);
2030 
2031  virtual void browseData (basevisitor* v);
2032 
2033  public:
2034 
2035  // print
2036  // ------------------------------------------------------
2037 
2038  string asShortNamedOptionString () const;
2039  string asActualLongNamedOptionString () const;
2040 
2041  void print (ostream& os) const;
2042 
2043  void printAtomOptionsValues (
2044  ostream& os,
2045  int valueFieldWidth) const;
2046 
2047  private:
2048 
2049  // fields
2050  // ------------------------------------------------------
2051 
2052  set<string>& fStringSetVariable;
2053 };
2055 EXP ostream& operator<< (ostream& os, const S_oahStringSetAtom& elt);
2056 
2057 //______________________________________________________________________________
2059 {
2060  public:
2061 
2062  // creation
2063  // ------------------------------------------------------
2064 
2065  static SMARTP<oahStringToIntMapAtom> create (
2066  string shortName,
2067  string longName,
2068  string description,
2069  string valueSpecification,
2070  string variableName,
2071  map<string, int>& stringToIntMapVariable);
2072 
2073  protected:
2074 
2075  // constructors/destructor
2076  // ------------------------------------------------------
2077 
2079  string shortName,
2080  string longName,
2081  string description,
2082  string valueSpecification,
2083  string variableName,
2084  map<string, int>& stringToIntMapVariable);
2085 
2086  virtual ~oahStringToIntMapAtom ();
2087 
2088  public:
2089 
2090  // set and get
2091  // ------------------------------------------------------
2092 
2093  const map<string, int>&
2094  getStringToIntMapVariable ()
2095  { return fStringToIntMapVariable; }
2096 
2097  public:
2098 
2099  // services
2100  // ------------------------------------------------------
2101 
2102  S_oahValuedAtom handleOptionUnderName (
2103  string optionName,
2104  ostream& os);
2105 
2106  void handleValue (
2107  string theString,
2108  ostream& os);
2109 
2110  public:
2111 
2112  // visitors
2113  // ------------------------------------------------------
2114 
2115  virtual void acceptIn (basevisitor* v);
2116  virtual void acceptOut (basevisitor* v);
2117 
2118  virtual void browseData (basevisitor* v);
2119 
2120  public:
2121 
2122  // print
2123  // ------------------------------------------------------
2124 
2125  string asShortNamedOptionString () const;
2126  string asActualLongNamedOptionString () const;
2127 
2128  void print (ostream& os) const;
2129 
2130  void printAtomOptionsValues (
2131  ostream& os,
2132  int valueFieldWidth) const;
2133 
2134  private:
2135 
2136  // fields
2137  // ------------------------------------------------------
2138 
2139  map<string, int>& fStringToIntMapVariable;
2140 };
2142 EXP ostream& operator<< (ostream& os, const S_oahStringToIntMapAtom& elt);
2143 
2144 //______________________________________________________________________________
2146 {
2147  public:
2148 
2149  // creation
2150  // ------------------------------------------------------
2151 
2152  static SMARTP<oahStringAndIntegerAtom> create (
2153  string shortName,
2154  string longName,
2155  string description,
2156  string valueSpecification,
2157  string stringVariableName,
2158  string& stringVariable,
2159  string integerVariableName,
2160  int& integerVariable);
2161 
2162  protected:
2163 
2164  // constructors/destructor
2165  // ------------------------------------------------------
2166 
2168  string shortName,
2169  string longName,
2170  string description,
2171  string valueSpecification,
2172  string stringVariableName,
2173  string& stringVariable,
2174  string integerVariableName,
2175  int& integerVariable);
2176 
2177  virtual ~oahStringAndIntegerAtom ();
2178 
2179  public:
2180 
2181  // set and get
2182  // ------------------------------------------------------
2183 
2184  void setStringVariable (
2185  string value)
2186  { fStringVariable = value; }
2187 
2188  string getStringVariable () const
2189  { return fStringVariable; }
2190 
2191  void setIntegerVariable (
2192  int value)
2193  { fIntegerVariable = value; }
2194 
2195  int getIntegerVariable () const
2196  { return fIntegerVariable; }
2197 
2198  public:
2199 
2200  // services
2201  // ------------------------------------------------------
2202 
2203  S_oahValuedAtom handleOptionUnderName (
2204  string optionName,
2205  ostream& os);
2206 
2207  void handleValue (
2208  string theString,
2209  ostream& os);
2210 
2211  public:
2212 
2213  // visitors
2214  // ------------------------------------------------------
2215 
2216  virtual void acceptIn (basevisitor* v);
2217  virtual void acceptOut (basevisitor* v);
2218 
2219  virtual void browseData (basevisitor* v);
2220 
2221  public:
2222 
2223  // print
2224  // ------------------------------------------------------
2225 
2226  string asShortNamedOptionString () const;
2227  string asActualLongNamedOptionString () const;
2228 
2229  void print (ostream& os) const;
2230 
2231  void printAtomOptionsValues (
2232  ostream& os,
2233  int valueFieldWidth) const;
2234 
2235  private:
2236 
2237  // fields
2238  // ------------------------------------------------------
2239 
2240  string fStringVariableName;
2241  string& fStringVariable;
2242 
2243  string fIntegerVariableName;
2244  int& fIntegerVariable;
2245 };
2247 EXP ostream& operator<< (ostream& os, const S_oahStringAndIntegerAtom& elt);
2248 
2249 //______________________________________________________________________________
2251 {
2252  public:
2253 
2254  // creation
2255  // ------------------------------------------------------
2256 
2257  static SMARTP<oahStringAndTwoIntegersAtom> create (
2258  string shortName,
2259  string longName,
2260  string description,
2261  string valueSpecification,
2262  string variableName,
2263  string& stringVariable,
2264  int& primaryIntegerVariable,
2265  int& secondaryIntegerVariable);
2266 
2267  protected:
2268 
2269  // constructors/destructor
2270  // ------------------------------------------------------
2271 
2273  string shortName,
2274  string longName,
2275  string description,
2276  string valueSpecification,
2277  string variableName,
2278  string& stringVariable,
2279  int& primaryIntegerVariable,
2280  int& secondaryIntegerVariable);
2281 
2282  virtual ~oahStringAndTwoIntegersAtom ();
2283 
2284  public:
2285 
2286  // set and get
2287  // ------------------------------------------------------
2288 
2289  void setStringVariable (
2290  string value)
2291  { fStringVariable = value; }
2292 
2293  string getStringVariable () const
2294  { return fStringVariable; }
2295 
2296  void setPrimaryIntegerVariable (
2297  int value)
2298  { fPrimaryIntegerVariable = value; }
2299 
2300  int getPrimaryIntegerVariable () const
2301  { return fPrimaryIntegerVariable; }
2302 
2303  void setSecondaryIntegerVariable (
2304  int value)
2305  { fSecondaryIntegerVariable = value; }
2306 
2307  int getSecondaryIntegerVariable () const
2308  { return fSecondaryIntegerVariable; }
2309 
2310  public:
2311 
2312  // services
2313  // ------------------------------------------------------
2314 
2315  S_oahValuedAtom handleOptionUnderName (
2316  string optionName,
2317  ostream& os);
2318 
2319  void handleValue (
2320  string theString,
2321  ostream& os);
2322 
2323  public:
2324 
2325  // visitors
2326  // ------------------------------------------------------
2327 
2328  virtual void acceptIn (basevisitor* v);
2329  virtual void acceptOut (basevisitor* v);
2330 
2331  virtual void browseData (basevisitor* v);
2332 
2333  public:
2334 
2335  // print
2336  // ------------------------------------------------------
2337 
2338  string asShortNamedOptionString () const;
2339  string asActualLongNamedOptionString () const;
2340 
2341  void print (ostream& os) const;
2342 
2343  void printAtomOptionsValues (
2344  ostream& os,
2345  int valueFieldWidth) const;
2346 
2347  private:
2348 
2349  // fields
2350  // ------------------------------------------------------
2351 
2352  string& fStringVariable;
2353 
2354  int& fPrimaryIntegerVariable;
2355  int& fSecondaryIntegerVariable;
2356 };
2358 EXP ostream& operator<< (ostream& os, const S_oahStringAndTwoIntegersAtom& elt);
2359 
2360 //______________________________________________________________________________
2362 {
2363  public:
2364 
2365  // creation
2366  // ------------------------------------------------------
2367 
2368  static SMARTP<oahLengthUnitKindAtom> create (
2369  string shortName,
2370  string longName,
2371  string description,
2372  string valueSpecification,
2373  string variableName,
2374  msrLengthUnitKind& lengthUnitKindVariable);
2375 
2376  protected:
2377 
2378  // constructors/destructor
2379  // ------------------------------------------------------
2380 
2382  string shortName,
2383  string longName,
2384  string description,
2385  string valueSpecification,
2386  string variableName,
2387  msrLengthUnitKind& lengthUnitKindVariable);
2388 
2389  virtual ~oahLengthUnitKindAtom ();
2390 
2391  public:
2392 
2393  // set and get
2394  // ------------------------------------------------------
2395 
2396  void setLengthUnitKindVariable (
2397  msrLengthUnitKind value)
2398  { fLengthUnitKindVariable = value; }
2399 
2400  public:
2401 
2402  // services
2403  // ------------------------------------------------------
2404 
2405  S_oahValuedAtom handleOptionUnderName (
2406  string optionName,
2407  ostream& os);
2408 
2409  void handleValue (
2410  string theString,
2411  ostream& os);
2412 
2413  public:
2414 
2415  // visitors
2416  // ------------------------------------------------------
2417 
2418  virtual void acceptIn (basevisitor* v);
2419  virtual void acceptOut (basevisitor* v);
2420 
2421  virtual void browseData (basevisitor* v);
2422 
2423  public:
2424 
2425  // print
2426  // ------------------------------------------------------
2427 
2428  string asShortNamedOptionString () const;
2429  string asActualLongNamedOptionString () const;
2430 
2431  void print (ostream& os) const;
2432 
2433  void printAtomOptionsValues (
2434  ostream& os,
2435  int valueFieldWidth) const;
2436 
2437  private:
2438 
2439  // fields
2440  // ------------------------------------------------------
2441 
2442  msrLengthUnitKind& fLengthUnitKindVariable;
2443 };
2445 EXP ostream& operator<< (ostream& os, const S_oahLengthUnitKindAtom& elt);
2446 
2447 //______________________________________________________________________________
2449 {
2450  public:
2451 
2452  // creation
2453  // ------------------------------------------------------
2454 
2455  static SMARTP<oahLengthAtom> create (
2456  string shortName,
2457  string longName,
2458  string description,
2459  string valueSpecification,
2460  string variableName,
2461  msrLength& lengthVariable);
2462 
2463  protected:
2464 
2465  // constructors/destructor
2466  // ------------------------------------------------------
2467 
2468  oahLengthAtom (
2469  string shortName,
2470  string longName,
2471  string description,
2472  string valueSpecification,
2473  string variableName,
2474  msrLength& lengthVariable);
2475 
2476  virtual ~oahLengthAtom ();
2477 
2478  public:
2479 
2480  // set and get
2481  // ------------------------------------------------------
2482 
2483  void setLengthVariable (
2484  msrLength value)
2485  { fLengthVariable = value; }
2486 
2487  public:
2488 
2489  // services
2490  // ------------------------------------------------------
2491 
2492  S_oahValuedAtom handleOptionUnderName (
2493  string optionName,
2494  ostream& os);
2495 
2496  void handleValue (
2497  string theString,
2498  ostream& os);
2499 
2500  public:
2501 
2502  // visitors
2503  // ------------------------------------------------------
2504 
2505  virtual void acceptIn (basevisitor* v);
2506  virtual void acceptOut (basevisitor* v);
2507 
2508  virtual void browseData (basevisitor* v);
2509 
2510  public:
2511 
2512  // print
2513  // ------------------------------------------------------
2514 
2515  string asShortNamedOptionString () const;
2516  string asActualLongNamedOptionString () const;
2517 
2518  void print (ostream& os) const;
2519 
2520  void printAtomOptionsValues (
2521  ostream& os,
2522  int valueFieldWidth) const;
2523 
2524  private:
2525 
2526  // fields
2527  // ------------------------------------------------------
2528 
2529  msrLength& fLengthVariable;
2530 };
2532 EXP ostream& operator<< (ostream& os, const S_oahLengthAtom& elt);
2533 
2534 //______________________________________________________________________________
2536 {
2537  public:
2538 
2539  // creation
2540  // ------------------------------------------------------
2541 
2542  static SMARTP<oahMidiTempoAtom> create (
2543  string shortName,
2544  string longName,
2545  string description,
2546  string valueSpecification,
2547  string variableName,
2548  msrMidiTempo& midiTempoVariable);
2549 
2550  protected:
2551 
2552  // constructors/destructor
2553  // ------------------------------------------------------
2554 
2556  string shortName,
2557  string longName,
2558  string description,
2559  string valueSpecification,
2560  string variableName,
2561  msrMidiTempo& midiTempoVariable);
2562 
2563  virtual ~oahMidiTempoAtom ();
2564 
2565  public:
2566 
2567  // set and get
2568  // ------------------------------------------------------
2569 
2570  void setMidiTempoAtomVariable (
2571  msrMidiTempo& value)
2572  { fMidiTempoAtomVariable = value; }
2573 
2574  const msrMidiTempo& getMidiTempoAtomVariable ()
2575  { return fMidiTempoAtomVariable; }
2576 
2577  public:
2578 
2579  // services
2580  // ------------------------------------------------------
2581 
2582  S_oahValuedAtom handleOptionUnderName (
2583  string optionName,
2584  ostream& os);
2585 
2586  void handleValue (
2587  string theString,
2588  ostream& os);
2589 
2590  public:
2591 
2592  // visitors
2593  // ------------------------------------------------------
2594 
2595  virtual void acceptIn (basevisitor* v);
2596  virtual void acceptOut (basevisitor* v);
2597 
2598  virtual void browseData (basevisitor* v);
2599 
2600  public:
2601 
2602  // print
2603  // ------------------------------------------------------
2604 
2605  string asShortNamedOptionString () const;
2606  string asActualLongNamedOptionString () const;
2607 
2608  void print (ostream& os) const;
2609 
2610  void printAtomOptionsValues (
2611  ostream& os,
2612  int valueFieldWidth) const;
2613 
2614  private:
2615 
2616  // fields
2617  // ------------------------------------------------------
2618 
2619  msrMidiTempo& fMidiTempoAtomVariable;
2620 };
2622 EXP ostream& operator<< (ostream& os, const S_oahMidiTempoAtom& elt);
2623 
2624 //______________________________________________________________________________
2626 {
2627 /*
2628  This is where OAH is introspective:
2629  OAH provides a way to obtain help on any option name,
2630  be it one to print help about a group or subgroup,
2631  or the name of a 'regular' atom.
2632  This option is reflexive, since it can provide help about itself.
2633 */
2634  public:
2635 
2636  // creation
2637  // ------------------------------------------------------
2638 
2639  static SMARTP<oahOptionNameHelpAtom> create (
2640  string shortName,
2641  string longName,
2642  string description,
2643  string valueSpecification,
2644  string variableName,
2645  string& stringVariable,
2646  string defaultOptionName);
2647 
2648  protected:
2649 
2650  // constructors/destructor
2651  // ------------------------------------------------------
2652 
2654  string shortName,
2655  string longName,
2656  string description,
2657  string valueSpecification,
2658  string variableName,
2659  string& stringVariable,
2660  string defaultOptionName);
2661 
2662  protected:
2663 
2664 
2665  virtual ~oahOptionNameHelpAtom ();
2666 
2667  public:
2668 
2669  // set and get
2670  // ------------------------------------------------------
2671 
2672  public:
2673 
2674  // services
2675  // ------------------------------------------------------
2676 
2677  S_oahValuedAtom handleOptionUnderName (
2678  string optionName,
2679  ostream& os);
2680 
2681  void handleValue (
2682  string theString,
2683  ostream& os);
2684 
2685  void handleDefaultValue ();
2686 
2687  public:
2688 
2689  // visitors
2690  // ------------------------------------------------------
2691 
2692  virtual void acceptIn (basevisitor* v);
2693  virtual void acceptOut (basevisitor* v);
2694 
2695  virtual void browseData (basevisitor* v);
2696 
2697  public:
2698 
2699  // print
2700  // ------------------------------------------------------
2701 
2702  string asShortNamedOptionString () const;
2703  string asActualLongNamedOptionString () const;
2704 
2705  void print (ostream& os) const;
2706 
2707  virtual void printAtomOptionsValues (
2708  ostream& os,
2709  int valueFieldWidth) const;
2710  private:
2711 
2712  // fields
2713  // ------------------------------------------------------
2714 
2715  string fValueSpecification;
2716 };
2718 EXP ostream& operator<< (ostream& os, const S_oahOptionNameHelpAtom& elt);
2719 
2720 //_______________________________________________________________________________
2721 class oahSubGroup : public oahElement
2722 {
2723  public:
2724 
2725  // creation
2726  // ------------------------------------------------------
2727 
2728  static SMARTP<oahSubGroup> create (
2729  string subGroupHeader,
2730  string shortName,
2731  string longName,
2732  string description,
2733  oahElementVisibilityKind optionVisibilityKind,
2734  S_oahGroup groupUpLink);
2735 
2736  protected:
2737 
2738  // constructors/destructor
2739  // ------------------------------------------------------
2740 
2741  oahSubGroup (
2742  string subGroupHeader,
2743  string shortName,
2744  string longName,
2745  string description,
2746  oahElementVisibilityKind optionVisibilityKind,
2747  S_oahGroup groupUpLink);
2748 
2749  virtual ~oahSubGroup ();
2750 
2751  public:
2752 
2753  // set and get
2754  // ------------------------------------------------------
2755 
2756  void setGroupUpLink (
2758  { fGroupUpLink = oahGroup; }
2759 
2760  S_oahGroup getGroupUpLink () const
2761  { return fGroupUpLink; }
2762 
2763  string getSubGroupHeader () const
2764  { return fSubGroupHeader; }
2765 
2766  public:
2767 
2768  // consistency check
2769  // ------------------------------------------------------
2770 
2771  virtual void checkOptionsConsistency ();
2772 
2773  public:
2774 
2775  // services
2776  // ------------------------------------------------------
2777 
2778  void underlineSubGroupHeader (ostream& os) const;
2779 
2780  void registerSubGroupInHandler (
2781  S_oahHandler handler);
2782 
2783  void appendAtomToSubGroup (
2784  S_oahAtom oahAtom);
2785 
2786  S_oahElement fetchOptionByName (
2787  string name);
2788 
2789  S_oahValuedAtom handleOptionUnderName (
2790  string optionName,
2791  ostream& os);
2792 
2793  public:
2794 
2795  // visitors
2796  // ------------------------------------------------------
2797 
2798  virtual void acceptIn (basevisitor* v);
2799  virtual void acceptOut (basevisitor* v);
2800 
2801  virtual void browseData (basevisitor* v);
2802 
2803  public:
2804 
2805  // print
2806  // ------------------------------------------------------
2807 
2808  void print (ostream& os) const;
2809 
2810  void printHelp (ostream& os);
2811 
2812  void printHelpWithHeaderWidth (
2813  ostream& os,
2814  int subGroupHeaderWidth);
2815 
2816  void printSubGroupHeader (ostream& os) const;
2817  void printSubGroupHeaderWithHeaderWidth (
2818  ostream& os,
2819  int subGroupHeaderWidth) const;
2820 
2821  void printSubGroupHelp (
2822  ostream& os) const;
2823 
2824  void printSubGroupAndAtomHelp (
2825  ostream& os,
2826  S_oahAtom targetAtom) const;
2827 
2828  void printOptionsSummary (ostream& os) const;
2829 
2830  void printSubGroupSpecificHelpOrOptionsSummary (
2831  ostream& os,
2832  S_oahSubGroup subGroup) const;
2833 
2834  void printSubGroupOptionsValues (
2835  ostream& os,
2836  int valueFieldWidth) const;
2837 
2838  private:
2839 
2840  // fields
2841  // ------------------------------------------------------
2842 
2843  S_oahGroup fGroupUpLink;
2844 
2845  string fSubGroupHeader;
2846 
2847  list<S_oahAtom> fAtomsList;
2848 };
2850 EXP ostream& operator<< (ostream& os, const S_oahSubGroup& elt);
2851 
2852 //_______________________________________________________________________________
2853 class oahGroup : public oahElement
2854 {
2855  public:
2856 
2857  // creation
2858  // ------------------------------------------------------
2859 
2860  static SMARTP<oahGroup> create (
2861  string header,
2862  string shortName,
2863  string longName,
2864  string description,
2865  oahElementVisibilityKind optionVisibilityKind,
2866  S_oahHandler groupHandlerUpLink);
2867 
2868  protected:
2869 
2870  // constructors/destructor
2871  // ------------------------------------------------------
2872 
2873  oahGroup (
2874  string header,
2875  string shortName,
2876  string longName,
2877  string description,
2878  oahElementVisibilityKind optionVisibilityKind,
2879  S_oahHandler groupHandlerUpLink);
2880 
2881  virtual ~oahGroup ();
2882 
2883  public:
2884 
2885  // set and get
2886  // ------------------------------------------------------
2887 
2888  string getGroupHeader () const
2889  { return fGroupHeader; }
2890 
2891  public:
2892 
2893  // consistency check
2894  // ------------------------------------------------------
2895 
2896  void checkGroupSubGroupsOptionsConsistency ();
2897 
2898  virtual void checkOptionsConsistency ();
2899 
2900  public:
2901 
2902  // public services
2903  // ------------------------------------------------------
2904 
2905  void underlineGroupHeader (ostream& os) const;
2906 
2907  void registerGroupInHandler (
2908  S_oahHandler handler);
2909 
2910  void appendSubGroupToGroup (
2911  S_oahSubGroup subGroup);
2912 
2913  S_oahElement fetchOptionByName (
2914  string name);
2915 
2916  virtual void handleAtomValue (
2917  ostream& os,
2918  S_oahAtom atom,
2919  string theString);
2920 
2921  S_oahValuedAtom handleOptionUnderName (
2922  string optionName,
2923  ostream& os);
2924 
2925  public:
2926 
2927  // visitors
2928  // ------------------------------------------------------
2929 
2930  virtual void acceptIn (basevisitor* v);
2931  virtual void acceptOut (basevisitor* v);
2932 
2933  virtual void browseData (basevisitor* v);
2934 
2935  public:
2936 
2937  // print
2938  // ------------------------------------------------------
2939 
2940  void print (ostream& os) const;
2941 
2942  void printGroupHeader (ostream& os) const;
2943 
2944  void printHelp (ostream& os);
2945 
2946  void printGroupAndSubGroupHelp (
2947  ostream& os,
2948  S_oahSubGroup targetSubGroup) const;
2949 
2950  void printGroupAndSubGroupAndAtomHelp (
2951  ostream& os,
2952  S_oahSubGroup targetSubGroup,
2953  S_oahAtom targetAtom) const;
2954 
2955  void printOptionsSummary (ostream& os) const;
2956 
2957  void printGroupAndSubGroupSpecificHelp (
2958  ostream& os,
2959  S_oahSubGroup subGroup) const;
2960 
2961  void printGroupOptionsValues (
2962  ostream& os,
2963  int valueFieldWidth) const;
2964 
2965  protected:
2966 
2967  // protected fields
2968  // ------------------------------------------------------
2969 
2970  string fGroupHeader;
2971 
2972  list<S_oahSubGroup> fSubGroupsList;
2973 };
2975 EXP ostream& operator<< (ostream& os, const S_oahGroup& elt);
2976 
2977 //_______________________________________________________________________________
2978 class EXP oahHandler : public oahElement
2979 {
2980  // data types
2981  // ------------------------------------------------------
2982 
2983  enum oahOptionsDefaultValuesStyle {
2984  kGNUStyle,
2985  kOAHStyle };
2986 
2987  static string optionsDefaultValuesStyleAsString (
2988  oahOptionsDefaultValuesStyle optionsDefaultValuesStyle);
2989 
2990  public:
2991 
2992  // creation
2993  // ------------------------------------------------------
2994 /* JMI this a pure virtual class
2995  static SMARTP<oahHandler> create (
2996  string handlerHeader,
2997  string handlerValuesHeader,
2998  string optionHoahHandlerandlerHelpShortName,
2999  string handlerLongName,
3000  string handlerSummaryShortName,
3001  string handlerSummaryLongName,
3002  string handlerPreamble,
3003  string handlerUsage,
3004  string handlerDescription,
3005  indentedOstream& handlerLogOstream);
3006 */
3007 
3008  protected:
3009 
3010  // constructors/destructor
3011  // ------------------------------------------------------
3012 
3013  oahHandler (
3014  string handlerHeader,
3015  string handlerValuesHeader,
3016  string handlerShortName,
3017  string handlerLongName,
3018  string handlerSummaryShortName,
3019  string handlerSummaryLongName,
3020  string handlerPreamble,
3021  string handlerUsage,
3022  string handlerDescription,
3023  indentedOstream& handlerLogOstream);
3024 
3025  virtual ~oahHandler ();
3026 
3027  public:
3028 
3029  // set and get
3030  // ------------------------------------------------------
3031 
3032  string getHandlerHeader () const
3033  { return fHandlerHeader; }
3034 
3035  string getOptionsHandlerValuesHeader () const
3036  { return fHandlerValuesHeader; }
3037 
3038  string getHandlerSummaryShortName () const
3039  { return fHandlerSummaryShortName; }
3040 
3041  string getHandlerSummaryLongName () const
3042  { return fHandlerSummaryLongName; }
3043 
3044  string getHandlerPreamble () const
3045  { return fHandlerPreamble; }
3046 
3047  string getHandlerUsage () const
3048  { return fHandlerUsage; }
3049 
3050  string getExecutableName () const
3051  { return fHandlerExecutableName; }
3052 
3053  ostream& getHandlerLogOstream ()
3054  { return fHandlerLogOstream; }
3055 
3056  oahOptionalValuesStyleKind&
3057  getHandlerOptionalValuesStyleKind ()
3058  { return fHandlerOptionalValuesStyleKind; }
3059 
3060  const list<S_oahElement>&
3061  getHandlerRegisteredElementsList () const
3062  { return fHandlerRegisteredElementsList; }
3063 
3064  const list<S_oahElement>&
3065  getHandlerCommandLineElementsList () const
3066  { return fHandlerCommandLineElementsList; }
3067  const multiset<S_oahElement, compareOahElements>&
3068  getHandlerCommandLineElementsMultiset () const
3069  { return fHandlerCommandLineElementsMultiset; }
3070 
3071  int getMaximumShortNameWidth () const
3072  { return fMaximumShortNameWidth; }
3073 
3074  int getMaximumLongNameWidth () const
3075  { return fMaximumLongNameWidth; }
3076 
3077  int getMaximumSubGroupsHeadersSize () const
3078  { return fMaximumSubGroupsHeadersSize; }
3079 
3080  public:
3081 
3082  // consistency check
3083  // ------------------------------------------------------
3084 
3085  virtual void checkOptionsConsistency ();
3086 
3087  public:
3088 
3089  // public services
3090  // ------------------------------------------------------
3091 
3092  void appendPrefixToHandler (
3093  S_oahPrefix prefix);
3094 
3095  S_oahPrefix fetchPrefixInMapByItsName (
3096  string prefixName);
3097 
3098  void appendGroupToHandler (
3100  void prependGroupToHandler (
3102 
3103  void registerElementInHandler (
3104  S_oahElement element);
3105 
3106  void registerHandlerInItself ();
3107 
3108  S_oahPrefix fetchPrefixFromMap (
3109  string name) const;
3110 
3111  S_oahElement fetchElementFromMap (
3112  string name) const;
3113 
3114  void handlePrefixName (
3115  string prefixName,
3116  size_t equalsSignPosition,
3117  string stringAfterEqualsSign);
3118 
3119  bool optionNameIsASingleCharacterOptionsCluster (
3120  string optionName);
3121 
3122  const vector<string> decipherOptionsAndArguments (
3123  int argc,
3124  char* argv[]);
3125 
3126  string decipherOption (
3127  string currentString);
3128 
3129  void decipherOptionContainingEqualSign (
3130  string currentOptionName,
3131  size_t equalsSignPosition);
3132 
3133  public:
3134 
3135  // visitors
3136  // ------------------------------------------------------
3137 
3138  virtual void acceptIn (basevisitor* v);
3139  virtual void acceptOut (basevisitor* v);
3140 
3141  virtual void browseData (basevisitor* v);
3142 
3143  public:
3144 
3145  // print
3146  // ------------------------------------------------------
3147 
3148  string commandLineAsSuppliedAsString () const;
3149  string commandLineWithShortNamesAsString () const;
3150  string commandLineWithLongNamesAsString () const;
3151 
3152  void print (ostream& os) const;
3153 
3154  void printHelp (ostream& os);
3155 
3156  void printOptionsSummary (ostream& os) const;
3157  void printOptionsSummary () const
3158  { printOptionsSummary (fHandlerLogOstream); }
3159 
3160  void printHandlerAndGroupAndSubGroupSpecificHelp (
3161  ostream& os,
3162  S_oahSubGroup subGroup) const;
3163 
3164  void printOptionNameIntrospectiveHelp (
3165  ostream& os,
3166  string name) const;
3167 
3168  void printAllOahCommandLineValues (
3169  ostream& os) const;
3170 
3171  void setOptionsHandlerFoundAHelpOption ()
3172  { fHandlerFoundAHelpOption = true; }
3173 
3174  bool getOptionsHandlerFoundAHelpOption () const
3175  { return fHandlerFoundAHelpOption; }
3176 
3177  private:
3178 
3179  // private services
3180  // ------------------------------------------------------
3181 
3182  string handlerOptionNamesBetweenParentheses () const;
3183 
3184  void registerElementNamesInHandler (
3185  S_oahElement element);
3186 
3187  void printKnownPrefixes () const;
3188  void printKnownSingleCharacterOptions () const;
3189  void printOptionsDefaultValuesInformation () const;
3190  void printKnownOptions () const;
3191 
3192  S_oahElement fetchOptionByName (
3193  string name);
3194 
3195  void handleOptionName (
3196  string name);
3197 
3198  void handleHandlerName (
3199  S_oahHandler handler,
3200  string name);
3201 
3202  void handleGroupName (
3203  S_oahGroup group,
3204  string groupName);
3205 
3206  void handleSubGroupName (
3207  S_oahSubGroup subGroup,
3208  string subGroupName);
3209 
3210  void handleAtomName (
3211  S_oahAtom atom,
3212  string atomName);
3213 
3214  void handleOptionValueOrArgument (
3215  string theString);
3216 
3217  void checkMissingPendingValuedAtomValue (
3218  string atomName,
3219  string context);
3220 
3221  virtual void checkOptionsAndArguments () = 0;
3222 
3223  void checkHandlerGroupsOptionsConsistency ();
3224 
3225  protected:
3226 
3227  // protected fields
3228  // ------------------------------------------------------
3229 
3230  string fCommandLineAsSupplied;
3231 
3232  string fHandlerHeader;
3233  string fHandlerValuesHeader;
3234 
3235  string fHandlerSummaryShortName;
3236  string fHandlerSummaryLongName;
3237 
3238  string fHandlerPreamble;
3239 
3240  string fHandlerUsage;
3241 
3242  map<string, S_oahPrefix>
3243  fHandlerPrefixesMap;
3244 
3245  set<string> fSingleCharacterShortNamesSet;
3246 
3247  list<S_oahGroup> fHandlerGroupsList;
3248 
3249  map<string, S_oahElement>
3250  fHandlerElementsMap;
3251 
3252  vector<string> fHandlerArgumentsVector;
3253 
3254  string fHandlerExecutableName;
3255 
3256  oahOptionalValuesStyleKind
3257  fHandlerOptionalValuesStyleKind;
3258 
3259  ostream& fHandlerLogOstream;
3260 
3261  // this is needed to exit if the executable is launched
3262  // with one or more help options,
3263  // i.e. options that are only used to display help to the user
3264  bool fHandlerFoundAHelpOption;
3265 
3266  private:
3267 
3268  // private services
3269  // ------------------------------------------------------
3270 
3271  int getMaximumVariableNameWidth () const
3272  { return fMaximumVariableNameWidth; }
3273 
3274  private:
3275 
3276  // work fields
3277  // ------------------------------------------------------
3278 
3279  // all OAH elements are registered in the handler upon initialization
3280  list<S_oahElement> fHandlerRegisteredElementsList;
3281 
3282  // those ones have be used in the command line
3283  list<S_oahElement> fHandlerCommandLineElementsList;
3284  multiset<S_oahElement, compareOahElements>
3285  fHandlerCommandLineElementsMultiset;
3286 
3287  bool fNowEverythingIsAnArgument;
3288 
3289  oahOptionsDefaultValuesStyle
3290  fOahOptionsDefaultValuesStyle;
3291 
3292  int fMaximumSubGroupsHeadersSize;
3293 
3294  int fMaximumShortNameWidth;
3295  int fMaximumLongNameWidth;
3296 
3297  int fMaximumVariableNameWidth;
3298 
3299  S_oahValuedAtom fPendingValuedAtom;
3300 };
3302 EXP ostream& operator<< (ostream& os, const S_oahHandler& elt);
3303 
3304 
3305 }
3306 
3307 
3308 #endif
3309 
MusicXML2::oahFloatAtom
Definition: oahBasicTypes.h:1270
MusicXML2::oahOptionNameHelpAtom
Definition: oahBasicTypes.h:2626
MusicXML2::oahGroup
Definition: oahBasicTypes.h:2854
MusicXML2::oahElement
Definition: oahElements.h:51
MusicXML2::oahSubGroup
Definition: oahBasicTypes.h:2722
MusicXML2::oahStringSetAtom
Definition: oahBasicTypes.h:1969
MusicXML2::oahStringToIntMapAtom
Definition: oahBasicTypes.h:2059
MusicXML2::oahTwoIntegersAtom
Definition: oahBasicTypes.h:1179
MusicXML2::oahMidiTempoAtom
Definition: oahBasicTypes.h:2536
MusicXML2::oahRationalAtom
Definition: oahBasicTypes.h:1619
MusicXML2::smartable
the base class for smart pointers implementation
Definition: smartpointer.h:29
MusicXML2::oahHandler
Definition: oahBasicTypes.h:2979
MusicXML2::oahStringWithDefaultValueAtom
Definition: oahBasicTypes.h:1530
MusicXML2::oahPrefix
Definition: oahBasicTypes.h:771
MusicXML2::oahRGBColorAtom
Definition: oahBasicTypes.h:1793
MusicXML2::oahStringAtom
Definition: oahBasicTypes.h:1357
MusicXML2::msrRGBColor
Definition: msrBasicTypes.h:1401
MusicXML2::oahIntegerAtom
Definition: oahBasicTypes.h:1090
MusicXML2::oahTwoBooleansAtom
Definition: oahBasicTypes.h:497
MusicXML2::oahStringAndTwoIntegersAtom
Definition: oahBasicTypes.h:2251
MusicXML2::oahOptionsSummaryAtom
Definition: oahBasicTypes.h:275
MusicXML2::msrLength
Definition: msrBasicTypes.h:596
MusicXML2::oahCombinedBooleansAtom
Definition: oahBasicTypes.h:672
MusicXML2::oahMultiplexBooleansAtom
Definition: oahBasicTypes.h:867
MusicXML2::oahOptionsUsageAtom
Definition: oahBasicTypes.h:205
MusicXML2::oahNaturalNumbersSetAtom
Definition: oahBasicTypes.h:1706
MusicXML2::oahAtomSynonym
Definition: oahBasicTypes.h:134
MusicXML2::SMARTP< oahAtom >
MusicXML2::oahBooleanAtom
Definition: oahBasicTypes.h:419
MusicXML2::oahLengthAtom
Definition: oahBasicTypes.h:2449
MusicXML2::oahAtomWithVariableName
Definition: oahBasicTypes.h:345
MusicXML2::msrMidiTempo
Definition: msrMidi.h:26
MusicXML2::basevisitor
Definition: basevisitor.h:25
MusicXML2::oahThreeBooleansAtom
Definition: oahBasicTypes.h:582
MusicXML2::oahAtom
Definition: oahBasicTypes.h:59
MusicXML2::oahValuedAtom
Definition: oahBasicTypes.h:964
MusicXML2::oahStringAndIntegerAtom
Definition: oahBasicTypes.h:2146
MusicXML2::oahIntSetAtom
Definition: oahBasicTypes.h:1883
rational
Rational number representation.
Definition: rational.h:25
MusicXML2::indentedOstream
Definition: utilities.h:213
MusicXML2::oahLengthUnitKindAtom
Definition: oahBasicTypes.h:2362
MusicXML2::oahMonoplexStringAtom
Definition: oahBasicTypes.h:1444