Subversion Repositories spk

Rev

Rev 191 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
#pragma once

#include <CyString.h>
#include <Utils/WString.h>
#include "../../common/InputBox.h"

using namespace System;
using namespace System::Runtime::InteropServices;


inline CyString CyStringFromSystemString( System::String ^str)
{
        if ( !str || !str->Length )
                return NullString;
        const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(str)).ToPointer();
        std::string s = chars;
        Marshal::FreeHGlobal(IntPtr((void*)chars));
        return CyString(s);
}

inline System::String ^SystemStringFromCyString ( CyString str )
{
        System::String ^Str = gcnew System::String(str.c_str());
        return Str;
}

inline System::String^ _US(const Utils::WString& str)
{
        System::String^ Str = gcnew System::String(str.c_str());
        return Str;
}

inline Utils::WString _WS(System::String^ str)
{
        if (!str || !str->Length)
                return L"";
        const wchar_t* chars = (const wchar_t*)(Marshal::StringToHGlobalUni(str)).ToPointer();
        std::wstring s = chars;
        Marshal::FreeHGlobal(IntPtr((void*)chars));
        return s;
}