Definition at line 24 of file StringAlias.h.
◆ StringAlias()
| StringAlias::StringAlias |
( |
| ) |
|
|
inline |
◆ ~StringAlias()
| virtual StringAlias::~StringAlias |
( |
| ) |
|
|
inlinevirtual |
◆ GetAlias()
| const String & StringAlias::GetAlias |
( |
const String & | string | ) |
const |
Definition at line 34 of file StringAlias.cpp.
35{
36 int index = lookup.Integer(string);
37
38 if (index < 0)
39 return string;
40 else
41 return aliases[index];
42}
◆ GetAliases()
| int StringAlias::GetAliases |
( |
StringArray & | list | ) |
const |
Definition at line 45 of file StringAlias.cpp.
46{
47 if(lookup.Entries() == 0)
48 {
49 return 0;
50 }
51
52 int edits = 0;
53 for(int i = 0; i < list.Length(); i++)
54 {
55 int index = lookup.Integer(list[i]);
56 if(index >= 0)
57 {
58 list[i] = aliases[index];
59 edits++;
60 }
61 }
62 return edits;
63}
◆ ReadFromFile() [1/2]
| bool StringAlias::ReadFromFile |
( |
const char * | filename | ) |
|
Definition at line 66 of file StringAlias.cpp.
67{
69
70 if (input == NULL)
71 return false;
72
73 ReadFromFile(input);
74
76
77 return true;
78}
◆ ReadFromFile() [2/2]
| bool StringAlias::ReadFromFile |
( |
IFILE & | input | ) |
|
Definition at line 80 of file StringAlias.cpp.
81{
82 StringArray lines, tokens;
83 lines.Read(input);
84
85 for (int j = 0; j < lines.Length(); j++)
86 {
87 tokens.ReplaceTokens(lines[j]);
88
89 if (tokens.Length() != 2) continue;
90
91 SetAlias(tokens[0], tokens[1]);
92 }
93
94 return true;
95}
◆ SetAlias()
| void StringAlias::SetAlias |
( |
String & | string, |
|
|
String & | alias ) |
Definition at line 21 of file StringAlias.cpp.
22{
23 int index = lookup.Integer(string);
24
25 if (index < 0)
26 {
27 aliases.Push(alias);
28 lookup.SetInteger(string, aliases.Length() - 1);
29 }
30 else
31 aliases[index] = alias;
32}
The documentation for this class was generated from the following files: