source: GTP/trunk/App/Demos/Illum/pathmap/L.cpp @ 2197

Revision 2197, 1.1 KB checked in by szirmay, 18 years ago (diff)
RevLine 
[2197]1#include "dxstdafx.h"
2#include ".\l.h"
3
4L::L(void)
5{
6        wide = NULL;
7}
8
9L::~L(void)
10{
11}
12
13wchar_t* L::operator+(const char* multi)
14{
15        if(wide)
16                delete wide;
17        wide = new wchar_t[nWide = MultiByteToWideChar(CP_ACP, 0, multi, -1, NULL, 0)];
18        MultiByteToWideChar(CP_ACP, 0, multi, -1, wide, nWide);
19        return wide;
20}
21
22L L::l;
23
24wchar_t* L::clone(const char* multi)
25{
26        l+multi;
27        wchar_t* ret = new wchar_t[wcslen(l.wide)+1];
28        wcscpy(ret, l.wide);
29        return ret;
30}
31
32wchar_t* L::cloneW(const wchar_t* wide)
33{
34        wchar_t* ret = new wchar_t[wcslen(wide)+1];
35        wcscpy(ret, wide);
36        return ret;
37}
38
39LC::LC(void)
40{
41        narrow = NULL;
42}
43
44LC::~LC(void)
45{
46}
47
48char* LC::operator-(const wchar_t* wide)
49{
50        if(narrow)
51                delete narrow;
52        narrow = new char[nNarrow = WideCharToMultiByte(CP_ACP, 0, wide, -1, NULL, 0, NULL, NULL)];
53        WideCharToMultiByte(CP_ACP, 0, wide, -1, narrow, nNarrow, NULL, NULL);
54        return narrow;
55}
56
57LC LC::c;
58
59char* LC::clone(const wchar_t* wide)
60{
61        c-wide;
62        char* ret = new char[strlen(c.narrow)+1];
63        strcpy(ret, c.narrow);
64        return ret;
65}
Note: See TracBrowser for help on using the repository browser.