ascii.h.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <chapter xml:id="ascii.h">
  2. <title><tt>__vic/ascii.h</tt></title>
  3. <p>Fast, compact and locale-independent tools for ASCII-characters
  4. processing. All the tools are located within <tt>__vic::ascii</tt>
  5. namespace.</p>
  6. <chapter xml:id="ascii--is-functions">
  7. <title><tt>ascii::is</tt>-functions</title>
  8. <code-block lang="C++">
  9. namespace ascii {
  10. constexpr bool isdigit(char c);
  11. constexpr bool isxdigit(char c);
  12. constexpr bool islower(char c);
  13. constexpr bool isupper(char c);
  14. constexpr bool isalpha(char c);
  15. constexpr bool isalnum(char c);
  16. constexpr bool isspace(char c);
  17. constexpr bool isblank(char c);
  18. constexpr bool isprint(char c);
  19. constexpr bool isgraph(char c);
  20. constexpr bool ispunct(char c);
  21. constexpr bool iscntrl(char c);
  22. constexpr bool isascii(char c);
  23. }
  24. </code-block>
  25. <p>Counterparts of the corresponding <tt>&lt;cctype></tt> functions.</p>
  26. </chapter>
  27. <chapter xml:id="ascii--todigit">
  28. <title><tt>ascii::todigit()</tt></title>
  29. <code-block lang="C++">
  30. constexpr char ascii::todigit(int d);
  31. </code-block>
  32. <p>Converts integer value from 0 to 9 to the decimal digit. The result is
  33. undefined if the input value goes beyond the range.</p>
  34. <precondition><tt><![CDATA[0 <= d && d <= 9]]></tt></precondition>
  35. </chapter>
  36. <chapter xml:id="ascii--toxdigit">
  37. <title><tt>ascii::toxdigit_upper()</tt>, <tt>ascii::toxdigit_lower()</tt></title>
  38. <code-block lang="C++">
  39. namespace ascii {
  40. constexpr char toxdigit_upper(int d);
  41. constexpr char toxdigit_lower(int d);
  42. }
  43. </code-block>
  44. <p>Converts integer value from 0 to 15 to the hexadecimal digit. The first one
  45. uses upper case for <tt>A</tt>-<tt>F</tt>, the latter - lower. The result
  46. is undefined if the input value goes beyond the range.</p>
  47. <precondition><tt><![CDATA[0 <= d && d <= 15]]></tt></precondition>
  48. </chapter>
  49. <chapter xml:id="ascii--digit_to_number">
  50. <title><tt>ascii::digit_to_number()</tt></title>
  51. <code-block lang="C++">
  52. constexpr int ascii::digit_to_number(char d);
  53. </code-block>
  54. <p>Converts the given decimal digit to the number if <tt>ascii::isdigit(d)</tt>.
  55. <tt>-1</tt> is returned otherwise.</p>
  56. </chapter>
  57. <chapter xml:id="ascii--xdigit_to_number">
  58. <title><tt>ascii::xdigit_to_number()</tt></title>
  59. <code-block lang="C++">
  60. constexpr int ascii::xdigit_to_number(char d);
  61. </code-block>
  62. <p>Converts the given hexadecimal digit to the number if
  63. <tt>ascii::isxdigit(d)</tt>. <tt>-1</tt> is returned otherwise.</p>
  64. </chapter>
  65. <chapter xml:id="ascii--tolower-char">
  66. <title><tt>ascii::tolower(char)</tt>, <tt>ascii::toupper(char)</tt></title>
  67. <code-block lang="C++">
  68. namespace ascii {
  69. constexpr char tolower(char c);
  70. constexpr char toupper(char c);
  71. constexpr char upper_to_lower(char upper);
  72. constexpr char lower_to_upper(char lower);
  73. }
  74. </code-block>
  75. <synopsis>
  76. <prototype>constexpr char tolower(char c)</prototype>
  77. <prototype>constexpr char toupper(char c)</prototype>
  78. <p>Counterparts of the corresponding <tt>&lt;cctype></tt> functions.</p>
  79. </synopsis>
  80. <synopsis>
  81. <prototype>constexpr char upper_to_lower(char upper)</prototype>
  82. <p>More restricted counterpart of <tt>tolower()</tt>. The result is undefined
  83. if the argument is not an ASCII capital letter.</p>
  84. <precondition><tt>ascii::isupper(upper)</tt></precondition>
  85. </synopsis>
  86. <synopsis>
  87. <prototype>constexpr char lower_to_upper(char lower)</prototype>
  88. <p>More restricted counterpart of <tt>toupper()</tt>. The result is undefined
  89. if the argument is not an ASCII small letter.</p>
  90. <precondition><tt>ascii::islower(lower)</tt></precondition>
  91. </synopsis>
  92. </chapter>
  93. <chapter xml:id="ascii--equal_icase-char">
  94. <title><tt>ascii::equal_icase(char,char)</tt></title>
  95. <code-block lang="C++">
  96. constexpr bool ascii::equal_icase(char ch1, char ch2);
  97. </code-block>
  98. <p>Checks equality of the two ASCII-characters ignoring the case.</p>
  99. </chapter>
  100. </chapter>