opennurbs_parse.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(ON_PARSE_INC_)
18 #define ON_PARSE_INC_
19 
21 {
22 public:
28 
29  ////////////////////////////////////////////////////////////
30  //
31  // Configuration Settings
32  //
33  bool ImpliedMultiplication() const;
34  void SetImpliedMultiplication(
35  bool bEnable
36  );
37 
38 
39  ////////////////////////////////////////////////////////////
40  //
41  // Current Status
42  //
44  {
45  no_error = 0,
46 
47  program_error = 1,
48  // The part of the computer running the ON_ArithmeticCalculator
49  // code is corrupt or damaged or there is a bug in the
50  // ON_ArithmeticCalculator code.
51 
52  invalid_expression_error = 2,
53  // The input expression does not make sense.
54 
55  divide_by_zero_error = 3,
56  // A calculation requested division by zero.
57 
58  overflow_error = 4,
59  // A calculation produced a number the computer cannot represent
60  };
61 
62  ERROR_CONDITION ErrorCondition() const;
63 
64  /*
65  Returns:
66  True if a unary plus is pending and will be applied
67  to the next number or parenthetical expression.
68  */
69  bool PendingUnaryPlus() const;
70 
71  /*
72  Returns:
73  True if a unary minus is pending and will be applied
74  to the next number or parenthetical expression.
75  */
76  bool PendingUnaryMinus() const;
77 
78  /*
79  Returns:
80  True if a unary plus or unary minus is pending
81  */
82  bool PendingUnaryOperation() const;
83 
84  /*
85  Returns:
86  True if an implied multiplication will be applied
87  to the next number or parenthetical expression.
88  */
89  bool PendingImpliedMultiplication() const;
90 
91  /*
92  Returns:
93  The current number of parenthetic expressions that
94  are not completed.
95  */
96  unsigned int ParenthesesDepth() const;
97 
98  ////////////////////////////////////////////////////////////
99  //
100  // Calculator keys
101  //
102 
103  /*
104  Description:
105  Enter a number that can be used as an implied multiplication
106  operand when implied multiplication is enabled and appropriate.
107  */
108  bool Number(double x);
109 
110  /*
111  Description:
112  Enter a number that will never use implied multiplication.
113  */
114  bool SimpleNumber(double x);
115 
116  /*
117  Description:
118  Enter an explicit multiplication operator whose operands
119  are the previous value and the next value, where a value
120  is a number, simple number, or parenthetic expression.
121  */
122  bool Multiply();
123 
124  /*
125  Description:
126  Enter an explicit division operator whose operands
127  are the previous value and the next value, where a value
128  is a number, simple number, or parenthetic expression.
129  If the second value is zero, the calculator state
130  is set to error.
131  */
132  bool Divide();
133 
134  /*
135  Description:
136  Enter an explicit addition operator whose operands
137  are the previous value and the next value, where a value
138  is a number, simple number, or parenthetic expression.
139  */
140  bool Add();
141 
142  /*
143  Description:
144  Enter an explicit subtraction operator whose operands
145  are the previous value and the next value, where a value
146  is a number, simple number, or parenthetic expression.
147  */
148  bool Subtract();
149 
150  /*
151  Description:
152  Enter an unary plus operator whose operand is the next
153  number, simple number, or parenthetic expression.
154  */
155  bool UnaryPlus();
156 
157  /*
158  Description:
159  Enter an unary minus operator whose operand is the next
160  number, simple number, or parenthetic expression.
161  */
162  bool UnaryMinus();
163 
164  /*
165  Description:
166  Begin a parenthetic expression.
167  */
168  bool LeftParenthesis();
169 
170  /*
171  Description:
172  End a parenthetic expression.
173  */
174  bool RightParenthesis();
175 
176  /*
177  Description:
178  Calculate the current value.
179  */
180  bool Evaluate(double* value);
181 
182  /*
183  Description:
184  Clear all status, values and expressions.
185  */
186  void ClearAll();
187 
188 private:
189  class ON_ArithmeticCalculatorImplementation* m_pCalc;
190  double m_inplace_buffer[127]; // used for in-place construction of pCalc.
191 };
192 
193 class ON_CLASS ON_LengthUnitName
194 {
195 public:
196  ON_LengthUnitName() = default;
197  ~ON_LengthUnitName() = default;
198  ON_LengthUnitName(const ON_LengthUnitName&) = default;
199  ON_LengthUnitName& operator=(const ON_LengthUnitName&) = default;
200 
201  static const ON_LengthUnitName None;
202 
203  /*
204  Description:
205  Get list of length unit names and abbreviations and their corresponding
206  unit systems that are recognized by ON_ParseLengthUnitSystemName().
207 
208  Parameters:
209  length_unit_list_capacity - [in]
210  number of available elements in length_unit_list[]
211  If length_unit_list_capacity is zero and length_unit_list is null,
212  then the number of length unit names is returned.
213  length_unit_list - [out]
214  The list of length unit names is returned here.
215 
216  Returns:
217  Number of length unit names and abbreviations.
218 
219  Example:
220  unsigned int count = ON_GetLengthUnitNameList(0,0);
221  ON_UnitName* length_unit_list = new (std::nothrow) ON_UnitName[capacity];
222  count = ON_GetLengthUnitNameList(count,length_unit_list);
223  ...
224  delete[] length_unit_list;
225  Remarks:
226  If length_unit_list_capacity is zero and length_unit_list is null,
227  then the number of length unit names is returned.
228  */
229  static unsigned int GetLengthUnitNameList(
230  size_t length_unit_list_capacity,
231  class ON_LengthUnitName* length_unit_list
232  );
233 
234  static ON_LengthUnitName Create(
235  unsigned int locale_id,
236  ON::LengthUnitSystem length_unit_system,
237  bool bPlural
238  );
239 
240  /*
241  Description:
242  Dictionary compare of all ON_LengthUnitName information in the order
243  unit system, locale id, name, singular, plural
244  */
245  static int CompareUnitSystemLocaleIdName(
246  const ON_LengthUnitName& a,
247  const ON_LengthUnitName& b
248  );
249 
250  /*
251  Description:
252  Dictionary compare of all ON_LengthUnitName information in the order
253  locale id, unit system, name, singular, plural
254  */
255  static int CompareLocaleIdUnitSystemName(
256  const ON_LengthUnitName& a,
257  const ON_LengthUnitName& b
258  );
259 
260  unsigned int LocaleId() const;
261 
262  ON::LengthUnitSystem LengthUnit() const;
263 
264  /*
265  Returns:
266  True if the length unit system is set.
267  False if length unit system is ON::LengthUnitSystem::None or ON::LengthUnitSystem::Unset.
268  */
269  bool LengthUnitIsSet() const;
270 
271  /*
272  Returns:
273  True if the length unit system is set or is ON::LengthUnitSystem::None
274  */
275  bool LengthUnitIsSetOrNone() const;
276 
277  /*
278  Returns:
279  True if the length unit system is set and the name is not empty.
280  False if length unit system is ON::LengthUnitSystem::None or ON::LengthUnitSystem::Unset or the name is empty.
281  */
282  bool LengthUnitAndNameAreSet() const;
283 
284  /*
285  Returns:
286  A pointer to a localized length unit name or a pointer to an empty string.
287  Remarks:
288  Never returns nullptr.
289  */
290  const wchar_t* LengthUnitName() const;
291 
292  bool LengthUnitNameIsEmpty() const;
293 
294  bool LengthUnitNameIsNotEmpty() const;
295 
296  /*
297  Remarks:
298  True if the length unit name is singular in languages where that question
299  has a meaningful answer.
300  Remarks:
301  Some names and name abbreviations are both singular and plural.
302  */
303  bool LengthUnitNameIsSingular() const;
304 
305  /*
306  Remarks:
307  True if the length unit name is plural in languages where that question
308  has a meaningful answer.
309  Remarks:
310  Some names and name abbreviations are both singular and plural.
311  */
312  bool LengthUnitNameIsPlural() const;
313 
314 private:
315  // Microsoft locale id // http://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx
316  unsigned int m_locale_id = 0;
317  ON::LengthUnitSystem m_length_unit_system = ON::LengthUnitSystem::None;
318  bool m_bNameIsSingular = false;
319  bool m_bNameIsPlural = false;
320  const wchar_t* m_name = nullptr;
321 
322 private:
323  static int Internal_Compare(
324  unsigned int order_selector,
325  const ON_LengthUnitName& a,
326  const ON_LengthUnitName& b
327  );
328 };
329 
330 ON_DECL
331 bool operator==(
332  const ON_LengthUnitName& a,
333  const ON_LengthUnitName& b
334  );
335 
336 ON_DECL
337 bool operator!=(
338  const ON_LengthUnitName& a,
339  const ON_LengthUnitName& b
340  );
341 
342 class ON_CLASS ON_AngleUnitName
343 {
344 public:
345  ON_AngleUnitName() = default;
346  ~ON_AngleUnitName() = default;
347  ON_AngleUnitName(const ON_AngleUnitName&) = default;
348  ON_AngleUnitName& operator=(const ON_AngleUnitName&) = default;
349 
350  static const ON_AngleUnitName None;
351 
352  /*
353  Description:
354  Get list of angle unit names and abbreviations and their corresponding
355  unit systems that are recognized by ON_ParseAngleUnitName().
356 
357  Parameters:
358  angle_unit_list_capacity - [in]
359  number of available elements in angle_unit_list[]
360  If angle_unit_list_capacity is zero and angle_unit_list is null,
361  then the number of angle unit names is returned.
362  angle_unit_list - [out]
363  The list of angle unit names is returned here.
364 
365  Returns:
366  Number of angle unit names and abbreviations.
367 
368  Example:
369  unsigned int count = ON_GetAngleUnitNameList(0,0);
370  ON_UnitName* angle_unit_list = new (std::nothrow) ON_UnitName[capacity];
371  count = ON_GetAngleUnitNameList(count,angle_unit_list);
372  ...
373  delete[] angle_unit_list;
374  Remarks:
375  If angle_unit_list_capacity is zero and angle_unit_list is null,
376  then the number of angle unit names is returned.
377  */
378  static unsigned int GetAngleUnitNameList(
379  size_t angle_unit_list_capacity,
380  class ON_AngleUnitName* angle_unit_list
381  );
382 
383  static ON_AngleUnitName Create(
384  unsigned int locale_id,
385  ON::AngleUnitSystem angle_unit_system,
386  bool bPlural
387  );
388 
389  /*
390  Description:
391  Dictionary compare of all ON_LengthUnitName information in the order
392  unit system, locale id, name, singular, plural
393  */
394  static int CompareUnitSystemLocaleIdName(
395  const ON_AngleUnitName& a,
396  const ON_AngleUnitName& b
397  );
398 
399  /*
400  Description:
401  Dictionary compare of all ON_LengthUnitName information in the order
402  locale id, unit system, name, singular, plural
403  */
404  static int CompareLocaleIdUnitSystemName(
405  const ON_AngleUnitName& a,
406  const ON_AngleUnitName& b
407  );
408 
409  unsigned int LocaleId() const;
410 
411  ON::AngleUnitSystem AngleUnit() const;
412 
413  /*
414  Returns:
415  True if the angle unit system is set.
416  False if angle unit system is ON::AngleUnitSystem::None or ON::AngleUnitSystem::Unset.
417  */
418  bool AngleUnitIsSet() const;
419 
420  /*
421  Returns:
422  True if the angle unit system is set or is ON::AngleUnitSystem::None
423  */
424  bool AngleUnitIsSetOrNone() const;
425 
426  /*
427  Returns:
428  True if the angle unit system is set and the name is not empty.
429  False if length unit system is ON::AngleUnitSystem::None or ON::AngleUnitSystem::Unset or the name is empty.
430  */
431  bool AngleUnitAndNameAreSet() const;
432 
433 
434  /*
435  Returns:
436  A pointer to a localized angle unit name or a pointer to an empty string.
437  Remarks:
438  Never returns nullptr.
439  */
440  const wchar_t* AngleUnitName() const;
441 
442  bool AngleUnitNameIsEmpty() const;
443 
444  bool AngleUnitNameIsNotEmpty() const;
445 
446  /*
447  Remarks:
448  True if the angle unit name is singular in languages where that question
449  has a meaningful answer.
450  Remarks:
451  Some names and name abbreviations are both singular and plural.
452  */
453  bool AngleUnitNameIsSingular() const;
454 
455  /*
456  Remarks:
457  True if the angle unit name is plural in languages where that question
458  has a meaningful answer.
459  Remarks:
460  Some names and name abbreviations are both singular and plural.
461  */
462  bool AngleUnitNameIsPlural() const;
463 
464 private:
465  // Microsoft locale id // http://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx
466  unsigned int m_locale_id = 0;
467  ON::AngleUnitSystem m_angle_unit_system = ON::AngleUnitSystem::None;
468  bool m_bNameIsSingular = false;
469  bool m_bNameIsPlural = false;
470  const wchar_t* m_name = nullptr;
471 
472 private:
473  static int Internal_Compare(
474  unsigned int order_selector,
475  const ON_AngleUnitName& a,
476  const ON_AngleUnitName& b
477  );
478 };
479 
480 ON_DECL
481 bool operator==(
482  const ON_AngleUnitName& a,
483  const ON_AngleUnitName& b
484  );
485 
486 ON_DECL
487 bool operator!=(
488  const ON_AngleUnitName& a,
489  const ON_AngleUnitName& b
490  );
491 
492 class ON_CLASS ON_ParseSettings
493 {
494 public:
495  enum
496  {
497  // maximum number of wchar_t elements in a number
498  max_number_str_count = 2000,
499 
500  // maximum number of wchar_t elements in an expression
501  max_expression_str_count = 2147483645,
502  };
503 
504  /*
505  Description:
506  The default constuctor uses the default settings.
507  */
509 
510  /*
511  Description:
512  Default settings constructor sets the context information.
513  */
515  const class ON_UnitSystem& context_length_unit_system,
516  ON::AngleUnitSystem context_angle_unit_system,
517  unsigned int context_locale_id
518  );
520  ON::LengthUnitSystem context_length_unit_system,
521  ON::AngleUnitSystem context_angle_unit_system,
522  unsigned int context_locale_id
523  );
525  /*
526  Description:
527  - The default settings parse just about everything in
528  a reasonable way.
529  - Any angle values with unspecified units will be
530  treated as radians. Angles without units can be
531  encountered while parsing formulas, lengths and
532  points and need to be thoughtfully considered in
533  most parsing situations.
534  */
535  static const ON_ParseSettings DefaultSettings;
536 
537  /*
538  Description:
539  - The default settings parse just about everything in
540  a reasonable way.
541  - Any angle values with unspecified units will be
542  treated as radians. Angles without units can be
543  encountered while parsing formulas, lengths and
544  points and need to be thoughtfully considered in
545  most parsing situations.
546  */
547  static const ON_ParseSettings DefaultSettingsInRadians;
549  /*
550  Description:
551  - The default settings parse just about everything in
552  a reasonable way.
553  - Any angle values with unspecified units will be
554  treated as degrees. Angles without units can be
555  encountered while parsing formulas, lengths and
556  points and need to be thoughtfully considered in
557  most parsing situations.
558  */
559  static const ON_ParseSettings DefaultSettingsInDegrees;
561  /*
562  Description:
563  The integer settings parse and optional unary + or unary - and
564  then parses one or more digits. Parsing stops after the last
565  digit.
566  */
567  static const ON_ParseSettings IntegerNumberSettings;
568 
569  /*
570  Description:
571  The rational number settings parse and optional unary + or unary -
572  and then parse one or more digits. If a rational number fraction
573  bar follows the last digit in the numerator, then it is parsed
574  and an integer denominator is parsed. The denominator cannot
575  have a unary + or - preceding the digits. Parsing stops after
576  the last digit in the denominator.
577  */
578  static const ON_ParseSettings RationalNumberSettings;
579 
580  /*
581  Description:
582  The double number settings parse and optional unary + or unary -
583  and then parse a number that can be integer, decimal, or
584  scientific e notation.
585  */
586  static const ON_ParseSettings DoubleNumberSettings;
587 
588  /*
589  Description:
590  The real number settings parse and optional unary + or unary -
591  and then parse a number that can be integer, decimal,
592  scientific e notation or pi.
593  */
594  static const ON_ParseSettings RealNumberSettings;
595 
596  /*
597  Description:
598  ON_ParseSetting::FalseSettings has all parsing options
599  set to false.
600  Remarks:
601  A common use of ON_ParseSettings FalseSettings is to intialize
602  ON_ParseSettings classes that are used to report what happened
603  during parsing. Any parsing results value set to true after
604  parsing indicates that type of parsing occured.
605  */
606  static const ON_ParseSettings FalseSettings;
607 
608  static const int Compare(
609  const ON_ParseSettings* a,
610  const ON_ParseSettings* b
611  );
612 
613  ON_ParseSettings& operator|=(const ON_ParseSettings& other);
614  ON_ParseSettings& operator&=(const ON_ParseSettings& other);
615 
616 
617  /*
618  Remarks:
619  The default value is true.
620  */
621  bool ParseSpaceAsWhiteSpace() const;
622 
623  /*
624  Remarks:
625  The default value is true.
626  */
627  bool ParseNoBreakSpaceAsWhiteSpace() const;
628 
629  /*
630  Remarks:
631  The default value is true.
632  */
633  bool ParseHorizontalTabAsWhiteSpace() const;
634 
635  /*
636  Remarks:
637  The default value is true.
638  */
639  bool ParseThinSpaceAsWhiteSpace() const;
640 
641  /*
642  Remarks:
643  The default value is true.
644  */
645  bool ParseNoBreakThinSpaceAsWhiteSpace() const;
646 
647  /*
648  Remarks:
649  The default value is true.
650  */
651  bool ParseLineFeedAsLeadingWhiteSpace() const;
652 
653  /*
654  Remarks:
655  The default value is true.
656  */
657  bool ParseFormFeedAsLeadingWhiteSpace() const;
658 
659  /*
660  Remarks:
661  The default value is true.
662  */
663  bool ParseCarriageReturnAsLeadingWhiteSpace() const;
664 
665  /*
666  Remarks:
667  The default value is true.
668  */
669  bool ParseVerticalTabAsLeadingWhiteSpace() const;
670 
671  /*
672  Remarks:
673  The default value is true.
674  */
675  bool ParseLineFeedAsTrailingWhiteSpace() const;
676 
677  /*
678  Remarks:
679  The default value is true.
680  */
681  bool ParseFormFeedAsTrailingWhiteSpace() const;
682 
683  /*
684  Remarks:
685  The default value is true.
686  */
687  bool ParseCarriageReturnAsTrailingWhiteSpace() const;
688 
689  /*
690  Remarks:
691  The default value is true.
692  */
693  bool ParseVerticalTabAsTrailingWhiteSpace() const;
694 
695 
696  /*
697  Remarks:
698  The default value is true.
699  */
700  void SetParseSpaceAsWhiteSpace(
701  bool bParseSpaceAsWhiteSpace );
702 
703  /*
704  Remarks:
705  The default value is true.
706  */
707  void SetParseNoBreakSpaceAsWhiteSpace(
708  bool bParseNoBreakSpaceAsWhiteSpace );
709 
710  /*
711  Remarks:
712  The default value is true.
713  */
714  void SetParseHorizontalTabAsWhiteSpace(
715  bool bParseHorizontalTabAsWhiteSpace );
716 
717  /*
718  Remarks:
719  The default value is true.
720  */
721  void SetParseThinSpaceAsWhiteSpace(
722  bool bParseThinSpaceAsWhiteSpace );
723 
724  /*
725  Remarks:
726  The default value is true.
727  */
728  void SetParseNoBreakThinSpaceAsWhiteSpace(
729  bool bParseNoBreakThinSpaceAsWhiteSpace );
730 
731  /*
732  Remarks:
733  The default value is true.
734  */
735  void SetParseLineFeedAsLeadingWhiteSpace(
736  bool bParseLineFeedAsLeadingWhiteSpace );
737 
738  /*
739  Remarks:
740  The default value is true.
741  */
742  void SetParseFormFeedAsLeadingWhiteSpace(
743  bool bParseFormFeedAsLeadingWhiteSpace );
744 
745  /*
746  Remarks:
747  The default value is true.
748  */
749  void SetParseCarriageReturnAsLeadingWhiteSpace(
750  bool bParseCarriageReturnAsLeadingWhiteSpace );
751 
752  /*
753  Remarks:
754  The default value is true.
755  */
756  void SetParseVerticalTabAsLeadingWhiteSpace(
757  bool bParseVerticalTabAsLeadingWhiteSpace );
758 
759  /*
760  Remarks:
761  The default value is true.
762  */
763  void SetParseLineFeedAsTrailingWhiteSpace(
764  bool bParseLineFeedAsTrailingWhiteSpacee );
765 
766  /*
767  Remarks:
768  The default value is true.
769  */
770  void SetParseFormFeedAsTrailingWhiteSpace(
771  bool bParseParseFormFeedAsTrailingWhiteSpace );
772 
773  /*
774  Remarks:
775  The default value is true.
776  */
777  void SetParseCarriageReturnAsTrailingWhiteSpace(
778  bool bParseParseCarriageReturnAsTrailingWhiteSpace );
779 
780  /*
781  Remarks:
782  The default value is true.
783  */
784  void SetParseVerticalTabAsTrailingWhiteSpace(
785  bool bParseParseVerticalTabAsTrailingWhiteSpace );
786 
787 
788  /*
789  Returns:
790  True if leading white space should be parsed.
791  Remarks:
792  The default value is true.
793  */
794  bool ParseLeadingWhiteSpace() const;
795 
796  /*
797  Returns:
798  True if a aritimetic should be parsed in expressions.
799  Example:
800  If parsing expression arithmetic is enabled, then the
801  string "3/0.25" will return a value of 12.
802  Remarks:
803  - The default value is true.
804  - Currently multiplication and division are supported.
805  - When parsing pi is enabled, strings like "2pi" will
806  return 6.2831853071795865 even when parsing expression
807  arithmetic is disabled.
808  - When rational number or integer-dash-fraction parsing
809  is enabled, strings like 3/4 will return 0.75 even when
810  parsing expression arithmetic is disabled.
811  - Parsing functions with the word "Expression" in their name,
812  like ON_ParseNumberExpression, ON_ParseLengthExpression,
813  and ON_ParseAngleExpression, support arithmetic parsing.
814  */
815  bool ParseArithmeticExpression() const;
816 
817 
818  /*
819  Returns:
820  True if the math functions
821  sin, cos, tan
822  asin, acos, atan, atan2,
823  sinh, cosh, tanh,
824  ln, exp, log10, pow,
825  should be parsed in expressions.
826  Remarks:
827  - The default value is true.
828  - In functions that take 2 or more parameter values,
829  a comma is used to separate parameter values.
830  - Parentheses are used to delimit math function parameters;
831  for example sin(pi/4).
832  - The angle parameters to trigonometry functions may have angle
833  units specified. For example, sin(30degrees). If no angle
834  unit is specified, the nubmer is assumed to be in radians.
835  */
836  bool ParseMathFunctions() const;
837 
838  /*
839  Returns:
840  True if a formulae contained bracketed on the left by
841  =( and on the right by ) should be parsed in expressions.
842  Example:
843  If parsing expression formulae is enabled, then the string
844  "=((1+sqrt(5))/2)" will return a value of 1.6180339887498948.
845  Remarks:
846  - The default value is true.
847  - A formula is delimited at the start by =( and
848  terminated by a matching ).
849  - Parsing functions with the word "Expression" in their name,
850  like ON_ParseNumberExpression, ON_ParseLengthExpression,
851  and ON_ParseAngleExpression, support formula parsing.
852  */
853  bool ParseExplicitFormulaExpression() const;
854 
855  /*
856  Returns:
857  True if a number may begin with a unary minus.
858  Remarks:
859  The default value is true.
860  */
861  bool ParseUnaryMinus() const;
862 
863  /*
864  Returns:
865  True if a number may begin with a unary plus.
866  Remarks:
867  The default value is true.
868  */
869  bool ParseUnaryPlus() const;
870 
871  /*
872  Returns:
873  True if digits before a decimal point should be parsed
874  in a decimal number or scientific E notation number.
875  Remarks:
876  The default value is true.
877  */
878  bool ParseSignificandIntegerPart() const;
879 
880  /*
881  Returns:
882  True if the decimal points should be parsed
883  in a decimal number or scientific E notation number.
884  Remarks:
885  The default is true.
886  */
887  bool ParseSignificandDecimalPoint() const;
888 
889  /*
890  Returns:
891  True if digits after a decimal point should be parsed
892  in a decimal number or scientific E notation number.
893  Remarks:
894  The default is true.
895  */
896  bool ParseSignificandFractionalPart() const;
897 
898  /*
899  Returns:
900  True if digit separators should be parsed in a
901  decimal number or scientific E notation number.
902  Remarks:
903  The default value is true.
904  */
905  bool ParseSignificandDigitSeparators() const;
906 
907  /*
908  Returns:
909  True if a number may use scientific E notation to specify
910  mulitiplication by a power of 10.
911  Example:
912  If parsing scientific E notation is enables, then the string
913  "2.99792458e8" will be parsed as 2999792458.
914  Remarks:
915  - The default value is true.
916  - The "E" may be 'e', 'E', unicode decimal exponent symbol
917  (code point 0x23E8).
918  See Also:
919  ON_ParseSettings::ParseScientificDNotation.
920  */
921  bool ParseScientificENotation() const;
922 
923  /*
924  Returns:
925  True if a number may use scientific E notation may use
926  'D' or 'E' to specify mulitiplication by a power of 10.
927  Example:
928  If parsing 'D' as 'E' in scientific E notation is enabled,
929  then the string "2.99792458D8" will be parsed as 2999792458.
930  Remarks:
931  - The default value is false.
932  - The "D" may be 'd', 'D'.
933  - This feature is added to parse values in IGES files and
934  text generated by FORTRAN programs.
935  See Also:
936  ON_ParseSettings::ParseScientificENotation.
937  */
938  bool ParseDAsExponentInScientificENotation() const;
939 
940  /*
941  Returns:
942  True if a full stop (period) should be parsed as a decimal point.
943  Remarks:
944  - The default value is true.
945  See Also:
946  ON_ParseSettings::ParseCommaAsDecimalPoint()
947  ON_ParseSettings::ParseFullStopAsDigitSeparator()
948  ON_ParseSettings::ParseCommaAsDigitSeparator()
949  */
950  bool ParseFullStopAsDecimalPoint() const;
951 
952  /*
953  Returns:
954  True if a full stop (period) should be parsed as a digit separator.
955  Remarks:
956  - The default value is false.
957  See Also:
958  ON_ParseSettings::ParseFullStopAsDecimalPoint()
959  ON_ParseSettings::ParseCommaAsDecimalPoint()
960  ON_ParseSettings::ParseCommaAsDigitSeparator()
961  ON_ParseSettings::ParseSpaceAsDigitSeparator()
962  ON_ParseSettings::ParseThinSpaceAsDigitSeparator()
963  ON_ParseSettings::ParseNoBreakSpaceAsDigitSeparator()
964  ON_ParseSettings::ParseNoBreakThinSpaceAsDigitSeparator()
965  */
966  bool ParseFullStopAsDigitSeparator() const;
967 
968  /*
969  Returns:
970  True if a comma should be parsed as a decimal point.
971  Remarks:
972  - The default value is false.
973  See Also:
974  ON_ParseSettings::ParseFullStopAsDecimalPoint()
975  ON_ParseSettings::ParseFullStopAsDigitSeparator()
976  ON_ParseSettings::ParseCommaAsDigitSeparator()
977  */
978  bool ParseCommaAsDecimalPoint() const;
979 
980  /*
981  Returns:
982  True if a comma should be parsed as a digit separator.
983  Remarks:
984  - The default value is false.
985  See Also:
986  ON_ParseSettings::ParseFullStopAsDecimalPoint()
987  ON_ParseSettings::ParseCommaAsDecimalPoint()
988  ON_ParseSettings::ParseFullStopAsDigitSeparator()
989  ON_ParseSettings::ParseSpaceAsDigitSeparator()
990  ON_ParseSettings::ParseThinSpaceAsDigitSeparator()
991  ON_ParseSettings::ParseNoBreakSpaceAsDigitSeparator()
992  ON_ParseSettings::ParseNoBreakThinSpaceAsDigitSeparator()
993  */
994  bool ParseCommaAsDigitSeparator() const;
995 
996  /*
997  Returns:
998  True if a comma should be parsed as a digit separator.
999  Remarks:
1000  - The default value is false.
1001  See Also:
1002  ON_ParseSettings::ParseFullStopAsDigitSeparator()
1003  ON_ParseSettings::ParseCommaAsDigitSeparator()
1004  ON_ParseSettings::ParseSpaceAsDigitSeparator()
1005  ON_ParseSettings::ParseThinSpaceAsDigitSeparator()
1006  ON_ParseSettings::ParseNoBreakSpaceAsDigitSeparator()
1007  ON_ParseSettings::ParseNoBreakThinSpaceAsDigitSeparator()
1008  */
1009  bool ParseSpaceAsDigitSeparator() const;
1010 
1011  /*
1012  Returns:
1013  True if a comma should be parsed as a digit separator.
1014  Remarks:
1015  - The default value is false.
1016  See Also:
1017  ON_ParseSettings::ParseFullStopAsDigitSeparator()
1018  ON_ParseSettings::ParseCommaAsDigitSeparator()
1019  ON_ParseSettings::ParseSpaceAsDigitSeparator()
1020  ON_ParseSettings::ParseThinSpaceAsDigitSeparator()
1021  ON_ParseSettings::ParseNoBreakSpaceAsDigitSeparator()
1022  ON_ParseSettings::ParseNoBreakThinSpaceAsDigitSeparator()
1023  */
1024  bool ParseThinSpaceAsDigitSeparator() const;
1025 
1026  /*
1027  Returns:
1028  True if a comma should be parsed as a digit separator.
1029  Remarks:
1030  - The default value is false.
1031  See Also:
1032  ON_ParseSettings::ParseFullStopAsDigitSeparator()
1033  ON_ParseSettings::ParseCommaAsDigitSeparator()
1034  ON_ParseSettings::ParseSpaceAsDigitSeparator()
1035  ON_ParseSettings::ParseThinSpaceAsDigitSeparator()
1036  ON_ParseSettings::ParseNoBreakSpaceAsDigitSeparator()
1037  ON_ParseSettings::ParseNoBreakThinSpaceAsDigitSeparator()
1038  */
1039  bool ParseNoBreakSpaceAsDigitSeparator() const;
1040 
1041  /*
1042  Returns:
1043  True if a comma should be parsed as a digit separator.
1044  Remarks:
1045  - The default value is true.
1046  See Also:
1047  ON_ParseSettings::ParseFullStopAsDigitSeparator()
1048  ON_ParseSettings::ParseCommaAsDigitSeparator()
1049  ON_ParseSettings::ParseSpaceAsDigitSeparator()
1050  ON_ParseSettings::ParseThinSpaceAsDigitSeparator()
1051  ON_ParseSettings::ParseNoBreakSpaceAsDigitSeparator()
1052  ON_ParseSettings::ParseNoBreakThinSpaceAsDigitSeparator()
1053  */
1054  bool ParseNoBreakThinSpaceAsDigitSeparator() const;
1055 
1056  /*
1057  Returns:
1058  True if a unicode hyphen-minus (code point 0x002D) should be parsed
1059  as a number dash during integer-dash-fraction parsing.
1060  Remarks:
1061  - The default value is true. This is because the hyphen-minus
1062  character is the easiest to type.
1063  - For robust parsing, use the unicode figure dash (code point 0x2012)
1064  to specify a number dash.
1065  See Also:
1066  ON_ParseSettings::ParseIntegerDashFraction()
1067  ON_ParseSettings::ParseHyphenMinusAsNumberDash()
1068  ON_ParseSettings::ParseHyphenAsNumberDash()
1069  ON_ParseSettings::ParseNoBreakHyphenAsNumberDash()
1070  */
1071  bool ParseHyphenMinusAsNumberDash() const;
1072 
1073  /*
1074  Returns:
1075  True if a unicode hyphen (code point 0x2010) should be parsed
1076  as a number dash during integer-dash-fraction parsing.
1077  Remarks:
1078  - The default value is false.
1079  - For robust parsing, use the unicode figure dash (code point 0x2012)
1080  to specify a number dash.
1081  See Also:
1082  ON_ParseSettings::ParseIntegerDashFraction()
1083  ON_ParseSettings::ParseHyphenMinusAsNumberDash()
1084  ON_ParseSettings::ParseHyphenAsNumberDash()
1085  ON_ParseSettings::ParseNoBreakHyphenAsNumberDash()
1086  */
1087  bool ParseHyphenAsNumberDash() const;
1088 
1089  /*
1090  Returns:
1091  True if a unicode non-breaking hyphen (code point 0x2011)
1092  should be parsed as a number dash during integer-dash-fraction
1093  parsing.
1094  Remarks:
1095  - The default value is false.
1096  - For robust parsing, use the unicode figure dash (code point 0x2012)
1097  to specify a number dash.
1098  See Also:
1099  ON_ParseSettings::ParseIntegerDashFraction()
1100  ON_ParseSettings::ParseHyphenMinusAsNumberDash()
1101  ON_ParseSettings::ParseHyphenAsNumberDash()
1102  ON_ParseSettings::ParseNoBreakHyphenAsNumberDash()
1103  */
1104  bool ParseNoBreakHyphenAsNumberDash() const;
1105 
1106  /*
1107  Returns:
1108  True if rational numbers should be parsed.
1109  Example:
1110  If this property is true, then strings "3/4" and "8/5"
1111  will be parsed. The numerator and denominator must
1112  parse as integers. If you: decimal points and scientific notation
1113  cannot appear
1114  Remarks:
1115  - The default value is true.
1116  - The numerator and denominator must be integers.
1117  - Strings like "1.0/3.0", "3.5/2" or "pi/2" are not parsed
1118  as rational numbers. Use ON_ParseSettings::ParseDivision
1119  to constrol parsing of these types of strings.
1120  */
1121  bool ParseRationalNumber() const;
1122 
1123  /*
1124  Returns:
1125  True if the value of pi may be specified as "pi", "PI",
1126  "Pi", "pI", unicode Greek capital letter pi (code point 0x03A0),
1127  or unicode Greek small letter pi (code point 0x03C0).
1128  Example:
1129  If this property is true, then strings "pi", "PI", "Pi", "pI",
1130  L"\x03A0" (unicode greek capital letter pi) and
1131  L"\x03C0" (unicode greek small letter pi)
1132  will be parsed as if they were "3.141592653589793238462643".
1133  In addition, if the pi strings appear next to something that
1134  is parsed as a number, the result will be mulitplied by pi.
1135  For example,
1136  "3pi" and pi3.0 will return 3.0*ON_PI.
1137  If division parsing is enabled, then "3pi/4" and 3/4pi" will
1138  return 0.75*ON_PI.
1139  Remarks:
1140  The default value is true.
1141  */
1142  bool ParsePi() const;
1143 
1144  /*
1145  Returns:
1146  True if muliplication signs that appear between numbers will be
1147  parsed.
1148  Example:
1149  If this property is true, then strings like 2*3 will be parsed
1150  as 6.0
1151  Remarks:
1152  - The default value is true.
1153  - Parsing functions with the word "Expression" in their name,
1154  like ON_ParseNumberExpression, ON_ParseLengthExpression,
1155  and ON_ParseAngleExpression, support mulitplication parsing.
1156  */
1157  bool ParseMultiplication() const;
1158 
1159  /*
1160  Returns:
1161  True if division signs that appear between numbers will be
1162  parsed.
1163  Example:
1164  If this property is true, then strings like 1/4 will be parsed
1165  as 0.25.
1166  Remarks:
1167  - The default value is true.
1168  - Parsing functions with the word "Expression" in their name,
1169  like ON_ParseNumberExpression, ON_ParseLengthExpression,
1170  and ON_ParseAngleExpression, support division parsing.
1171  */
1172  bool ParseDivision() const;
1173 
1174  /*
1175  Returns:
1176  True if addition signs that appear between numbers will be
1177  parsed.
1178  Example:
1179  If this property is true, then strings like 1+2 will be parsed
1180  as 3.
1181  Remarks:
1182  - The default value is true.
1183  - Parsing functions with the word "Expression" in their name,
1184  like ON_ParseNumberExpression, ON_ParseLengthExpression,
1185  and ON_ParseAngleExpression, support division parsing.
1186  */
1187  bool ParseAddition() const;
1188 
1189  /*
1190  Returns:
1191  True if subtraction signs that appear between numbers will be
1192  parsed.
1193  Example:
1194  If this property is true, then strings like 2-1 will be parsed
1195  as 1.
1196  Remarks:
1197  - The default value is true.
1198  - Parsing functions with the word "Expression" in their name,
1199  like ON_ParseNumberExpression, ON_ParseLengthExpression,
1200  and ON_ParseAngleExpression, support division parsing.
1201  */
1202  bool ParseSubtraction() const;
1203 
1204 
1205  /*
1206  Returns:
1207  True if paired arentheses symbols that are encountered during
1208  number parsing will be parsed.
1209  Example:
1210  If this property is true, then strings like 2(3+4) will be parsed
1211  as 14.
1212  Remarks:
1213  - The default value is true.
1214  - Parsing functions with the word "Expression" in their name,
1215  like ON_ParseNumberExpression, ON_ParseLengthExpression,
1216  and ON_ParseAngleExpression, support division parsing.
1217  */
1218  bool ParsePairedParentheses() const;
1219 
1220  /*
1221  Returns:
1222  True if a number may be specified as an integer followed by
1223  a dash and a fraction.
1224  Example:
1225  If this property is true, then the string "4-3/8" will return
1226  a value of 4.375.
1227  Remarks:
1228  - The default value is true.
1229  - The numerator must be an integer > 0.
1230  - The denominator must be greater than the numerator.
1231  - ON_ParseSettings::IsNumberDash() controls what characters
1232  are interpreted as number dashes.
1233  See Also:
1234  ON_ParseSettings::ParseRationalNumber()
1235  */
1236  bool ParseIntegerDashFraction() const;
1237 
1238  /*
1239  Returns:
1240  True if a length value may be specified as combination
1241  of US customary feet and inch lengths.
1242  Example:
1243  If this property is true, then strings like these
1244  1'-4-3/8"
1245  1ft-3-3/8in
1246  1'4.375"
1247  1.0feet4.375inches
1248  will be parsed as 16.375 inches.
1249  Remarks:
1250  The default value is true.
1251  */
1252  bool ParseFeetInches() const;
1253 
1254  /*
1255  Returns:
1256  True if an angle value may be specified as a combination of
1257  arc degrees, arc minutes and arc seconds.
1258  Example:
1259  If this property is true, then strings like these
1260  2degrees30minutes
1261  2deg30'
1262  will be parsed as 2.0*60.0 + 30.0 arc minutes
1263  2degrees14minutes15seconds
1264  2deg14'15"
1265  will be parsed as (2*60.0 + 14.0)*60.0 + 15.0 arc seconds.
1266  Remarks:
1267  The default value is true.
1268  */
1269  bool ParseArcDegreesMinutesSeconds() const;
1270 
1271 
1272  /*
1273  Returns:
1274  True if whitespace between a value and unit system will
1275  is permitted.
1276  Example:
1277  If this property is true, then strings like these
1278  2 meters
1279  2meters
1280  2 m
1281  2m
1282  will be parsed as 2 meters
1283  Remarks:
1284  The default value is true.
1285  */
1286  bool ParseWhiteSpaceBetweenValueAndUnitSystem() const;
1287 
1288  /*
1289  Returns:
1290  True if whitespace between a length in feet and a length in inches
1291  will is permitted.
1292  Example:
1293  If this property is true, then strings like these
1294  1'3"
1295  1' 3"
1296  1ft3in
1297  1ft 3in
1298  will be parsed as 15 inches
1299  Remarks:
1300  The default value is true.
1301  */
1302  bool ParseWhiteSpaceBetweenFeetAndInches() const;
1303 
1304 
1305  /*
1306  Returns:
1307  True if an angle values may be specified using surveyor's notation.
1308  Example:
1309  If this property is true, then strings like these
1310  N30W
1311  S12<degree symbol>15'22"W
1312  N45.7899E
1313  S47'E
1314  will be parsed as angles.
1315  Remarks:
1316  The first character must be N, n, S or s.
1317  The angle must be a spcified as a combination of arc degrees,
1318  arc minutes and arc seconds.
1319  The last character must be E, e, W or w.
1320  */
1321  bool ParseSurveyorsNotation() const;
1322 
1323  /*
1324  Returns:
1325  The Microsoft locale id that identifies the locale that should
1326  be used to resolve ambiguous parsing situtations. The default
1327  value is zero, which means ambiguous situations are not parsed.
1328  Example:
1329  When parsing angles, the string "Grad" is ambiguous.
1330  In German "Grad" identifies arc degree angle units and in
1331  English "Grad" identifies gradian angle units. If angle parsing
1332  encounters "Grad", it uses the value of ContextLocaleId()
1333  to determine what arc unit system is being identified.
1334  */
1335  unsigned int ContextLocaleId() const;
1336 
1337  /*
1338  Returns:
1339  The default angle unit system that is used when a value must be
1340  parsed as an angle and no angle unit system is explicitly or
1341  implicitly specified.
1342  */
1343  ON::LengthUnitSystem ContextLengthUnitSystem() const;
1344 
1345  /*
1346  Returns:
1347  The default angle unit system that is used when a value must be
1348  parsed as an angle and no angle unit system is explicitly or
1349  implicitly specified.
1350  */
1351  ON::AngleUnitSystem ContextAngleUnitSystem() const;
1352 
1353  /*
1354  Description:
1355  Deprecated. Use ContextLocaleId().
1356  */
1357  // ON_DEPRECTATED
1358  unsigned int PreferedLocaleId() const;
1359 
1360  /*
1361  Description:
1362  Deprecated. Use ContextAngleUnitSystem().
1363  */
1364  // ON_DEPRECTATED
1365  ON::AngleUnitSystem DefaultAngleUnitSystem() const;
1366 
1367  /*
1368  Parameters:
1369  c - [in]
1370  Returns:
1371  True if c should be parsed as leading white space
1372  */
1373  bool IsLeadingWhiteSpace(ON__UINT32 c) const;
1374 
1375  /*
1376  Parameters:
1377  c - [in]
1378  Returns:
1379  True if c should be parsed as trailing white space
1380  */
1381  bool IsTrailingWhiteSpace(ON__UINT32 c) const;
1382 
1383  /*
1384  Parameters:
1385  c - [in]
1386  Returns:
1387  True if c should be parsed as interior white space.
1388  */
1389  bool IsInteriorWhiteSpace(ON__UINT32 c) const;
1390 
1391  /*
1392  Parameters:
1393  c - [in]
1394  Returns:
1395  True if c should be parsed as unary minus
1396  */
1397  bool IsUnaryMinus(ON__UINT32 c) const;
1398 
1399  /*
1400  Parameters:
1401  c - [in]
1402  Returns:
1403  True if c should be parsed as unary plus
1404  */
1405  bool IsUnaryPlus(ON__UINT32 c) const;
1406 
1407  /*
1408  Parameters:
1409  c - [in]
1410  Returns:
1411  Returns '0' throught '9' if c is a digit, otherwise returns 0.
1412  */
1413  char IsDigit(ON__UINT32 c) const;
1414 
1415  /*
1416  Parameters:
1417  c - [in]
1418  Returns:
1419  True if c should be parsed as a digit separator
1420  */
1421  bool IsDigitSeparator(ON__UINT32 c) const;
1422 
1423  /*
1424  Parameters:
1425  c - [in]
1426  Returns:
1427  True if c should be parsed as a decimal point
1428  */
1429  bool IsDecimalPoint(ON__UINT32 c) const;
1430 
1431  /*
1432  Parameters:
1433  c - [in]
1434  Returns:
1435  True if c should be parsed as decimal exponent symbol
1436  */
1437  bool IsDecimalExponentSymbol(ON__UINT32 c) const; // e E (optionally d and/or D)
1438 
1439  /*
1440  Parameters:
1441  c - [in]
1442  Returns:
1443  True if c is 0x03A or 0x03C
1444  */
1445  bool IsGreekPi(ON__UINT32 c) const;
1446 
1447  /*
1448  Parameters:
1449  c - [in]
1450  Returns:
1451  True if c should be parsed as a multiplication operator
1452  */
1453  bool IsMultiplicationSymbol(ON__UINT32 c) const;
1454 
1455  /*
1456  Parameters:
1457  c - [in]
1458  Returns:
1459  True if c should be parsed as a division operator
1460  */
1461  bool IsDivisionSymbol(ON__UINT32 c) const;
1462 
1463  /*
1464  Parameters:
1465  c - [in]
1466  Returns:
1467  True if c should be parsed as an addition operator
1468  */
1469  bool IsAdditionSymbol(ON__UINT32 c) const;
1470 
1471  /*
1472  Parameters:
1473  c - [in]
1474  Returns:
1475  True if c should be parsed as a subtraction operator
1476  */
1477  bool IsSubtractionSymbol(ON__UINT32 c) const;
1478 
1479  /*
1480  Parameters:
1481  c - [in]
1482  Returns:
1483  True if c should be parsed as a left parenthesis symbol
1484  */
1485  bool IsLeftParenthesisSymbol(ON__UINT32 c) const;
1486 
1487  /*
1488  Parameters:
1489  c - [in]
1490  Returns:
1491  True if c should be parsed as a right parenthesis symbol
1492  */
1493  bool IsRightParenthesisSymbol(ON__UINT32 c) const;
1494 
1495  /*
1496  Parameters:
1497  c - [in]
1498  Returns:
1499  True if c should be parsed as a rational number fraction bar
1500  */
1501  bool IsRationalNumberFractionBar(ON__UINT32 c) const;
1502 
1503  /*
1504  Parameters:
1505  c - [in]
1506  Returns:
1507  True if c should be parsed as number dash when parsing
1508  strings like "1-3/4".
1509  */
1510  bool IsNumberDash(ON__UINT32 c) const;
1511 
1512  /*
1513  Parameters:
1514  bParseLeadingWhiteSpace - [in]
1515  True if leading white space should be parsed.
1516  Remarks:
1517  See ON_ParseSettings::ParseLeadingWhiteSpace()
1518  for details about this property.
1519  */
1520  void SetParseLeadingWhiteSpace(
1521  bool bParseLeadingWhiteSpace
1522  );
1523 
1524  /*
1525  Parameters:
1526  bParseArithmeticExpression - [in]
1527  True if formulae should be parsed.
1528  Remarks:
1529  See ON_ParseSettings::ParseArithmeticExpression()
1530  for details about this property.
1531  */
1532  void SetParseArithmeticExpression(
1533  bool bParseArithmeticExpression
1534  );
1535 
1536  /*
1537  Parameters:
1538  bParseMathFunctions - [in]
1539  True if math functions should be parsed in expressions.
1540  Remarks:
1541  See ON_ParseSettings::ParseMathFunctions()
1542  for details about this property.
1543  */
1544  void SetParseMathFunctions(
1545  bool bParseMathFunctions
1546  );
1547 
1548  /*
1549  Parameters:
1550  bParseExplicitFormulaExpression - [in]
1551  True if explicity formulae should be parsed.
1552  Remarks:
1553  See ON_ParseSettings::ParseExplicitFormulaExpression()
1554  for details about this property.
1555  */
1556  void SetParseExplicitFormulaExpression(
1557  bool bParseExplicitFormulaExpression
1558  );
1559 
1560  /*
1561  Parameters:
1562  bParseUnaryMinus - [in]
1563  True if unary minus should be parsed.
1564  Remarks:
1565  See ON_ParseSettings::ParseUnaryMinus()
1566  for details about this property.
1567  */
1568  void SetParseUnaryMinus(
1569  bool bParseUnaryMinus
1570  );
1571 
1572  /*
1573  Parameters:
1574  bParseUnaryPlus - [in]
1575  True if unary plus should be parsed.
1576  Remarks:
1577  See ON_ParseSettings::ParseUnaryPlus()
1578  for details about this property.
1579  */
1580  void SetParseUnaryPlus(
1581  bool bParseUnaryPlus
1582  );
1583 
1584  /*
1585  Parameters:
1586  bParseSignificandIntegerPart - [in]
1587  True if digits before a decimal point in a decimal
1588  number or the significand of a scientific E notation
1589  number should be parsed.
1590  Remarks:
1591  See ON_ParseSettings::ParseSignificandIntegerPart()
1592  for details about this property.
1593  */
1594  void SetParseSignificandIntegerPart(
1595  bool bParseSignificandIntegerPart
1596  );
1597 
1598  /*
1599  Parameters:
1600  bParseSignificandDecimalPoint - [in]
1601  True if a decimal point in a decimal point in a decimal
1602  number or the significand of a scientific E notation
1603  number should be parsed.
1604  Remarks:
1605  See ON_ParseSettings::ParseSignificandDecimalPoint()
1606  for details about this property.
1607  */
1608  void SetParseSignificandDecimalPoint(
1609  bool bParseSignificandDecimalPoint
1610  );
1611 
1612  /*
1613  Parameters:
1614  bParseSignificandFractionalPart - [in]
1615  True if digits after the decimal point in a decimal
1616  number or the significand of a scientific E notation
1617  number should be parsed.
1618  Remarks:
1619  See ON_ParseSettings::ParseSignificandFractionalPart()
1620  for details about this property.
1621  */
1622  void SetParseSignificandFractionalPart(
1623  bool bParseSignificandFractionalPart
1624  );
1625 
1626  /*
1627  Parameters:
1628  bParseSignificandDigitSeparators - [in]
1629  True if digit separators in a decimal number or a significand
1630  of a scientific E notation number should be parsed.
1631  Remarks:
1632  See ON_ParseSettings::ParseSignificandDigitSeparators()
1633  for details about this property.
1634  */
1635  void SetParseSignificandDigitSeparators(
1636  bool bParseSignificandDigitSeparators
1637  );
1638 
1639  /*
1640  Parameters:
1641  bDecimalPoint - [in]
1642  True if a decimal point should be parsed.
1643  Remarks:
1644  See ON_ParseSettings::ParseDecimalPoint()
1645  for details about this property.
1646  */
1647  void SetParseDecimalPoint(
1648  bool bParseDecimalPoint
1649  );
1650 
1651  /*
1652  Parameters:
1653  bParseDAsExponentInScientificENotation - [in]
1654  True if both 'D' and 'E' can mark the beginning
1655  of the exponent in scientific E notation.
1656  Remarks:
1657  See ON_ParseSettings::ParseDAsExponentInScientificENotation()
1658  for details about this property.
1659  */
1660  void SetParseDAsExponentInScientificENotation(
1661  bool bParseDAsExponentInScientificENotation
1662  );
1663 
1664  /*
1665  Parameters:
1666  bParseScientificENotation - [in]
1667  True if scientific E notation should be parsed.
1668  Remarks:
1669  See ON_ParseSettings::ParseScientificENotation()
1670  for details about this property.
1671  */
1672  void SetParseScientificENotation(
1673  bool bParseScientificENotation
1674  );
1675 
1676  void SetParseFullStopAsDecimalPoint( bool bParse );
1677  void SetParseFullStopAsDigitSeparator( bool bParse );
1678  void SetParseCommaAsDecimalPoint( bool bParse );
1679  void SetParseCommaAsDigitSeparator( bool bParse );
1680  void SetParseSpaceAsDigitSeparator( bool bParse );
1681  void SetParseThinSpaceAsDigitSeparator( bool bParse );
1682  void SetParseNoBreakSpaceAsDigitSeparator( bool bParse );
1683  void SetParseNoBreakThinSpaceAsDigitSeparator( bool bParse );
1684  void SetParseHyphenMinusAsNumberDash( bool bParse );
1685  void SetParseHyphenAsNumberDash( bool bParse );
1686  void SetParseNoBreakHyphenAsNumberDash( bool bParse );
1687 
1688  /*
1689  Parameters:
1690  bParseRationalNumber - [in]
1691  True if rational numbers like 3/4 and 8/5
1692  should be parsed.
1693  Remarks:
1694  See ON_ParseSettings::ParseRationalNumber()
1695  for details about this property.
1696  */
1697  void SetParseRationalNumber(
1698  bool bParseRationalNumber
1699  );
1700 
1701  /*
1702  Parameters:
1703  bParsePi - [in]
1704  True if number parsing should treat "PI", "Pi" "pi",
1705  and unicode code points 0x03A0 and 0x03C0 as
1706  3.141592653589793238462643.
1707  Remarks:
1708  See ON_ParseSettings::ParsePi()
1709  for details about this property.
1710  */
1711  void SetParsePi(
1712  bool bParsePi
1713  );
1714 
1715  /*
1716  Parameters:
1717  bParseMultiplication - [in]
1718  True if muiltiplication should be permitted in number parsing.
1719  Remarks:
1720  See ON_ParseSettings::ParseMultiplication()
1721  for details about this property.
1722  */
1723  void SetParseMultiplication(
1724  bool bParseMultiplication
1725  );
1726 
1727  /*
1728  Parameters:
1729  bParseDivision - [in]
1730  True if division should be permitted in number parsing.
1731  Remarks:
1732  See ON_ParseSettings::ParseDivision()
1733  for details about this property.
1734  */
1735  void SetParseDivision(
1736  bool bParseDivision
1737  );
1738 
1739  /*
1740  Parameters:
1741  bParseDivision - [in]
1742  True if addition should be permitted in number parsing.
1743  Remarks:
1744  See ON_ParseSettings::ParseAddition()
1745  for details about this property.
1746  */
1747  void SetParseAddition(
1748  bool bParseAddition
1749  );
1750 
1751  /*
1752  Parameters:
1753  bParseDivision - [in]
1754  True if subtraction should be permitted in number parsing.
1755  Remarks:
1756  See ON_ParseSettings::ParseSubtraction()
1757  for details about this property.
1758  */
1759  void SetParseSubtraction(
1760  bool bParseSubtraction
1761  );
1762 
1763  /*
1764  Parameters:
1765  bParseDivision - [in]
1766  True if paired parentheses should be permitted in number parsing.
1767  Remarks:
1768  See ON_ParseSettings::PairedParentheses()
1769  for details about this property.
1770  */
1771  void SetParsePairedParentheses(
1772  bool bParsePairedParentheses
1773  );
1774 
1775  /*
1776  Parameters:
1777  bParseIntegerDashFraction - [in]
1778  True if strings like "5-3/8" should be parsed as
1779  a single number
1780  Remarks:
1781  See ON_ParseSettings::ParseIntegerDashFraction()
1782  for details about this property.
1783  */
1784  void SetParseIntegerDashFraction(
1785  bool bParseIntegerDashFraction
1786  );
1787 
1788  /*
1789  Parameters:
1790  bParseFeetInches - [in]
1791  True if length value parsing should parse strings
1792  like 1'4-3/8" and return a length value of 16.375 inches.
1793  Remarks:
1794  See ON_ParseSettings::ParseFeetInches()
1795  for details about this property.
1796  */
1797  void SetParseFeetInches(
1798  bool bParseFeetInches
1799  );
1800 
1801  /*
1802  Parameters:
1803  bParseArcDegreesMinutesSeconds - [in]
1804  True if angle value parsing should parse strings
1805  like 2deg17'15" and return a length value of
1806  ((2.0*60.0 + 17..0)*60.0 + 15.0) arc seconds
1807  Remarks:
1808  See ON_ParseSettings::ParseArcDegreesMinutesSeconds()
1809  for details about this property.
1810  */
1811  void SetParseArcDegreesMinutesSeconds(
1812  bool bParseArcDegreesMinutesSeconds
1813  );
1814 
1815  /*
1816  Parameters:
1817  bParseWhiteSpaceBetweenValueAndUnitSystem - [in]
1818  True if then strings like these
1819  2 meters
1820  2meters
1821  2 m
1822  2m
1823  should be parsed as 2 meters.
1824  Remarks:
1825  See ON_ParseSettings::ParseWhiteSpaceBetweenValueAndUnitSystem()
1826  for details about this property.
1827  */
1828  void SetParseWhiteSpaceBetweenValueAndUnitSystem(
1829  bool bParseWhiteSpaceBetweenValueAndUnitSystem
1830  );
1831 
1832  /*
1833  Parameters:
1834  bParseWhiteSpaceBetweenFeetAndInches - [in]
1835  True if strings like these
1836  1' 3"
1837  1ft 3in
1838  will be parsed as 15 inches
1839  Remarks:
1840  See ON_ParseSettings::ParseWhiteSpaceBetweenFeetAndInches()
1841  for details about this property.
1842  */
1843  void SetParseWhiteSpaceBetweenFeetAndInches(
1844  bool bParseWhiteSpaceBetweenFeetAndInches
1845  );
1846 
1847  /*
1848  Parameters:
1849  bParseSurveyorsNotation - [in]
1850  True if angle value parsing should parse
1851  surveyor's notation like N30W.
1852  Remarks:
1853  See ON_ParseSettings::ParseSurveyorsNotation()
1854  for details about this property.
1855  */
1856  void SetParseSurveyorsNotation(
1857  bool bParseSurveyorsNotation
1858  );
1859 
1860  /*
1861  Description:
1862  Set the prefered locale id for parsing unit names. This local
1863  id is used to resolve ambiguous unit names.
1864 
1865  Parameters:
1866  prefered_locale_id - [in]
1867  The Microsoft locale id that identifies the locale that should
1868  be used to resolve ambiguous parsing situtations. The default
1869  value is zero, which means ambiguous situations are not parsed.
1870 
1871  Example:
1872  When parsing angles, the string "Grad" is ambiguous.
1873  In German "Grad" identifies arc degree angle units and in
1874  English "Grad" identifies gradian angle units. If angle parsing
1875  encounters "Grad" and the prefered locale id is 1031 (de-de),
1876  then parsing reports the angle value as arc degree units.
1877  If angle parsing encounters "Grad" and the prefered locale id
1878  is 1033 (en-us), then parsing reports the angle values as
1879  gradian units.
1880  */
1881  void SetContextLocaleId(
1882  unsigned int context_locale_id
1883  );
1884 
1885  /*
1886  Description:
1887  The context angle unit system determines what length unit system
1888  is used when a value must be parsed as a length with units and no
1889  length unit system is explicitly or implicitly specified. The default
1890  is ON::LengthUnitSystem::None.
1891 
1892  Parameters:
1893  context_length_unit_system - [in]
1894  ON::LengthUnitSystem::Custom and ON::LengthUnitSystem::Unset
1895  select ON::LengthUnitSystem::None.
1896  */
1897  void SetContextLengthUnitSystem(
1898  ON::LengthUnitSystem context_length_unit_system
1899  );
1900 
1901  /*
1902  Description:
1903  The context angle unit system determines what angle unit system
1904  is used when a value must be parsed as an angle and no angle
1905  unit system is explicitly or implicitly specified. The default
1906  is ON::LengthUnitSystem::Radians.
1907 
1908  Parameters:
1909  default_angle_unit_system - [in]
1910  ON::AngleUnitSystem::None and ON::AngleUnitSystem::Unset
1911  select ON::LengthUnitSystem::Radians.
1912  */
1913  void SetContextAngleUnitSystem(
1914  ON::AngleUnitSystem context_angle_unit_system
1915  );
1916 
1917  /*
1918  Description:
1919  Deprecated. Use SetConextLocaleId().
1920  */
1921  // ON_DEPRECTATED
1922  void SetPreferedLocaleId(
1923  unsigned int context_locale_id
1924  );
1925  /*
1926  Description:
1927  Deprecated. Use SetContextAngleUnitSystem().
1928  */
1929  // ON_DEPRECTATED
1930  void SetDefaultAngleUnitSystem(
1931  ON::AngleUnitSystem context_angle_unit_system
1932  );
1933 
1934  /*
1935  Description:
1936  Set every possible setting to false or zero.
1937  */
1938  void SetAllToFalse();
1939 
1940 
1941  /*
1942  Description:
1943  Set every possible expression parsing setting to false.
1944  Remarks:
1945  This is a simple way to disable all possible parsing of
1946  expressions. This function calls
1947  this->SetParseExplicitFormulaExpression(false);
1948  this->SetParseArithmeticExpression(false);
1949  this->SetParseMultiplication(false);
1950  this->SetParseDivision(false);
1951  this->SetParseAddition(false);
1952  this->SetParseSubtraction(false);
1953  this->SetParseMathFunctions(false);
1954  this->SetParseMathFunctions(false);
1955  this->SetParsePairedParentheses(false);
1956  */
1957  void SetAllExpressionSettingsToFalse();
1958 
1959 
1960  /*
1961  Returns:
1962  True if any of the following are true.
1963  ParseInvalidExpressionError()
1964  ParseDivideByZeroError()
1965  ParseOverflowError()
1966  */
1967  bool ParseError() const;
1968 
1969  /*
1970  Returns:
1971  True if parsing and expression resulted in a divide by zero.
1972  */
1973  bool ParseDivideByZeroError() const;
1974 
1975  /*
1976  Returns:
1977  True if parsing and expression created a number that a double
1978  cannot represent.
1979  */
1980  bool ParseOverflowError() const;
1981 
1982  /*
1983  Returns:
1984  True if parsing and expression failed because the expression
1985  did not make sense.
1986  */
1987  bool ParseInvalidExpressionError() const;
1988 
1989  void SetParseDivideByZeroError(
1990  bool bParseDivideByZeroError
1991  );
1992 
1993  void SetParseOverflowError(
1994  bool bParseOverflowError
1995  );
1996 
1997  void SetParseInvalidExpressionError(
1998  bool bParseInvalidExpressionError
1999  );
2000 
2001 private:
2002  // default constructor sets all elements to zero.
2003  ON__UINT32 m_true_default_bits[2]; // a "0" bit is true - used for defaults that are true
2004  ON__UINT32 m_false_default_bits[2]; // a "0" bit is false - used for defaults that are false
2005 
2006  ON__UINT32 m_reserved_bits = 0;
2007 
2008  // The value of m_context_locale_id is used to resolve
2009  // ambiguities that occur when parsing unit system names.
2010  // In German "Grad" identifies arc degree angle units and in
2011  // English "Grad" identifies gradian angle units. If angle parsing
2012  // encounters "Grad", it uses the value of m_context_locale_id
2013  // to determine what arc unit system is being identified.
2014  ON__UINT16 m_context_locale_id = 0;
2015 
2016  // The value of m_context_angle_unit_system determines the
2017  // angle unit system that is used when a value must be parsed
2018  // as an angle and no angle unit system is explicitly or
2019  // implicitly specified.
2020  // If m_default_angle_unit_system is 0, then radians are used.
2021  // If m_default_angle_unit_system is not 0 and is equal to an
2022  // ON::AngleUnitSystem value, that angle unit system is used.
2023  // In all other cases, radians are used.
2024  ON__UINT8 m_context_angle_unit_system = 0;
2025 
2026  // The value of m_context_length_unit_system determines the
2027  // length unit system that is used when a value must be parsed
2028  // as a length and no length unit system is explicitly or
2029  // implicitly specified.
2030  // If m_context_length_unit_system is 0, then it is ignored.
2031  // If m_context_length_unit_system is not 0 and is equal to an
2032  // ON::LengthUnitSystem value, that length unit system is used.
2033  // Presently this value is not relavent to internal parsing code,
2034  // but may be passed along in parse settings to code that
2035  // use parsing.
2036  ON__UINT8 m_context_length_unit_system = 0;
2037 
2038  ON__UINT64 m_reserved = 0;
2039 
2040 private:
2041  void Internal_DefaultCtor();
2042 };
2043 
2044 /*
2045 Descriptions:
2046  result true if a and b are identical.
2047 */
2048 ON_DECL
2049 bool operator==(
2050  const class ON_ParseSettings& a,
2051  const class ON_ParseSettings& b
2052  );
2053 
2054 /*
2055 Descriptions:
2056  result true if a and b are not identical.
2057 */
2058 ON_DECL
2059 bool operator!=(
2060  const class ON_ParseSettings& a,
2061  const class ON_ParseSettings& b
2062  );
2063 
2064 /*
2065 Descriptions:
2066  result setting value = a setting value OR b setting value
2067 Returns:
2068  Logical OR of the parse settings in a and b.
2069 */
2070 ON_DECL
2071 ON_ParseSettings operator&&(
2072  const class ON_ParseSettings& a,
2073  const class ON_ParseSettings& b
2074  );
2075 
2076 /*
2077 Descriptions:
2078  result setting value = a setting value AND b setting value
2079 Returns:
2080  Logical AND of the parse settings in a and b.
2081 */
2082 ON_DECL
2083 ON_ParseSettings operator||(
2084  const class ON_ParseSettings& a,
2085  const class ON_ParseSettings& b
2086  );
2087 
2088 /*
2089 Description:
2090  Parses str to determine if it specifies a number.
2091 
2092 Parameters:
2093  str - [in]
2094 
2095  str_count - [in]
2096  str[] and str_count specify the string to parse.
2097  If str_count >= 0. it specifies the maximum number of elements in str[]
2098  that may be parsed. If str_count = -1, then the string must contain a
2099  character that terminates number parsing. This character can
2100  be a null, arithmetic operator, or a unicode
2101  code point <= 0x0020 (0x0020 = space = 32 decimal).
2102 
2103  parse_settings - [in]
2104  The value of parse_settings controls what input may be parsed.
2105  Use one of the predefined
2106  ON_ParseSettings::DefaultSettings
2107  ON_ParseSettings::IntegerNumberSettings
2108  ON_ParseSettings::RationalNumberSettings
2109  ON_ParseSettings::RealNumberSettings
2110  for common parsing tasks.
2111 
2112  parse_results - [out]
2113  The value of parse_results reports what was parsed.
2114 
2115  value - [out]
2116  The value of the parsed number.
2117 
2118 Returns:
2119  Number of elments of str[] that were parsed.
2120  A return value of 0 indicates that str[] could not be
2121  parsed as a number.
2122 
2123 See Also:
2124  ON_ParseNumberExpression
2125  ON_ParseLengthExpression
2126  ON_ParseAngleExpression
2127 */
2128 ON_DECL
2129 int ON_ParseNumber(
2130  const wchar_t* str,
2131  int str_count,
2132  ON_ParseSettings parse_settings,
2133  ON_ParseSettings* parse_results,
2134  double* value
2135  );
2136 
2137 /*
2138 Description:
2139  Parses str to determine if it specifies a number.
2140  Expression parsing includes support for parsing in-line multiplication,
2141  in-line division, automatic multiplication by pi, and formula parsing.
2142 
2143 Parameters:
2144  str - [in]
2145 
2146  str_count - [in]
2147  str[] and str_count specify the string to parse.
2148  If str_count >= 0. it specifies the maximum number of elements in str[]
2149  that may be parsed. If str_count = -1, then the string must contain a
2150  character that terminates number parsing. This character can
2151  be a null, arithmetic operator, or a unicode
2152  code point <= 0x0020 (0x0020 = space = 32 decimal).
2153 
2154  parse_settings - [in]
2155  The value of parse_settings controls what input may be parsed.
2156  Use one of the predefined
2157  ON_ParseSettings::DefaultSettings
2158  ON_ParseSettings::IntegerNumberSettings
2159  ON_ParseSettings::RationalNumberSettings
2160  ON_ParseSettings::RealNumberSettings
2161  for common parsing tasks.
2162 
2163  parse_results - [out]
2164  The value of parse_results reports what was parsed.
2165 
2166  value - [out]
2167  The value of the parsed number.
2168 
2169 Returns:
2170  Number of elments of str[] that were parsed.
2171  A return value of 0 indicates that str[] could not be
2172  parsed as a number.
2173 
2174 See Also:
2175  ON_ParseNumber
2176  ON_ParseLengthExpression
2177  ON_ParseAngleExpression
2178 */
2179 ON_DECL
2180 int ON_ParseNumberExpression(
2181  const wchar_t* str,
2182  int str_count,
2183  ON_ParseSettings parse_settings,
2184  ON_ParseSettings* parse_results,
2185  double* value
2186  );
2187 
2188 /*
2189 Description:
2190  Parses str if it is a recognized length unit system name or abbreviation.
2191 
2192 Parameters:
2193  str - [in]
2194 
2195  str_count - [in]
2196  str[] and str_count specify the string to parse.
2197  If str_count >= 0. it specifies the maximum number of elements in str[]
2198  that may be parsed. If str_count = -1, then the string must contain a
2199  character that terminates unit system name parsing. This character can
2200  be a null, digit, punctuation, aritmetic operator, or a unicode
2201  code point <= 0x0020 (0x0020 = space = 32 decimal).
2202 
2203  prefered_locale_id - [in]
2204  If the parsed length unit name identifies different length unit systems
2205  in different locales, then this value is used to resolve the
2206  ambiguity. A list of Microsoft locale id values can be found at
2207  http://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).
2208 
2209  bParseLeadingWhitespace - [in]
2210  If true, leading white space will be parsed.
2211  If false, the unit name must begin with element str[0].
2212 
2213  length_unit_system - [out] (can be null)
2214  If length_unit_system is not null, it is set to identify the unit
2215  system specified by str. If str does not identify a known unit
2216  system, then *length_unit_system is set to ON::LengthUnitSystem::None.
2217 
2218 
2219 Returns:
2220  Number of elments of str that were parsed. A return value of
2221  0 indicates that str did not match know unit system names or
2222  abbreviations.
2223 
2224 Remarks:
2225  Currently common names and abbreviations for millimeters, centimeters,
2226  meters and kilometers are supported in Czech (cs-*), English (en-*),
2227  French (fr-*), German (de-*), Portuguese (pt-*) and Spanish (es-*).
2228 
2229  Common names and abreviations for the following United States customary
2230  length units are supported in United States English (en-US).
2231  If the first element of str is quotation mark (double quote), unicode
2232  code point 0x0022, the string is parsed as United Sates customary inch.
2233  If the first element of str is apostrophe, unicode code point 0x0027,
2234  the string is parsed as United Sates customary foot.
2235  All conversions to meters are exact.
2236  microinch = 2.54e-8 meters (1.0e-6 inches)
2237  mil = 2.54e-5 meters (0.001 inches)
2238  inch = 0.0254 meters (1/12 foot)
2239  foot = 0.3048 meters (12 inches)
2240  yard = 0.9144 meters (36 inches)
2241  mile = 1609.344 meters (5280 feet) (US statue or land mile)
2242 */
2243 ON_DECL
2244 int ON_ParseLengthUnitName(
2245  const wchar_t* str,
2246  int str_count,
2247  int prefered_locale_id,
2248  ON::LengthUnitSystem* length_unit_system
2249  );
2250 
2251 ON_DECL
2252 int ON_ParseLengthUnitName(
2253  const wchar_t* str,
2254  int str_count,
2255  ON_ParseSettings parse_settings,
2256  ON::LengthUnitSystem* length_unit_system
2257  );
2258 
2259 /*
2260 Description:
2261  Parses str to determine if it specifies a length value.
2262 
2263 Parameters:
2264  str - [in]
2265 
2266  str_count - [in]
2267  str[] and str_count specify the string to parse.
2268  If str_count >= 0, it specifies the maximum number of elements in str[]
2269  that may be parsed. If str_count = -1, then the string must contain a
2270  character that terminates length parsing.
2271 
2272  parse_settings - [in]
2273  The input parse_settings parameter controls what input may be
2274  parsed and how it is parsed.
2275  Use ON_ParseSettings::DefaultSettings for common parsing tasks.
2276 
2277  length_value_unit_system - [in]
2278  Length unit system for the returned value.
2279  For example, if you want the returned value to be in meters,
2280  you would specify ON::LengthUnitSystem::Meters here. If you want to use custom
2281  units, you must use the override with the ON_UnitSystem
2282  parameter.
2283 
2284  length_value - [out]
2285  The value of the parsed length.
2286 
2287  parse_results - [out] (input pointer can be null)
2288  The output parse_results parameter reports what was parsed.
2289 
2290  str_length_unit_system - [out] (input pointer can be null)
2291  length unit in the parsed string. When the
2292  length_value_unit_system specifies a unit system and a
2293  a different length unit system is parsed, the number returned
2294  in length_value is always converted to the unit system
2295  specified by the length_value_unit_system parameter.
2296  If needed, you can inspect str_length_unit_system to determine
2297  if the length unit system scaling was applied.
2298 
2299 Returns:
2300  Number of elements of str that were parsed. A return value of
2301  0 indicates that str could not be parsed as a length value.
2302 */
2303 ON_DECL
2304 int ON_ParseLengthExpression(
2305  const wchar_t* str,
2306  int str_count,
2307  ON_ParseSettings parse_settings,
2308  double* length_value,
2309  ON_ParseSettings* parse_results,
2310  ON::LengthUnitSystem* str_length_unit_system
2311  );
2312 
2313 ON_DECL
2314 int ON_ParseLengthExpression(
2315  const wchar_t* str,
2316  int str_count,
2317  ON_ParseSettings parse_settings,
2318  ON::LengthUnitSystem length_value_unit_system,
2319  double* length_value,
2320  ON_ParseSettings* parse_results,
2321  ON::LengthUnitSystem* str_length_unit_system
2322  );
2323 
2324 ON_DECL
2325 int ON_ParseLengthExpression(
2326  const wchar_t* str,
2327  int str_count,
2328  ON_ParseSettings parse_settings,
2329  const ON_UnitSystem& length_value_unit_system,
2330  double* length_value,
2331  ON_ParseSettings* parse_results,
2332  ON::LengthUnitSystem* str_length_unit_system
2333  );
2334 
2335 ON_DECL
2336 int ON_ParseLengthExpression(
2337  const wchar_t* str,
2338  int str_count,
2339  ON::AngleUnitSystem default_str_angle_unit_system,
2340  ON::LengthUnitSystem length_value_unit_system,
2341  double* length_value
2342  );
2343 
2344 ON_DECL
2345 int ON_ParseLengthExpression(
2346  const wchar_t* str,
2347  int str_count,
2348  ON::AngleUnitSystem default_str_angle_unit_system,
2349  const ON_UnitSystem& length_value_unit_system,
2350  double* length_value
2351  );
2352 
2353 
2354 
2355 /*
2356 Description:
2357  Parses str if it is a recognized angle unit system name or abbreviation.
2358 
2359 Parameters:
2360  str - [in]
2361 
2362  str_count - [in]
2363  str[] and str_count specify the string to parse.
2364  If str_count >= 0. it specifies the maximum number of elements in str[]
2365  that may be parsed. If str_count = -1, then the string must contain a
2366  character that terminates angle unit system name parsing.
2367  This character can be a null, digit, punctuation, aritmetic operator,
2368  or a unicode code point <= 0x0020 (0x0020 = space = 32 decimal).
2369 
2370  prefered_locale_id - [in]
2371  If the parsed angle unit name identifies different angle unit systems
2372  in different locales, then this value is used to resolve the
2373  ambiguity. A list of Microsoft locale id values can be found at
2374  http://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).
2375  For example, "Grad" identifies ON::degrees in German and ON::gradians
2376  in US English.
2377 
2378  bParseLeadingWhitespace - [in]
2379  If true, leading white space will be parsed.
2380  If false, the unit name must begin with element str[0].
2381 
2382  angle_unit_system - [out] (can be null)
2383  If angle_unit_system is not null, it is set to the identify the
2384  angle unit system specified by str. If str does not identify a
2385  known angle unit system, then *angle_unit_system is set to
2386  ON::AngleUnitSystem::None.
2387 
2388 Returns:
2389  Number of elments of str that were parsed. A return value of
2390  0 indicates that str did not match know unit system names or
2391  abbreviations.
2392 
2393 Remarks:
2394  Currently common names and abbreviations for radians, turns,
2395  gradians, arc degrees, arc minutes and arc seconds are supported
2396  in Czech (cs-*), English (en-*), French (fr-*), German (de-*),
2397  Portuguese (pt-*) and Spanish (es-*).
2398 
2399  If the first element of str is quotation mark (double quote), unicode
2400  code point 0x0022, the string is parsed as arc seconds.
2401  If the first element of str is apostrophe, unicode code point 0x0027,
2402  the string is parsed as arc minutes.
2403 */
2404 ON_DECL
2405 int ON_ParseAngleUnitName(
2406  const wchar_t* str,
2407  int str_count,
2408  int prefered_locale_id,
2409  ON::AngleUnitSystem* angle_unit_system
2410  );
2411 
2412 ON_DECL
2413 int ON_ParseAngleUnitName(
2414  const wchar_t* str,
2415  int str_count,
2416  ON_ParseSettings parse_settings,
2417  ON::AngleUnitSystem* angle_unit_system
2418  );
2419 
2420 
2421 /*
2422 Description:
2423  Parses str to determine if it specifies a angle value.
2424 
2425 Parameters:
2426  str - [in]
2427 
2428  str_count - [in]
2429  str[] and str_count specify the string to parse.
2430  If str_count >= 0. it specifies the maximum number of elements in str[]
2431  that may be parsed. If str_count = -1, then the string must contain a
2432  character that terminates angle parsing.
2433 
2434  parse_settings - [in]
2435  The input parse_settings parameter controls what input may be
2436  parsed and how it is parsed.
2437  Use ON_ParseSettings::DefaultSettings for common parsing tasks.
2438 
2439  angle_value_unit_system - [in]
2440  Angle unit system for the returned value.
2441  For example, if you want the returned value to be in degrees,
2442  you would specify ON::AngleUnitSystem::Degrees here.
2443 
2444  angle_value - [out]
2445  The value of the parsed angle.
2446 
2447  parse_results - [out] (input pointer can be null)
2448  The output parse_results parameter reports what was parsed.
2449 
2450  str_angle_unit_system - [out] (input pointer can be null)
2451  angle unit in the parsed string. When the
2452  angle_value_unit_system specifies an angle unit system and a
2453  a different angle unit system is parsed, the number returned
2454  in angle_value is always converted to the angle unit system
2455  specified by the angle_value_unit_system parameter.
2456  If needed, you can inspect str_angle_unit_system to determine
2457  if the angle unit system scaling was applied.
2458 
2459 Returns:
2460  Number of elements of str that were parsed. A return value of
2461  0 indicates that str could not be parsed as a angle value.
2462 */
2463 ON_DECL
2464 int ON_ParseAngleExpression(
2465  const wchar_t* str,
2466  int str_count,
2467  ON_ParseSettings parse_settings,
2468  double* angle_value,
2469  ON_ParseSettings* parse_results,
2470  ON::AngleUnitSystem* str_angle_unit_system
2471  );
2472 
2473 ON_DECL
2474 int ON_ParseAngleExpression(
2475  const wchar_t* str,
2476  int str_count,
2477  ON_ParseSettings parse_settings,
2478  const ON::AngleUnitSystem angle_value_unit_system,
2479  double* angle_value,
2480  ON_ParseSettings* parse_results,
2481  ON::AngleUnitSystem* str_angle_unit_system
2482  );
2483 
2484 /*
2485 Description:
2486  Parses str to determine if it specifies a angle value.
2487 
2488 Parameters:
2489  str - [in]
2490 
2491  str_count - [in]
2492  str[] and str_count specify the string to parse.
2493  If str_count >= 0. it specifies the maximum number of elements in str[]
2494  that may be parsed. If str_count = -1, then the string must contain a
2495  character that terminates angle parsing.
2496 
2497  default_str_angle_unit_system - [in]
2498  If an angle unit system is not specified in the parsed string,
2499  then default_str_angle_units determines what unit system will
2500  be used. If default_str_angle_units is ON::AngleUnitSystem::None,
2501  then ON::radians will be used.
2502 
2503  angle_value_in_radians - [out]
2504  The value of the parsed angle, converted to radians, is returned here.
2505 
2506 Returns:
2507  Number of elements of str that were parsed. A return value of
2508  0 indicates that str could not be parsed as a angle value.
2509 
2510 Remarks:
2511  This function uses ON_ParseAngleExpression() with the
2512  angle_value_unit_system parameter set to ON::radians
2513  to parse the string. If you need more control over parsing
2514  options, then use ON_ParseAngleExpression().
2515 */
2516 ON_DECL
2517 int ON_ParseAngleRadiansExpression(
2518  const wchar_t* str,
2519  int str_count,
2520  ON::AngleUnitSystem default_str_angle_unit_system,
2521  double* angle_value_in_radians
2522  );
2523 
2524 /*
2525 Description:
2526  Parses str to determine if it specifies a angle value.
2527 
2528 Parameters:
2529  str - [in]
2530 
2531  str_count - [in]
2532  str[] and str_count specify the string to parse.
2533  If str_count >= 0. it specifies the maximum number of elements in str[]
2534  that may be parsed. If str_count = -1, then the string must contain a
2535  character that terminates angle parsing.
2536 
2537  default_str_angle_unit_system - [in]
2538  If an angle unit system is not specified in the parsed string,
2539  then default_str_angle_units determines what unit system will
2540  be used. If default_str_angle_units is ON::AngleUnitSystem::None,
2541  then ON::radians will be used.
2542 
2543  angle_value_in_radians - [out]
2544  The value of the parsed angle, converted to arc degrees,
2545  is returned here.
2546 
2547 Returns:
2548  Number of elements of str that were parsed. A return value of
2549  0 indicates that str could not be parsed as a angle value.
2550 
2551 Remarks:
2552  This function uses ON_ParseAngleExpression() with the
2553  angle_value_unit_system parameter set to ON::AngleUnitSystem::Degrees
2554  to parse the string. If you need more control over parsing
2555  options, then use ON_ParseAngleExpression().
2556 */
2557 ON_DECL
2558 int ON_ParseAngleArcDegreesExpression(
2559  const wchar_t* str,
2560  int str_count,
2561  ON::AngleUnitSystem default_str_angle_unit_system,
2562  double* angle_value_in_arc_degrees
2563  );
2564 
2565 /*
2566 Description:
2567  Parses str to determine if it specifies a point value.
2568 
2569 Parameters:
2570  str - [in]
2571 
2572  str_count - [in]
2573  str[] and str_count specify the string to parse.
2574  If str_count >= 0. it specifies the maximum number of elements in str[]
2575  that may be parsed. If str_count = -1, then the string must contain a
2576  character that terminates length parsing.
2577 
2578  default_str_angle_unit_system - [in]
2579  If an angle unit system is not specified in the parsed string,
2580  then default_str_angle_units determines what unit system will
2581  be used. If default_str_angle_units is ON::AngleUnitSystem::None,
2582  then ON::radians will be used.
2583 
2584  parse_settings - [in]
2585  The input parse_settings parameter controls what input may be
2586  parsed and how it is parsed.
2587  Use ON_ParseSettings::DefaultSettings for common parsing tasks.
2588 
2589  point_value_unit_system - [in]
2590  Coordinate unit system for the returned point value.
2591  For example, if you want the returned point coordinates to
2592  be in meters, you would specify ON::LengthUnitSystem::Meters here.
2593  If you want to use custom units, you must use the
2594  override with the ON_UnitSystem parameter.
2595 
2596  point_value - [out]
2597  The value of the parsed point.
2598 
2599  parse_results - [out] (input pointer can be null)
2600  The output parse_results parameter reports what was parsed.
2601 
2602 Returns:
2603  Number of elements of str that were parsed. A return value of
2604  0 indicates that str could not be parsed as a length value.
2605 */
2606 ON_DECL
2607 int ON_ParsePointExpression(
2608  const wchar_t* str,
2609  int str_count,
2610  ON::AngleUnitSystem default_str_angle_unit_system,
2611  ON::LengthUnitSystem point_value_unit_system,
2612  ON_3dPoint* point_value
2613  );
2614 
2615 ON_DECL
2616 int ON_ParsePointExpression(
2617  const wchar_t* str,
2618  int str_count,
2619  ON::AngleUnitSystem default_str_angle_unit_system,
2620  const ON_UnitSystem& point_value_unit_system,
2621  ON_3dPoint* point_value
2622  );
2623 
2624 ON_DECL
2625 int ON_ParsePointExpression(
2626  const wchar_t* str,
2627  int str_count,
2628  ON_ParseSettings parse_settings,
2629  ON::LengthUnitSystem point_value_unit_system,
2630  ON_3dPoint* point_value,
2631  ON_ParseSettings* parse_results
2632  );
2633 
2634 ON_DECL
2635 int ON_ParsePointExpression(
2636  const wchar_t* str,
2637  int str_count,
2638  ON_ParseSettings parse_settings,
2639  const ON_UnitSystem& point_value_unit_system,
2640  ON_3dPoint* point_value,
2641  ON_ParseSettings* parse_results
2642  );
2643 
2644 
2645 
2646 
2647 #endif
2648 
Definition: opennurbs_parse.h:176
Definition: opennurbs_parse.h:315
Definition: opennurbs_parse.h:20
ERROR_CONDITION
Definition: opennurbs_parse.h:43
Definition: opennurbs_string.h:3739
Definition: opennurbs_point.h:460
Definition: opennurbs_parse.h:455