This function replaces the LaTeX tags for special characters into its unicode value.
| 57 | // This function replaces the LaTeX tags for special characters |
| 58 | // into its unicode value. |
| 59 | void encode_String(const QString& Input, QString& Output) |
| 60 | { |
| 61 | int Begin = 0, End = 0; |
| 62 | struct tSpecialChar *p; |
| 63 | |
| 64 | Output = ""; |
| 65 | while((Begin=Input.indexOf('\\', Begin)) >= 0) { |
| 66 | Output += Input.mid(End, Begin - End); |
| 67 | End = Begin++; |
| 68 | |
| 69 | p = SpecialChars; |
| 70 | while(p->Unicode != 0) // test all special characters |
| 71 | if(Input.mid(Begin).startsWith(p->Mnemonic)) { |
| 72 | Output += QChar(p->Unicode); |
| 73 | End = Begin + strlen(p->Mnemonic); |
| 74 | break; |
| 75 | } |
| 76 | else p++; |
| 77 | } |
| 78 | Output += Input.mid(End); |
| 79 | } |
| 80 | |
| 81 | // This function replaces the unicode of special characters |
| 82 | // by its LaTeX tags. |
no outgoing calls
no test coverage detected