============================================================================= From String Interface =============================================================================
| 81 | // From String Interface |
| 82 | //============================================================================= |
| 83 | _Use_decl_annotations_ |
| 84 | BOOL |
| 85 | StrUnsignedLongFromString( |
| 86 | const std::string& Token, |
| 87 | BOOLEAN IsHex, |
| 88 | PULONG pValue |
| 89 | ) |
| 90 | { |
| 91 | int Base = IsHex ? 16 : 10; |
| 92 | ULONG Value = 0; |
| 93 | BOOL status = TRUE; |
| 94 | |
| 95 | // |
| 96 | // Zero out parameters. |
| 97 | // |
| 98 | *pValue = 0; |
| 99 | |
| 100 | try |
| 101 | { |
| 102 | Value = std::stoul(Token, nullptr, Base); |
| 103 | } |
| 104 | catch (const std::exception&) |
| 105 | { |
| 106 | status = FALSE; |
| 107 | goto exit; |
| 108 | } |
| 109 | |
| 110 | // |
| 111 | // Set out parameters. |
| 112 | // |
| 113 | *pValue = Value; |
| 114 | |
| 115 | exit: |
| 116 | return status; |
| 117 | } |
| 118 | |
| 119 | |
| 120 | _Use_decl_annotations_ |
no outgoing calls
no test coverage detected