]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/forms_gettext.C
This file is part of LyX, the document processor.
[lyx.git] / src / frontends / xforms / forms_gettext.C
1 /**
2  * \file forms_gettext.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS
9  */
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "forms_gettext.h"
17
18 #include FORMS_H_LOCATION
19
20 // Extract shortcut from <ident>|<shortcut> string
21 char const * flyx_shortcut_extract(char const * sc)
22 {
23         // Find '|' in the sc and return the string after that.
24         register char const * sd = sc;
25         while (sd[0]!= 0 && sd[0] != '|') ++sd;
26
27         if (sd[0] == '|') {
28                 ++sd;
29                 return sd;
30         }
31         return "";
32 }
33
34
35 // Extract identifier from <ident>|<shortcut> string
36 char const * flyx_ident_extract(char const * sc)
37 {
38         register char const * se = sc;
39         while (se[0]!= 0 && se[0] != '|') ++se;
40
41         if (se[0] == 0) return sc;
42
43         char * sb = new char[se - sc + 1];
44         int index = 0;
45         register char const * sd = sc;
46         while (sd != se) {
47                 sb[index] = sd[0];
48                 ++index; ++sd;
49         }
50         sb[index] = 0;
51         return sb;
52 }