aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a02647.html
blob: 909e1727cfc60757cb3e52edb0f342f38a9ca0bd (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NLMISC::CI18N class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex">  <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NLMISC::CI18N Class Reference</h1><code>#include &lt;<a class="el" href="a05799.html">i18n.h</a>&gt;</code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Class for the internationalisation. It's a singleton pattern.<p>
This class provide an easy way to localise all string. First you have to get all available language with <code><a class="el" href="a02647.html#NLMISC_1_1CI18Ne4">getLanguageNames()</a></code>. If you already know the number of the language (that is the index in the vector returns by <code>getLanguagesNames()</code>), you can load the language file with <code><a class="el" href="a02647.html#NLMISC_1_1CI18Ne5">load()</a></code>. Now, you can get a localised string with his association with <code><a class="el" href="a02647.html#NLMISC_1_1CI18Ne1">get()</a></code>.<p>
<pre class="fragment"><div>        <span class="comment">// get all language names (you must call this before calling load())</span>
        CI18N::getLanguageNames ();
        <span class="comment">// load the language 1 (french)</span>
        CI18N::load (1);
        <span class="comment">// display "Salut" that is the "hi" string in the selected language (french).</span>
        <a class="code" href="a04199.html#a1">nlinfo</a> (CI18N::get(<span class="stringliteral">"hi"</span>).c_str ());
        <span class="comment">// display "rms est un master", the french version of the string</span>
        <a class="code" href="a04199.html#a1">nlinfo</a> (CI18N::get(<span class="stringliteral">"%s is a master"</span>).c_str (), <span class="stringliteral">"mrs"</span>);
 *
</div></pre><p>
If the string doesn't exist, it will be automatically added in all language files with a  mention. If the language file doesn't exist, it'll be automatically create.<p>
Update 26-02-2002 Boris Boucher<p>
Language are now preferably handled via official language code. We use the ISO 639-1 code for language. Optionnaly, we can append a country code (ISO 3066) to differentiate between language flavor (eg chinese is ISO 639-1 zh, but come in traditionnal or simplified form. So we append the country code : zh-CN (china) for simplified, zh for traditionnal).<p>
<dl compact><dt><b>Author:</b></dt><dd>Vianney Lecroart <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2000 </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a05799.html#l00076">76</a> of file <a class="el" href="a05799.html">i18n.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne0">encodeUTF8</a> (const <a class="el" href="a03924.html">ucstring</a> &amp;str)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne1">get</a> (const std::string &amp;label)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find a string in the selected language and return his association.  <a href="#NLMISC_1_1CI18Ne1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne2">getCurrentLanguageName</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the name of the language in english (french, english...).  <a href="#NLMISC_1_1CI18Ne2"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const std::vector&lt; std::string &gt; &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne3">getLanguageCodes</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>const std::vector&lt; <a class="el" href="a03924.html">ucstring</a> &gt; &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne4">getLanguageNames</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne5">load</a> (const std::string &amp;languageCode)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Load a language file depending of the language.  <a href="#NLMISC_1_1CI18Ne5"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne6">makeMarkedString</a> (<a class="el" href="a05167.html#a18">ucchar</a> openMark, <a class="el" href="a05167.html#a18">ucchar</a> closeMark, const <a class="el" href="a03924.html">ucstring</a> &amp;text)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne7">readTextBuffer</a> (<a class="el" href="a04558.html#a7">uint8</a> *<a class="el" href="a04223.html#a589">buffer</a>, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>, <a class="el" href="a03924.html">ucstring</a> &amp;result, bool forceUtf8=false)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne8">readTextFile</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>, <a class="el" href="a03924.html">ucstring</a> &amp;result, bool forceUtf8=false, bool fileLookup=true, bool preprocess=false)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Temporary, we don't have file system for now, so we do a tricky cheat. there s not check so be careful!  <a href="#NLMISC_1_1CI18Ne8"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne9">remove_C_Comment</a> (<a class="el" href="a03924.html">ucstring</a> &amp;commentedString)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne10">setLoadProxy</a> (<a class="el" href="a02648.html">ILoadProxy</a> *loadProxy)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the load proxy class. Proxy can be NULL to unregister.  <a href="#NLMISC_1_1CI18Ne10"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ne11">writeTextFile</a> (const std::string <a class="el" href="a04560.html#a1">filename</a>, const <a class="el" href="a03924.html">ucstring</a> &amp;content, bool utf8=true)</td></tr>

<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nz1955_0">hashToString</a> (<a class="el" href="a04558.html#a13">uint64</a> hash)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nz1955_1">hashToUCString</a> (<a class="el" href="a04558.html#a13">uint64</a> hash, <a class="el" href="a03924.html">ucstring</a> &amp;dst)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nz1955_2">makeHash</a> (const <a class="el" href="a03924.html">ucstring</a> &amp;str)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nz1955_3">stringToHash</a> (const std::string &amp;str)</td></tr>

<tr><td colspan="2"><div class="groupHeader">Category control</div></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nz1954_0">parseLabel</a> (ucstring::const_iterator &amp;it, ucstring::const_iterator &amp;last, std::string &amp;label)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Parse a label.  <a href="#NLMISC_1_1CI18Nz1954_0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nz1954_1">parseMarkedString</a> (<a class="el" href="a05167.html#a18">ucchar</a> openMark, <a class="el" href="a05167.html#a18">ucchar</a> closeMark, ucstring::const_iterator &amp;it, ucstring::const_iterator &amp;last, <a class="el" href="a03924.html">ucstring</a> &amp;result)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Parse a marked string. NB : usualy, we use [ and ] as string delimiters in translation files.  <a href="#NLMISC_1_1CI18Nz1954_1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nz1954_2">skipWhiteSpace</a> (ucstring::const_iterator &amp;it, ucstring::const_iterator &amp;last, <a class="el" href="a03924.html">ucstring</a> *storeComments=NULL)</td></tr>

<tr><td colspan=2><br><h2>Private Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map&lt; std::string,<br>
 <a class="el" href="a03924.html">ucstring</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Ny0">StrMapContainer</a></td></tr>

<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nv0">_LanguageCodes</a> []</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nv1">_LanguagesNamesLoaded</a> = false</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02648.html">ILoadProxy</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nv2">_LoadProxy</a> = 0</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a04558.html#a15">uint</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nv3">_NbLanguages</a> = sizeof(<a class="el" href="a02647.html#NLMISC_1_1CI18Nv0">CI18N::_LanguageCodes</a>) / sizeof(std::string)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nv4">_NotTranslatedValue</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a10">sint32</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nv5">_SelectedLanguage</a> = -1</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02647.html#NLMISC_1_1CI18Ny0">StrMapContainer</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nv6">_StrMap</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02647.html#NLMISC_1_1CI18Nv7">_StrMapLoaded</a> = false</td></tr>

</table>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="NLMISC_1_1CI18Ny0" doxytag="NLMISC::CI18N::StrMapContainer" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> typedef std::map&lt;std::string, <a class="el" href="a03924.html">ucstring</a>&gt; <a class="el" href="a02647.html#NLMISC_1_1CI18Ny0">NLMISC::CI18N::StrMapContainer</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05799.html#l00185">185</a> of file <a class="el" href="a05799.html">i18n.h</a>.    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NLMISC_1_1CI18Ne0" doxytag="NLMISC::CI18N::encodeUTF8" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> string NLMISC::CI18N::encodeUTF8 </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>str</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Encode a unicode string into a string using UTF-8 encoding.
<p>
Definition at line <a class="el" href="a05798.html#l00627">627</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a06640.html#l00151">ucstring::toUtf8()</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00557">writeTextFile()</a>.
<p>
<div class="fragment"><pre>00628 {
00629         <span class="keywordflow">return</span> str.<a class="code" href="a03924.html#ucstringa12">toUtf8</a>();
00630         <span class="comment">/*      </span>
00631 <span class="comment">        string  res;</span>
00632 <span class="comment">        ucstring::const_iterator first(str.begin()), last(str.end());</span>
00633 <span class="comment">        for (; first != last; ++first)</span>
00634 <span class="comment">        {</span>
00635 <span class="comment">          //ucchar      c = *first;</span>
00636 <span class="comment">                uint nbLoop = 0;</span>
00637 <span class="comment">                if (*first &lt; 0x80)</span>
00638 <span class="comment">                        res += char(*first);</span>
00639 <span class="comment">                else if (*first &lt; 0x800)</span>
00640 <span class="comment">                {</span>
00641 <span class="comment">                        ucchar c = *first;</span>
00642 <span class="comment">                        c = c &gt;&gt; 6;</span>
00643 <span class="comment">                        c = c &amp; 0x1F;</span>
00644 <span class="comment">                        res += c | 0xC0;</span>
00645 <span class="comment">                        nbLoop = 1;</span>
00646 <span class="comment">                }</span>
00647 <span class="comment">                else if (*first &lt; 0x10000)</span>
00648 <span class="comment">                {</span>
00649 <span class="comment">                        ucchar c = *first;</span>
00650 <span class="comment">                        c = c &gt;&gt; 12;</span>
00651 <span class="comment">                        c = c &amp; 0x0F;</span>
00652 <span class="comment">                        res += c | 0xE0;</span>
00653 <span class="comment">                        nbLoop = 2;</span>
00654 <span class="comment">                }</span>
00655 <span class="comment"></span>
00656 <span class="comment">                for (uint i=0; i&lt;nbLoop; ++i)</span>
00657 <span class="comment">                {</span>
00658 <span class="comment">                        ucchar  c = *first;</span>
00659 <span class="comment">                        c = c &gt;&gt; ((nbLoop - i - 1) * 6);</span>
00660 <span class="comment">                        c = c &amp; 0x3F;</span>
00661 <span class="comment">                        res += char(c) | 0x80; </span>
00662 <span class="comment">                }</span>
00663 <span class="comment">        }</span>
00664 <span class="comment">        return res;</span>
00665 <span class="comment">        */</span>
00666 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne1" doxytag="NLMISC::CI18N::get" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> const <a class="el" href="a03924.html">ucstring</a> &amp; NLMISC::CI18N::get </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>label</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Find a string in the selected language and return his association. 
<p>

<p>
Definition at line <a class="el" href="a05798.html#l00140">140</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05798.html#l00044">_LanguageCodes</a>, <a class="el" href="a05798.html#l00057">_SelectedLanguage</a>, <a class="el" href="a05798.html#l00053">_StrMap</a>, and <a class="el" href="a05622.html#l00135">nlwarning</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00162">getCurrentLanguageName()</a>.
<p>
<div class="fragment"><pre>00141 {
00142         <span class="keywordflow">if</span> (label.empty())
00143         {
00144                 <span class="keyword">static</span> <a class="code" href="a03924.html">ucstring</a> emptyString;
00145                 <span class="keywordflow">return</span> emptyString;
00146         }
00147 
00148         StrMapContainer::iterator it(<a class="code" href="a02647.html#NLMISC_1_1CI18Nv6">_StrMap</a>.find(label));
00149 
00150         <span class="keywordflow">if</span> (it != <a class="code" href="a02647.html#NLMISC_1_1CI18Nv6">_StrMap</a>.end())
00151                 <span class="keywordflow">return</span> it-&gt;second;
00152 
00153         <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: The string %s did not exist in language %s"</span>, label.c_str(), <a class="code" href="a02647.html#NLMISC_1_1CI18Nv0">_LanguageCodes</a>[<a class="code" href="a02647.html#NLMISC_1_1CI18Nv5">_SelectedLanguage</a>].c_str());
00154 
00155         <span class="keyword">static</span> <a class="code" href="a03924.html">ucstring</a> badString;
00156 
00157         badString = <a class="code" href="a03924.html">ucstring</a>(std::string(<span class="stringliteral">"&lt;NotExist:"</span>)+label+<span class="stringliteral">"&gt;"</span>);
00158 
00159         <span class="keywordflow">return</span> badString;
00160 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne2" doxytag="NLMISC::CI18N::getCurrentLanguageName" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03924.html">ucstring</a> NLMISC::CI18N::getCurrentLanguageName </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns the name of the language in english (french, english...). 
<p>

<p>
Definition at line <a class="el" href="a05798.html#l00162">162</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05798.html#l00140">get()</a>.
<p>
<div class="fragment"><pre>00163 {
00164         <span class="keywordflow">return</span> <a class="code" href="a02647.html#NLMISC_1_1CI18Ne1">get</a>(<span class="stringliteral">"LanguageName"</span>);
00165 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne3" doxytag="NLMISC::CI18N::getLanguageCodes" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> const std::vector&lt;std::string&gt;&amp; NLMISC::CI18N::getLanguageCodes </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return a vector with all language code available. Code are ISO 639-2 compliant. As in <a class="el" href="a02647.html#NLMISC_1_1CI18Ne4">getLanguageNames()</a>, the index in the vector can be used to call <a class="el" href="a02647.html#NLMISC_1_1CI18Ne5">load()</a>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne4" doxytag="NLMISC::CI18N::getLanguageNames" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> const std::vector&lt;<a class="el" href="a03924.html">ucstring</a>&gt;&amp; NLMISC::CI18N::getLanguageNames </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return a vector with all language available. The vector contains the name of the language. The index in the vector is used in <code><a class="el" href="a02647.html#NLMISC_1_1CI18Ne5">load()</a></code> function     </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nz1955_0" doxytag="NLMISC::CI18N::hashToString" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> string NLMISC::CI18N::hashToString </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a13">uint64</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>hash</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00705">705</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00102">uint64</a>.
<p>
<div class="fragment"><pre>00706 {
00707         <a class="code" href="a04558.html#a11">uint32</a> *ph = (<a class="code" href="a04558.html#a11">uint32</a>*)&amp;hash;
00708 
00709         <span class="keywordtype">char</span> temp[] = <span class="stringliteral">"0011223344556677"</span>;
00710         sprintf(temp, <span class="stringliteral">"%08X%08X"</span>, ph[0], ph[1]);
00711 
00712         <span class="keywordflow">return</span> string(temp);
00713 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nz1955_1" doxytag="NLMISC::CI18N::hashToUCString" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NLMISC::CI18N::hashToUCString </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a13">uint64</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>hash</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>dst</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00716">716</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06590.html#l00236">ucchar</a>, and <a class="el" href="a05981.html#l00102">uint64</a>.
<p>
<div class="fragment"><pre>00717 {
00718         <span class="keyword">static</span> <a class="code" href="a05167.html#a18">ucchar</a>   cvtTable[]= {<span class="charliteral">'0'</span>,<span class="charliteral">'1'</span>,<span class="charliteral">'2'</span>,<span class="charliteral">'3'</span>,<span class="charliteral">'4'</span>,<span class="charliteral">'5'</span>,<span class="charliteral">'6'</span>,<span class="charliteral">'7'</span>,<span class="charliteral">'8'</span>,<span class="charliteral">'9'</span>,<span class="charliteral">'A'</span>,<span class="charliteral">'B'</span>,<span class="charliteral">'C'</span>,<span class="charliteral">'D'</span>,<span class="charliteral">'E'</span>,<span class="charliteral">'F'</span>};
00719 
00720         dst.resize(16);
00721         <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=15;i&gt;=0;i--)
00722         {
00723                 <span class="comment">// Must decal dest of 8, cause of hashToString code (Little Endian)</span>
00724                 dst[(i+8)&amp;15]= cvtTable[hash&amp;15];
00725                 hash&gt;&gt;=4;
00726         }
00727 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne5" doxytag="NLMISC::CI18N::load" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NLMISC::CI18N::load </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>languageCode</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Load a language file depending of the language. 
<p>

<p>
Definition at line <a class="el" href="a05798.html#l00067">67</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05798.html#l00044">_LanguageCodes</a>, <a class="el" href="a05798.html#l00058">_LoadProxy</a>, <a class="el" href="a05798.html#l00052">_NbLanguages</a>, <a class="el" href="a05798.html#l00057">_SelectedLanguage</a>, <a class="el" href="a05798.html#l00053">_StrMap</a>, <a class="el" href="a05798.html#l00054">_StrMapLoaded</a>, <a class="el" href="a02648.html#NLMISC_1_1CI18N_1_1ILoadProxya0">NLMISC::CI18N::ILoadProxy::loadStringFile()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05798.html#l00264">parseLabel()</a>, <a class="el" href="a05798.html#l00297">parseMarkedString()</a>, <a class="el" href="a05798.html#l00377">readTextFile()</a>, <a class="el" href="a05798.html#l00168">remove_C_Comment()</a>, <a class="el" href="a05798.html#l00220">skipWhiteSpace()</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
<p>
<div class="fragment"><pre>00068 {
00069 <span class="comment">//      nlassert (lid &lt; _NbLanguages);</span>
00070 <span class="comment">//      nlassert (_LanguagesNamesLoaded);</span>
00071 
00072   <a class="code" href="a04558.html#a15">uint</a> i;
00073         <span class="keywordflow">for</span> (i=0; i&lt;<a class="code" href="a02647.html#NLMISC_1_1CI18Nv3">_NbLanguages</a>; ++i)
00074         {
00075                 <span class="keywordflow">if</span> (<a class="code" href="a02647.html#NLMISC_1_1CI18Nv0">_LanguageCodes</a>[i] == languageCode)
00076                         <span class="keywordflow">break</span>;
00077         }
00078 
00079         <span class="keywordflow">if</span> (i == _NbLanguages)
00080         {
00081                 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: Unknow language code : %s, defaulting to %s"</span>, _LanguageCodes[0].c_str());
00082                 i = 0;
00083         }
00084 
00085         std::string fileName  = <a class="code" href="a02647.html#NLMISC_1_1CI18Nv0">_LanguageCodes</a>[i] + <span class="stringliteral">".uxt"</span>;
00086 
00087         <a class="code" href="a02647.html#NLMISC_1_1CI18Nv5">_SelectedLanguage</a> = i;
00088 
00089         <span class="keywordflow">if</span> (<a class="code" href="a02647.html#NLMISC_1_1CI18Nv7">_StrMapLoaded</a>)      <a class="code" href="a02647.html#NLMISC_1_1CI18Nv6">_StrMap</a>.clear ();
00090         <span class="keywordflow">else</span>                            <a class="code" href="a02647.html#NLMISC_1_1CI18Nv7">_StrMapLoaded</a> = <span class="keyword">true</span>;
00091 
00092         <a class="code" href="a03924.html">ucstring</a> text;
00093         <span class="comment">// read in the text</span>
00094         <span class="keywordflow">if</span> (<a class="code" href="a02647.html#NLMISC_1_1CI18Nv2">_LoadProxy</a>)
00095                 <a class="code" href="a02647.html#NLMISC_1_1CI18Nv2">_LoadProxy</a>-&gt;<a class="code" href="a02648.html#NLMISC_1_1CI18N_1_1ILoadProxya0">loadStringFile</a>(fileName, text);
00096         <span class="keywordflow">else</span>
00097                 <a class="code" href="a02647.html#NLMISC_1_1CI18Ne8">readTextFile</a>(fileName, text);
00098         <span class="comment">// remove any comment</span>
00099         <a class="code" href="a02647.html#NLMISC_1_1CI18Ne9">remove_C_Comment</a>(text);
00100 
00101         ucstring::const_iterator first(text.begin()), last(text.end());
00102         std::string lastReadLabel(<span class="stringliteral">"nothing"</span>);
00103         
00104         <span class="keywordflow">while</span> (first != last)
00105         {
00106                 <a class="code" href="a02647.html#NLMISC_1_1CI18Nz1954_2">skipWhiteSpace</a>(first, last);
00107                 std::string label;
00108                 <a class="code" href="a03924.html">ucstring</a> ucs;
00109                 <span class="keywordflow">if</span> (!<a class="code" href="a02647.html#NLMISC_1_1CI18Nz1954_0">parseLabel</a>(first, last, label))
00110                 {
00111                         <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: Error reading label field in %s. Stop reading after %s."</span>, fileName.c_str(), lastReadLabel.c_str());
00112                         <span class="keywordflow">return</span>;
00113                 }
00114                 lastReadLabel = label;
00115                 <a class="code" href="a02647.html#NLMISC_1_1CI18Nz1954_2">skipWhiteSpace</a>(first, last);
00116                 <span class="keywordflow">if</span> (!<a class="code" href="a02647.html#NLMISC_1_1CI18Nz1954_1">parseMarkedString</a>(<span class="charliteral">'['</span>, <span class="charliteral">']'</span>, first, last, ucs))
00117                 {
00118                         <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: Error reading text for label %s in %s. Stop reading."</span>, label.c_str(), fileName.c_str());
00119                         <span class="keywordflow">return</span>;
00120                 }
00121 
00122                 <span class="comment">// ok, a line read.</span>
00123                 std::pair&lt;std::map&lt;std::string, ucstring&gt;::iterator, <span class="keywordtype">bool</span>&gt; ret;
00124                 ret = <a class="code" href="a02647.html#NLMISC_1_1CI18Nv6">_StrMap</a>.insert(std::make_pair(label, ucs));
00125                 <span class="keywordflow">if</span> (!ret.second)
00126                 {
00127                         <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: Error in %s, the label %s exist twice !"</span>, fileName.c_str(), label.c_str());
00128                 }
00129                 <a class="code" href="a02647.html#NLMISC_1_1CI18Nz1954_2">skipWhiteSpace</a>(first, last);
00130         }
00131 
00132         <span class="comment">// a little check to ensure that the lang name has been set.</span>
00133         StrMapContainer::iterator it(<a class="code" href="a02647.html#NLMISC_1_1CI18Nv6">_StrMap</a>.find(<span class="stringliteral">"LanguageName"</span>));
00134         <span class="keywordflow">if</span> (it == <a class="code" href="a02647.html#NLMISC_1_1CI18Nv6">_StrMap</a>.end())
00135         {
00136                 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: In file %s, missing LanguageName translation (should be first in file)"</span>, fileName.c_str());
00137         }
00138 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nz1955_2" doxytag="NLMISC::CI18N::makeHash" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLMISC::CI18N::makeHash </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>str</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00679">679</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00102">uint64</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
<div class="fragment"><pre>00680 {
00681         <span class="comment">// on passe au moins 8 fois sur chaque octet de resultat</span>
00682         <span class="keywordflow">if</span> (str.empty())
00683                 <span class="keywordflow">return</span> 0;
00684         <span class="keyword">const</span>   <a class="code" href="a04558.html#a11">uint32</a>  MIN_TURN = 8*8;
00685         <a class="code" href="a04558.html#a13">uint64</a>  hash = 0;
00686         <a class="code" href="a04558.html#a7">uint8</a>   *ph = (<a class="code" href="a04558.html#a7">uint8</a>*)&amp;hash;
00687         <a class="code" href="a04558.html#a7">uint8</a>   *pc = (<a class="code" href="a04558.html#a7">uint8</a>*)str.data();
00688 
00689         <a class="code" href="a04558.html#a15">uint</a> nbLoop = max(<a class="code" href="a05167.html#a13">uint32</a>(str.size()*2), MIN_TURN);
00690         <a class="code" href="a04558.html#a15">uint</a> roll = 0;
00691 
00692         <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;nbLoop; ++i)
00693         {
00694                 ph[(i/2) &amp; 0x7] += pc[i%(str.size()*2)] &lt;&lt; roll;
00695                 ph[(i/2) &amp; 0x7] += pc[i%(str.size()*2)] &gt;&gt; (8-roll);
00696 
00697                 roll++;
00698                 roll &amp;= 0x7;
00699         }
00700 
00701         <span class="keywordflow">return</span> hash;
00702 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne6" doxytag="NLMISC::CI18N::makeMarkedString" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03924.html">ucstring</a> NLMISC::CI18N::makeMarkedString </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a05167.html#a18">ucchar</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>openMark</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a05167.html#a18">ucchar</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>closeMark</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>text</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00590">590</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a06590.html#l00236">ucchar</a>.
<p>
<div class="fragment"><pre>00591 {
00592         <a class="code" href="a03924.html">ucstring</a> ret;
00593 
00594         ret.push_back(openMark);
00595 
00596         ucstring::const_iterator first(text.begin()), last(text.end());
00597         <span class="keywordflow">for</span> (; first != last; ++first)
00598         {
00599                 <span class="keywordflow">if</span> (*first == <span class="charliteral">'\n'</span>)
00600                 {
00601                         ret += <span class="charliteral">'\\'</span>;
00602                         ret += <span class="charliteral">'n'</span>;
00603                 }
00604                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*first == <span class="charliteral">'\t'</span>)
00605                 {
00606                         ret += <span class="charliteral">'\\'</span>;
00607                         ret += <span class="charliteral">'t'</span>;
00608                 }
00609                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*first == closeMark)
00610                 {
00611                         <span class="comment">// excape the embeded closing mark</span>
00612                         ret += <span class="charliteral">'\\'</span>;
00613                         ret += closeMark;
00614                 }
00615                 <span class="keywordflow">else</span>
00616                 {
00617                         ret += *first;
00618                 }
00619         }
00620 
00621         ret += closeMark;
00622 
00623         <span class="keywordflow">return</span> ret;
00624 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nz1954_0" doxytag="NLMISC::CI18N::parseLabel" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool NLMISC::CI18N::parseLabel </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">ucstring::const_iterator &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>it</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>ucstring::const_iterator &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>last</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>std::string &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>label</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Parse a label. 
<p>

<p>
Definition at line <a class="el" href="a05798.html#l00264">264</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00067">load()</a>.
<p>
<div class="fragment"><pre>00265 {
00266         label.erase();
00267 
00268         <span class="comment">// first char must be A-Za-z@_</span>
00269         <span class="keywordflow">if</span> (it != last &amp;&amp; 
00270                         (
00271                                 (*it &gt;= <span class="charliteral">'0'</span> &amp;&amp; *it &lt;= <span class="charliteral">'9'</span>)
00272                         ||      (*it &gt;= <span class="charliteral">'A'</span> &amp;&amp; *it &lt;= <span class="charliteral">'Z'</span>)
00273                         ||      (*it &gt;= <span class="charliteral">'a'</span> &amp;&amp; *it &lt;= <span class="charliteral">'z'</span>)
00274                         ||      (*it == <span class="charliteral">'_'</span>)
00275                         ||      (*it == <span class="charliteral">'@'</span>)
00276                         )
00277                 )
00278                 label.push_back(<span class="keywordtype">char</span>(*it++));
00279         <span class="keywordflow">else</span>
00280                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00281 
00282         <span class="comment">// other char must be [0-9A-Za-z@_]*</span>
00283         <span class="keywordflow">while</span> (it != last &amp;&amp; 
00284                         (
00285                                 (*it &gt;= <span class="charliteral">'0'</span> &amp;&amp; *it &lt;= <span class="charliteral">'9'</span>)
00286                         ||      (*it &gt;= <span class="charliteral">'A'</span> &amp;&amp; *it &lt;= <span class="charliteral">'Z'</span>)
00287                         ||      (*it &gt;= <span class="charliteral">'a'</span> &amp;&amp; *it &lt;= <span class="charliteral">'z'</span>)
00288                         ||      (*it == <span class="charliteral">'_'</span>)
00289                         ||      (*it == <span class="charliteral">'@'</span>)
00290                         )
00291                 )
00292                 label.push_back(<span class="keywordtype">char</span>(*it++));
00293 
00294         <span class="keywordflow">return</span> <span class="keyword">true</span>;
00295 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nz1954_1" doxytag="NLMISC::CI18N::parseMarkedString" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool NLMISC::CI18N::parseMarkedString </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a05167.html#a18">ucchar</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>openMark</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a05167.html#a18">ucchar</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>closeMark</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>ucstring::const_iterator &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>it</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>ucstring::const_iterator &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>last</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>result</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Parse a marked string. NB : usualy, we use [ and ] as string delimiters in translation files. 
<p>

<p>
Definition at line <a class="el" href="a05798.html#l00297">297</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05622.html#l00135">nlwarning</a>, and <a class="el" href="a06590.html#l00236">ucchar</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00067">load()</a>, and <a class="el" href="a05798.html#l00377">readTextFile()</a>.
<p>
<div class="fragment"><pre>00298 {
00299 <span class="comment">//              ucstring ret;</span>
00300         result.erase();
00301         <span class="comment">// parse a string delimited by the specified opening and closing mark</span>
00302 
00303         <span class="keywordflow">if</span> (it != last &amp;&amp; *it == openMark)
00304         {
00305                 ++it;
00306 
00307                 <span class="keywordflow">while</span> (it != last &amp;&amp; *it != closeMark)
00308                 {
00309                         <span class="comment">// ignore tab, new lines and line feed</span>
00310                         <span class="keywordflow">if</span> (*it == openMark)
00311                         {
00312                                 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: Found a non escaped openmark %c in a delimited string (Delimiters : '%c' - '%c')"</span>, <span class="keywordtype">char</span>(openMark), <span class="keywordtype">char</span>(openMark), <span class="keywordtype">char</span>(closeMark));
00313                                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00314                         }
00315                         <span class="keywordflow">if</span> (*it == <span class="charliteral">'\t'</span> || *it == <span class="charliteral">'\n'</span> || *it == <span class="charliteral">'\r'</span>)
00316                                 ++it;
00317                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*it == <span class="charliteral">'\\'</span> &amp;&amp; it+1 != last &amp;&amp; *(it+1) != <span class="charliteral">'\\'</span>)
00318                         {
00319                                 ++it;
00320                                 <span class="comment">// this is an escape sequence !</span>
00321                                 <span class="keywordflow">switch</span>(*it)
00322                                 {
00323                                 <span class="keywordflow">case</span> <span class="charliteral">'t'</span>:
00324                                         result.push_back(<span class="charliteral">'\t'</span>);
00325                                         <span class="keywordflow">break</span>;
00326                                 <span class="keywordflow">case</span> <span class="charliteral">'n'</span>:
00327                                         result.push_back(<span class="charliteral">'\n'</span>);
00328                                         <span class="keywordflow">break</span>;
00329                                 <span class="keywordflow">case</span> <span class="charliteral">'d'</span>:
00330                                         <span class="comment">// insert a delete</span>
00331                                         result.push_back(8);
00332                                         <span class="keywordflow">break</span>;
00333                                 <span class="keywordflow">default</span>:
00334                                         <span class="comment">// escape the close mark ?</span>
00335                                         <span class="keywordflow">if</span>(*it == closeMark)
00336                                                 result.push_back(closeMark);
00337                                         <span class="comment">// escape the open mark ?</span>
00338                                         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(*it == openMark)
00339                                                 result.push_back(openMark);
00340                                         <span class="keywordflow">else</span>
00341                                         {
00342                                                 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: Ignoring unknown escape code \\%c (char value : %u)"</span>, <span class="keywordtype">char</span>(*it), *it);
00343                                                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00344                                         }
00345                                 }
00346                                 ++it;
00347                         }
00348                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*it == <span class="charliteral">'\\'</span> &amp;&amp; it+1 != last &amp;&amp; *(it+1) == <span class="charliteral">'\\'</span>)
00349                         {
00350                                 <span class="comment">// escape the \ char</span>
00351                                 ++it;
00352                                 result.push_back(*it);
00353                                 ++it;
00354                         }
00355                         <span class="keywordflow">else</span>
00356                                 result.push_back(*it++);
00357                 }
00358 
00359                 <span class="keywordflow">if</span> (it == last || *it != closeMark)
00360                 {
00361                         <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: Missing end of delimited string (Delimiters : '%c' - '%c')"</span>, <span class="keywordtype">char</span>(openMark), <span class="keywordtype">char</span>(closeMark));
00362                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
00363                 }
00364                 <span class="keywordflow">else</span>
00365                         ++it;
00366         }
00367         <span class="keywordflow">else</span>
00368         {
00369                 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: Malformed or non existent delimited string (Delimiters : '%c' - '%c')"</span>, <span class="keywordtype">char</span>(openMark), <span class="keywordtype">char</span>(closeMark));
00370                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00371         }
00372 
00373         <span class="keywordflow">return</span> <span class="keyword">true</span>;
00374 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne7" doxytag="NLMISC::CI18N::readTextBuffer" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NLMISC::CI18N::readTextBuffer </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a7">uint8</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>size</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>result</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>forceUtf8</em> = false</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Read the content of a buffer as a unicode text. This is to read preloaded unicode files. The method support 16 bits or 8bits utf-8 tagged buffer. 8 bits UTF-8 encofing can be reconized by a non official header : EF,BB, BF. 16 bits encoding can be reconized by the official header : FF, FE, witch can be reversed if the data are MSB first.<p>
Optionnaly, you can force the reader to consider the file as UTF-8 encoded.
<p>
Definition at line <a class="el" href="a05798.html#l00475">475</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a06640.html#l00191">ucstring::fromUtf8()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05646.html#l01124">src</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00377">readTextFile()</a>.
<p>
<div class="fragment"><pre>00476 {
00477         <span class="keyword">static</span> <a class="code" href="a04558.html#a7">uint8</a> utf16Header[] = {char(0xff), char(0xfe)};
00478         <span class="keyword">static</span> <a class="code" href="a04558.html#a7">uint8</a> utf16RevHeader[] = {char(0xfe), char(0xff)};
00479         <span class="keyword">static</span> <a class="code" href="a04558.html#a7">uint8</a> utf8Header[] = {char(0xef), char(0xbb), char(0xbf)};
00480 
00481         <span class="keywordflow">if</span> (forceUtf8)
00482         {
00483                 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a>&gt;=3 &amp;&amp;
00484                         <a class="code" href="a04223.html#a589">buffer</a>[0]==utf8Header[0] &amp;&amp; 
00485                         <a class="code" href="a04223.html#a589">buffer</a>[1]==utf8Header[1] &amp;&amp; 
00486                         <a class="code" href="a04223.html#a589">buffer</a>[2]==utf8Header[2]
00487                         )
00488                 {
00489                         <span class="comment">// remove utf8 header</span>
00490                         <a class="code" href="a04223.html#a589">buffer</a>+= 3;
00491                         <a class="code" href="a04223.html#a587">size</a>-=3;
00492                 }
00493                 std::string text((<span class="keywordtype">char</span>*)buffer, size);
00494                 result.<a class="code" href="a03924.html#ucstringa1">fromUtf8</a>(text);
00495         }
00496         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a>&gt;=3 &amp;&amp;
00497                          <a class="code" href="a04223.html#a589">buffer</a>[0]==utf8Header[0] &amp;&amp; 
00498                          <a class="code" href="a04223.html#a589">buffer</a>[1]==utf8Header[1] &amp;&amp; 
00499                          <a class="code" href="a04223.html#a589">buffer</a>[2]==utf8Header[2]
00500                         )
00501         {
00502                 <span class="comment">// remove utf8 header</span>
00503                 <a class="code" href="a04223.html#a589">buffer</a>+= 3;
00504                 <a class="code" href="a04223.html#a587">size</a>-=3;
00505                 std::string text((<span class="keywordtype">char</span>*)buffer, size);
00506                 result.<a class="code" href="a03924.html#ucstringa1">fromUtf8</a>(text);
00507         }
00508         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a>&gt;=2 &amp;&amp;
00509                          <a class="code" href="a04223.html#a589">buffer</a>[0]==utf16Header[0] &amp;&amp; 
00510                          <a class="code" href="a04223.html#a589">buffer</a>[1]==utf16Header[1]
00511                         )
00512         {
00513                 <span class="comment">// remove utf16 header</span>
00514                 <a class="code" href="a04223.html#a589">buffer</a>+= 2;
00515                 <a class="code" href="a04223.html#a587">size</a>-= 2;
00516                 <span class="comment">// check pair number of bytes</span>
00517                 <a class="code" href="a04199.html#a6">nlassert</a>((size &amp; 1) == 0);
00518                 <span class="comment">// and do manual conversion</span>
00519                 <a class="code" href="a04558.html#a9">uint16</a> *<a class="code" href="a04223.html#a652">src</a> = (<a class="code" href="a04558.html#a9">uint16</a>*)(<a class="code" href="a04223.html#a589">buffer</a>);
00520                 result.resize(size/2);
00521                 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j=0; j&lt;result.size(); j++)
00522                         result[j]= *<a class="code" href="a04223.html#a652">src</a>++;
00523         }
00524         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a587">size</a>&gt;=2 &amp;&amp;
00525                          <a class="code" href="a04223.html#a589">buffer</a>[0]==utf16RevHeader[0] &amp;&amp; 
00526                          <a class="code" href="a04223.html#a589">buffer</a>[1]==utf16RevHeader[1]
00527                         )
00528         {
00529                 <span class="comment">// remove utf16 header</span>
00530                 <a class="code" href="a04223.html#a589">buffer</a>+= 2;
00531                 <a class="code" href="a04223.html#a587">size</a>-= 2;
00532                 <span class="comment">// check pair number of bytes</span>
00533                 <a class="code" href="a04199.html#a6">nlassert</a>((size &amp; 1) == 0);
00534                 <span class="comment">// and do manual conversion</span>
00535                 <a class="code" href="a04558.html#a9">uint16</a> *<a class="code" href="a04223.html#a652">src</a> = (<a class="code" href="a04558.html#a9">uint16</a>*)(<a class="code" href="a04223.html#a589">buffer</a>);
00536                 result.resize(size/2);
00537                 <a class="code" href="a04558.html#a15">uint</a> j;
00538                 <span class="keywordflow">for</span> (j=0; j&lt;result.size(); j++)
00539                         result[j]= *<a class="code" href="a04223.html#a652">src</a>++;
00540                 <span class="comment">//  Reverse byte order</span>
00541                 <span class="keywordflow">for</span> (j=0; j&lt;result.size(); j++)
00542                 {
00543                         <a class="code" href="a04558.html#a7">uint8</a> *pc = (<a class="code" href="a04558.html#a7">uint8</a>*) &amp;result[j];
00544                         std::swap(pc[0], pc[1]);
00545                 }
00546         }
00547         <span class="keywordflow">else</span>
00548         {
00549                 <span class="comment">// hum.. ascii read ?</span>
00550                 <span class="comment">// so, just to a direct conversion</span>
00551                 std::string text((<span class="keywordtype">char</span>*)buffer, size);
00552                 result = text;
00553         }
00554 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne8" doxytag="NLMISC::CI18N::readTextFile" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NLMISC::CI18N::readTextFile </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>filename</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>result</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>forceUtf8</em> = false, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>fileLookup</em> = true, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>preprocess</em> = false</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Temporary, we don't have file system for now, so we do a tricky cheat. there s not check so be careful! 
<p>
Read the content of a file as a unicode text. The method support 16 bits or 8bits utf-8 tagged files. 8 bits UTF-8 encofing can be reconized by a non official header : EF,BB, BF. 16 bits encoding can be reconized by the official header : FF, FE, witch can be reversed if the data are MSB first.<p>
Optionnaly, you can force the reader to consider the file as UTF-8 encoded. Optionnaly, you can ask the reader to interpret #include commands.
<p>
Definition at line <a class="el" href="a05798.html#l00377">377</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a06640.html#l00125">ucstring::c_str()</a>, <a class="el" href="a05538.html#l02654">file</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05708.html#l00135">NLMISC::CIFile::open()</a>, <a class="el" href="a05798.html#l00297">parseMarkedString()</a>, <a class="el" href="a05798.html#l00475">readTextBuffer()</a>, <a class="el" href="a05798.html#l00220">skipWhiteSpace()</a>, <a class="el" href="a06640.html#l00133">ucstring::toString()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00067">load()</a>.
<p>
<div class="fragment"><pre>00378 {
00379         std::string fullName;
00380         <span class="keywordflow">if</span> (fileLookup)
00381                 fullName = CPath::lookup(filename, <span class="keyword">false</span>);
00382         <span class="keywordflow">else</span>
00383                 fullName = <a class="code" href="a05377.html#a2">filename</a>;
00384 
00385         <span class="keywordflow">if</span> (fullName.empty())
00386                 <span class="keywordflow">return</span>;
00387 
00388         <span class="comment">// If ::lookup is used, the file can be in a bnp and CFile::fileExists fails.</span>
00389         <span class="comment">// \todo Boris</span>
00390         <span class="keywordtype">bool</span> isInBnp = fullName.find(<span class="charliteral">'@'</span>) != string::npos;
00391         <span class="keywordflow">if</span> (!isInBnp &amp;&amp; !CFile::fileExists(fullName))
00392         {
00393                 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"CI18N::readTextFile : file '%s' does not exist, returing empty string"</span>, fullName.c_str());
00394                 <span class="keywordflow">return</span>;
00395         }
00396 
00397         <a class="code" href="a02653.html">NLMISC::CIFile</a>  <a class="code" href="a04115.html#a95">file</a>(fullName);
00398 
00399 
00400         <span class="comment">// Fast read all the text in binary mode.</span>
00401         std::string text;
00402         text.resize(<a class="code" href="a04115.html#a95">file</a>.getFileSize());
00403         <a class="code" href="a04115.html#a95">file</a>.serialBuffer((<a class="code" href="a04558.html#a7">uint8</a>*)(&amp;text[0]), text.size());
00404 
00405         <span class="comment">// Transform the string in ucstring according to format header</span>
00406         <span class="keywordflow">if</span> (!text.empty())
00407                 <a class="code" href="a02647.html#NLMISC_1_1CI18Ne7">readTextBuffer</a>((<a class="code" href="a04558.html#a7">uint8</a>*)&amp;text[0], text.size(), result, forceUtf8);
00408 
00409         <span class="keywordflow">if</span> (preprocess)
00410         {
00411                 <a class="code" href="a03924.html">ucstring</a> <span class="keyword">final</span>;
00412                 <span class="comment">// parse the file, looking for preprocessor command.</span>
00413                 ucstring::size_type pos = 0;
00414                 ucstring::size_type lastPos = 0;
00415                 <a class="code" href="a03924.html">ucstring</a>        includeCmd(<span class="stringliteral">"#include"</span>);
00416 
00417                 <span class="keywordflow">while</span> ((pos = result.find(includeCmd, pos)) != ucstring::npos)
00418                 {
00419                         <span class="comment">// copy the previous text</span>
00420                         <span class="keyword">final</span> += result.substr(lastPos, pos - lastPos);
00421 
00422                         <span class="comment">// extract the inserted file name.</span>
00423                         ucstring::const_iterator first, last;
00424                         first = result.begin()+pos+includeCmd.size();
00425                         last = result.end();
00426 
00427                         <a class="code" href="a03924.html">ucstring</a> name;
00428                         <a class="code" href="a02647.html#NLMISC_1_1CI18Nz1954_2">skipWhiteSpace</a>(first, last);
00429                         <span class="keywordflow">if</span> (<a class="code" href="a02647.html#NLMISC_1_1CI18Nz1954_1">parseMarkedString</a>(<span class="charliteral">'\"'</span>, <span class="charliteral">'\"'</span>, first, last, name))
00430                         {
00431                                 string subFilename = name.<a class="code" href="a03924.html#ucstringa11">toString</a>();
00432                                 <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"I18N: Including '%s' into '%s'"</span>,
00433                                         subFilename.c_str(),
00434                                         <a class="code" href="a05377.html#a2">filename</a>.c_str());
00435                                 <a class="code" href="a03924.html">ucstring</a> inserted;
00436 
00437                                 {
00438                                         <a class="code" href="a02653.html">CIFile</a> testFile;
00439                                         <span class="keywordflow">if</span> (!testFile.<a class="code" href="a02653.html#NLMISC_1_1CIFilea12">open</a>(subFilename))
00440                                         {
00441                                                 <span class="comment">// try to open the include file relative to current file</span>
00442                                                 subFilename = CFile::getPath(filename)+subFilename;
00443                                         }
00444                                 }
00445                                 <a class="code" href="a02647.html#NLMISC_1_1CI18Ne8">readTextFile</a>(subFilename, inserted, forceUtf8, fileLookup, preprocess);
00446 
00447                                 <span class="keyword">final</span> += inserted;
00448                         }
00449                         <span class="keywordflow">else</span>
00450                         {
00451                                 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"I18N: Error parsing include file in line '%s' from file '%s'"</span>,
00452                                         result.substr(pos, result.find(<a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"\n"</span>), pos) - pos).<a class="code" href="a03924.html#ucstringa0">c_str</a>(),
00453                                         <a class="code" href="a05377.html#a2">filename</a>.c_str());
00454                         }
00455 
00456                         pos = lastPos = first - result.begin();
00457                 }
00458 
00459                 <span class="comment">// copy the remaining chars</span>
00460                 <a class="code" href="a03924.html">ucstring</a> temp = <span class="keyword">final</span>;
00461                 
00462                 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=lastPos; i&lt;result.size(); ++i)
00463                 {
00464                         temp += result[i];
00465                 }
00466 
00467 <span class="comment">//              final = final + temp;</span>
00468 
00469                 result.swap(temp);
00470         }
00471 
00472 
00473 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne9" doxytag="NLMISC::CI18N::remove_C_Comment" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NLMISC::CI18N::remove_C_Comment </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>commentedString</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Remove any C style comment from the passed string.
<p>
Definition at line <a class="el" href="a05798.html#l00168">168</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00067">load()</a>.
<p>
<div class="fragment"><pre>00169 {
00170         {
00171                 <a class="code" href="a03924.html">ucstring</a> temp;
00172                 temp.reserve(commentedString.size());
00173                 ucstring::const_iterator first(commentedString.begin()), last(commentedString.end());
00174                 <span class="keywordflow">for</span> (;first != last; ++first)
00175                 {
00176                         temp.push_back(*first);
00177                         <span class="keywordflow">if</span> (*first == <span class="charliteral">'['</span>)
00178                         {
00179                                 <span class="comment">// no comment inside string literal</span>
00180                                 <span class="keywordflow">while</span> (++first != last)
00181                                 {
00182                                         temp.push_back(*first);
00183                                         <span class="keywordflow">if</span> (*first == <span class="charliteral">']'</span>)
00184                                                 <span class="keywordflow">break</span>;
00185                                 }
00186                         }
00187                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*first == <span class="charliteral">'/'</span>)
00188                         {
00189                                 <span class="comment">// start of comment ?</span>
00190                                 ++first;
00191                                 <span class="keywordflow">if</span> (first != last &amp;&amp; *first == <span class="charliteral">'/'</span>)
00192                                 {
00193                                         temp.pop_back();
00194                                         <span class="comment">// one line comment, skip until end of line</span>
00195                                         <span class="keywordflow">while</span> (first != last &amp;&amp; *first != <span class="charliteral">'\n'</span>)
00196                                                 ++first;
00197                                 }
00198                                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (first != last &amp;&amp; *first == <span class="charliteral">'*'</span>)
00199                                 {
00200                                         temp.pop_back();
00201                                         <span class="comment">// start of multiline comment, skip until we found '*/'</span>
00202                                         <span class="keywordflow">while</span> (first != last &amp;&amp; !(*first == <span class="charliteral">'*'</span> &amp;&amp; (first+1) != last &amp;&amp; *(first+1) == <span class="charliteral">'/'</span>))
00203                                                 ++first;
00204                                         <span class="comment">// skip the closing '/'</span>
00205                                         <span class="keywordflow">if</span> (first != last)
00206                                                 ++first;
00207                                 }
00208                                 <span class="keywordflow">else</span>
00209                                 {
00210                                         temp.push_back(*first);
00211                                 }
00212                         }
00213                 }
00214 
00215                 commentedString.swap(temp);
00216         }
00217 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne10" doxytag="NLMISC::CI18N::setLoadProxy" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NLMISC::CI18N::setLoadProxy </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a02648.html">ILoadProxy</a> *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>loadProxy</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Set the load proxy class. Proxy can be NULL to unregister. 
<p>

<p>
Definition at line <a class="el" href="a05798.html#l00061">61</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05798.html#l00058">_LoadProxy</a>.
<p>
<div class="fragment"><pre>00062 {
00063         <a class="code" href="a02647.html#NLMISC_1_1CI18Nv2">_LoadProxy</a> = loadProxy;
00064 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nz1954_2" doxytag="NLMISC::CI18N::skipWhiteSpace" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NLMISC::CI18N::skipWhiteSpace </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">ucstring::const_iterator &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>it</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>ucstring::const_iterator &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>last</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03924.html">ucstring</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>storeComments</em> = NULL</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Skip the white space. You can optionnaly pass a ucstring pointer to receive any comments string that build the white space. This is usefull if you whant to keep the comments. NB : comments are appended to the comments string.
<p>
Definition at line <a class="el" href="a05798.html#l00220">220</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00067">load()</a>, and <a class="el" href="a05798.html#l00377">readTextFile()</a>.
<p>
<div class="fragment"><pre>00221 {
00222         <span class="keywordflow">while</span> (it != last &amp;&amp;
00223                         (
00224                                         *it == 0xa
00225                                 ||      *it == 0xd
00226                                 ||      *it == <span class="charliteral">' '</span>
00227                                 ||      *it == <span class="charliteral">'\t'</span>
00228                                 ||      (storeComments &amp;&amp; *it == <span class="charliteral">'/'</span> &amp;&amp; it+1 != last &amp;&amp; *(it+1) == <span class="charliteral">'/'</span>)
00229                                 ||      (storeComments &amp;&amp; *it == <span class="charliteral">'/'</span> &amp;&amp; it+1 != last &amp;&amp; *(it+1) == <span class="charliteral">'*'</span>)
00230                         ))
00231         {
00232                 <span class="keywordflow">if</span> (storeComments &amp;&amp; *it == <span class="charliteral">'/'</span> &amp;&amp; it+1 != last &amp;&amp; *(it+1) == <span class="charliteral">'/'</span>)
00233                 {
00234                         <span class="comment">// found a one line C comment. Store it until end of line.</span>
00235                         <span class="keywordflow">while</span> (it != last &amp;&amp; *it != <span class="charliteral">'\n'</span>)
00236                                 storeComments-&gt;push_back(*it++);
00237                         <span class="comment">// store the final '\n'</span>
00238                         <span class="keywordflow">if</span> (it != last)
00239                                 storeComments-&gt;push_back(*it++);
00240                 }
00241                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (storeComments &amp;&amp; *it == <span class="charliteral">'/'</span> &amp;&amp; it+1 != last &amp;&amp; *(it+1) == <span class="charliteral">'*'</span>)
00242                 {
00243                         <span class="comment">// found a multiline C++ comment. store until we found the closing '*/'</span>
00244                         <span class="keywordflow">while</span> (it != last &amp;&amp; !(*it == <span class="charliteral">'*'</span> &amp;&amp; it+1 != last &amp;&amp; *(it+1) == <span class="charliteral">'/'</span>))
00245                                 storeComments-&gt;push_back(*it++);
00246                         <span class="comment">// store the final '*'</span>
00247                         <span class="keywordflow">if</span> (it != last)
00248                                 storeComments-&gt;push_back(*it++);
00249                         <span class="comment">// store the final '/'</span>
00250                         <span class="keywordflow">if</span> (it != last)
00251                                 storeComments-&gt;push_back(*it++);
00252                         <span class="comment">// and a new line.</span>
00253                         storeComments-&gt;push_back(<span class="charliteral">'\r'</span>);
00254                         storeComments-&gt;push_back(<span class="charliteral">'\n'</span>);
00255                 }
00256                 <span class="keywordflow">else</span>
00257                 {
00258                         <span class="comment">// just skip white space or don't store comments</span>
00259                         ++it;
00260                 }
00261         }
00262 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nz1955_3" doxytag="NLMISC::CI18N::stringToHash" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLMISC::CI18N::stringToHash </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>str</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00730">730</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00102">uint64</a>.
<p>
Referenced by <a class="el" href="a05635.html#l00302">STRING_MANAGER::TGetWorksheetHashValue::operator()()</a>.
<p>
<div class="fragment"><pre>00731 {
00732         <a class="code" href="a04199.html#a6">nlassert</a>(str.size() == 16);
00733         <a class="code" href="a04558.html#a11">uint32</a>  low, hight;
00734 
00735         string sl, sh;
00736         sh = str.substr(0, 8);
00737         sl = str.substr(8, 8);
00738 
00739         sscanf(sh.c_str(), <span class="stringliteral">"%08X"</span>, &amp;hight);
00740         sscanf(sl.c_str(), <span class="stringliteral">"%08X"</span>, &amp;low);
00741 
00742         <a class="code" href="a04558.html#a13">uint64</a> hash;
00743         <a class="code" href="a04558.html#a11">uint32</a> *ph = (<a class="code" href="a04558.html#a11">uint32</a>*)&amp;hash;
00744 
00745         ph[0] = hight;
00746         ph[1] = low;
00747 
00748         <span class="keywordflow">return</span> hash;
00749 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Ne11" doxytag="NLMISC::CI18N::writeTextFile" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NLMISC::CI18N::writeTextFile </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const std::string&nbsp;</td>
          <td class="mdname" nowrap> <em>filename</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>content</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>utf8</em> = true</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Write a unicode text file using unicode 16 or UTF-8 encoding.
<p>
Definition at line <a class="el" href="a05798.html#l00557">557</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
References <a class="el" href="a05798.html#l00627">encodeUTF8()</a>, <a class="el" href="a05538.html#l02654">file</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>.
<p>
<div class="fragment"><pre>00558 {
00559         <a class="code" href="a03011.html">COFile</a> <a class="code" href="a04115.html#a95">file</a>(filename);
00560 
00561         <span class="keywordflow">if</span> (!utf8)
00562         {
00563                 <span class="comment">// write the unicode 16 bits tag</span>
00564                 <a class="code" href="a04558.html#a9">uint16</a> unicodeTag = 0xfeff;
00565                 <a class="code" href="a04115.html#a95">file</a>.serial(unicodeTag);
00566 
00567                 <a class="code" href="a04558.html#a15">uint</a> i;
00568                 <span class="keywordflow">for</span> (i=0; i&lt;content.size(); ++i)
00569                 {
00570                         <a class="code" href="a04558.html#a9">uint16</a> c = content[i];
00571                         <a class="code" href="a04115.html#a95">file</a>.serial(c);
00572                 }
00573         }
00574         <span class="keywordflow">else</span>
00575         {
00576                 <span class="keyword">static</span> <span class="keywordtype">char</span> utf8Header[] = {char(0xef), char(0xbb), char(0xbf), 0};
00577 
00578                 std::string str = <a class="code" href="a02647.html#NLMISC_1_1CI18Ne0">encodeUTF8</a>(content);
00579                 <span class="comment">// add the UTF-8 'not official' header</span>
00580                 str = utf8Header + str;
00581 
00582                 <a class="code" href="a04558.html#a15">uint</a> i;
00583                 <span class="keywordflow">for</span> (i=0; i&lt;str.size(); ++i)
00584                 {
00585                         <a class="code" href="a04115.html#a95">file</a>.serial(str[i]);
00586                 }
00587         }
00588 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NLMISC_1_1CI18Nv0" doxytag="NLMISC::CI18N::_LanguageCodes" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> const std::string <a class="el" href="a02647.html#NLMISC_1_1CI18Nv0">NLMISC::CI18N::_LanguageCodes</a><code> [static, private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<b>Initial value:</b><div class="fragment"><pre>
{
        std::string(<span class="stringliteral">"en"</span>),              
        std::string(<span class="stringliteral">"fr"</span>),              
        std::string(<span class="stringliteral">"zh-TW"</span>),   
        std::string(<span class="stringliteral">"zh-CN"</span>)    
}
</pre></div>
<p>
Definition at line <a class="el" href="a05798.html#l00044">44</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00140">get()</a>, and <a class="el" href="a05798.html#l00067">load()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nv1" doxytag="NLMISC::CI18N::_LanguagesNamesLoaded" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool <a class="el" href="a02647.html#NLMISC_1_1CI18Nv1">NLMISC::CI18N::_LanguagesNamesLoaded</a> = false<code> [static, private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00056">56</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nv2" doxytag="NLMISC::CI18N::_LoadProxy" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a02648.html">CI18N::ILoadProxy</a> * <a class="el" href="a02647.html#NLMISC_1_1CI18Nv2">NLMISC::CI18N::_LoadProxy</a> = 0<code> [static, private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00058">58</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00067">load()</a>, and <a class="el" href="a05798.html#l00061">setLoadProxy()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nv3" doxytag="NLMISC::CI18N::_NbLanguages" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> const <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a02647.html#NLMISC_1_1CI18Nv3">NLMISC::CI18N::_NbLanguages</a> = sizeof(<a class="el" href="a02647.html#NLMISC_1_1CI18Nv0">CI18N::_LanguageCodes</a>) / sizeof(std::string)<code> [static, private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00052">52</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00067">load()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nv4" doxytag="NLMISC::CI18N::_NotTranslatedValue" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> const <a class="el" href="a03924.html">ucstring</a> <a class="el" href="a02647.html#NLMISC_1_1CI18Nv4">NLMISC::CI18N::_NotTranslatedValue</a><code> [static, private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nv5" doxytag="NLMISC::CI18N::_SelectedLanguage" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a10">sint32</a> <a class="el" href="a02647.html#NLMISC_1_1CI18Nv5">NLMISC::CI18N::_SelectedLanguage</a> = -1<code> [static, private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00057">57</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00140">get()</a>, and <a class="el" href="a05798.html#l00067">load()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nv6" doxytag="NLMISC::CI18N::_StrMap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a02647.html#NLMISC_1_1CI18Ny0">CI18N::StrMapContainer</a> <a class="el" href="a02647.html#NLMISC_1_1CI18Nv6">NLMISC::CI18N::_StrMap</a><code> [static, private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00053">53</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00140">get()</a>, and <a class="el" href="a05798.html#l00067">load()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLMISC_1_1CI18Nv7" doxytag="NLMISC::CI18N::_StrMapLoaded" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool <a class="el" href="a02647.html#NLMISC_1_1CI18Nv7">NLMISC::CI18N::_StrMapLoaded</a> = false<code> [static, private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05798.html#l00054">54</a> of file <a class="el" href="a05798.html">i18n.cpp</a>.
<p>
Referenced by <a class="el" href="a05798.html#l00067">load()</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a05799.html">i18n.h</a><li><a class="el" href="a05798.html">i18n.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:18:40 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>