-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroman.h
39 lines (34 loc) · 1.21 KB
/
roman.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Licensed under the MIT License.
#include "string_builder.h"
/**
* Converts a single-character Roman numeral to the integer that it represents.
*
* @param value the numeral character.
* @return The integral value of the given numeral; otherwise, `0`.
*/
int roman_from_char(char value);
/**
* Converts a Roman numeral string to the integer that it represents.
*
* @param value the numeral string.
* @return The integral value of the given numeral; otherwise, `0`.
*/
int roman_from_string_builder(StringBuilder value);
/**
* Determines the length of an integer when expressed as a modern minimal
* subtractive Roman numeral.
*
* @param value the integral value.
* @return The length of the given value when expressed as a Roman numeral.
*/
size_t roman_length(int value);
/**
* Converts an integer into a Roman numeral string.
*
* @param result when this method returns, contains a modern minimal subtractive
* Roman numeral string that represents the given value. This
* argument is passed uninitialized. The caller is responsible.
* @param value the integral value.
* @return An exception; otherwise `0`.
*/
Exception roman_to_string_builder(StringBuilder result, int value);