Subversion Repositories spk

Rev

Rev 191 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 191 Rev 242
Line 7... Line 7...
7
#include <Utils/WString.h>
7
#include <Utils/WString.h>
8
#include "../../common/InputBox.h"
8
#include "../../common/InputBox.h"
9
 
9
 
10
using namespace System;
10
using namespace System;
11
using namespace System::Runtime::InteropServices;
11
using namespace System::Runtime::InteropServices;
-
 
12
 
12
 
13
 
13
inline CyString CyStringFromSystemString( System::String ^str)
14
inline CyString CyStringFromSystemString( System::String ^str)
14
{
15
{
15
	if ( !str || !str->Length )
16
	if ( !str || !str->Length )
16
		return NullString;
17
		return NullString;
17
	const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(str)).ToPointer();
18
	const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(str)).ToPointer();
18
	std::string s = chars;
19
	std::string s = chars;
19
	Marshal::FreeHGlobal(IntPtr((void*)chars));
20
	Marshal::FreeHGlobal(IntPtr((void*)chars));
20
	return CyString(s);
21
	return CyString(s);
21
}
22
}
22
 
23
 
23
inline System::String ^SystemStringFromCyString ( CyString str )
24
inline System::String ^SystemStringFromCyString ( CyString str )
24
{
25
{
25
	System::String ^Str = gcnew System::String(str.c_str());
26
	System::String ^Str = gcnew System::String(str.c_str());
26
	return Str;
27
	return Str;
27
}
28
}
28
 
29
 
29
inline System::String^ _US(const Utils::WString& str)
30
inline System::String^ _US(const Utils::WString& str)
-
 
31
{
-
 
32
	System::String^ Str = gcnew System::String(str.c_str());
-
 
33
	return Str;
-
 
34
}
-
 
35
 
-
 
36
inline Utils::WString _WS(System::String^ str)
30
{
37
{
-
 
38
	if (!str || !str->Length)
-
 
39
		return L"";
31
	System::String^ Str = gcnew System::String(str.c_str());
40
	const wchar_t* chars = (const wchar_t*)(Marshal::StringToHGlobalUni(str)).ToPointer();
-
 
41
	std::wstring s = chars;
-
 
42
	Marshal::FreeHGlobal(IntPtr((void*)chars));
32
	return Str;
43
	return s;
33
}
44
}