예제 #1
0
static FarString itoa(int i, int radix)
{
  FarString s;
  itoa(i, s.GetBuffer(32), radix);
  s.ReleaseBuffer();
  return s;
}
예제 #2
0
FarString ProcessSubject( const FarString& subj )
{
  FarString result = subj;
  ProcessSubject( result.GetBuffer() );
  result.ReleaseBuffer();
  return result;
}
예제 #3
0
void CMailViewTpl::processHeaders( IWriteSink & f )
{
  PKludges Kludges = m_origMsg->GetKludges();

  for ( int i = 0; i < Kludges->Count(); i ++ )
  {
    FarString kludge = Kludges->At( i );

    m_origMsg->DecodeKludge( kludge.GetBuffer() ); kludge.ReleaseBuffer();

    int pos = 1;

    while ( ( pos = kludge.IndexOf( '\t', pos ) ) != -1 )
    {
      FarString ss = kludge.Left( pos );
      if (ss.Length() > 0 && ss[ss.Length() - 1] == ':')
      {
        pos ++;
        continue;
      }
      f.write( ss.c_str(), ss.Length() );
      f.write( "\r\n", 2 );
      kludge = kludge.Right( kludge.Length() - pos );
    }

    f.write( kludge.c_str(), kludge.Length() );

    if ( i < Kludges->Count() - 1 )
      f.write( "\r\n", 2 );
  }
}
예제 #4
0
FarString PasteFromClipboard()
{
	OSVERSIONINFO WinVer;
	WinVer.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
	GetVersionEx (&WinVer);

	HANDLE hClipData;
	if (!OpenClipboard(NULL))
		return(NULL);
	int Unicode=FALSE;
	int Format=0;
	int ReadType=CF_OEMTEXT;
	while ((Format=EnumClipboardFormats(Format))!=0)
	{
		if (Format==CF_UNICODETEXT && WinVer.dwPlatformId==VER_PLATFORM_WIN32_NT)
		{
			Unicode=TRUE;
			break;
		}
		if (Format==CF_TEXT)
		{
			ReadType=CF_TEXT;
			break;
		}
		if (Format==CF_OEMTEXT)
			break;
	}
	FarString ClipText;
	if ((hClipData=GetClipboardData(Unicode ? CF_UNICODETEXT:ReadType))!=NULL)
	{
		int BufferSize;
		char *ClipAddr=(char *)GlobalLock(hClipData);
		if (Unicode)
			BufferSize=lstrlenW((LPCWSTR)ClipAddr)+1;
		else
			BufferSize=strlen(ClipAddr)+1;

		if (Unicode)
		{
			ClipText.SetLength (BufferSize);
			WideCharToMultiByte(CP_OEMCP,0,(LPCWSTR)ClipAddr,-1,ClipText.GetBuffer(),BufferSize,NULL,FALSE);
		}
		else
		{
			ClipText.SetText (ClipAddr, BufferSize);
			if (ReadType==CF_TEXT)
				ClipText = ClipText.ToOEM();
		}
		GlobalUnlock(hClipData);
	}
	CloseClipboard();
	return ClipText;
}
예제 #5
0
  FarXMLNode *ParseFile (const char *FileName, IFarXMLErrorSink *errorSink)
  {
    FarFile f;
    if (!f.OpenForRead (FileName))
      return NULL;

    int fileSize = f.GetSize();
    FarString xmlBuf;
    xmlBuf.SetLength (fileSize);
    f.Read (xmlBuf.GetBuffer(), fileSize);

    return ParseBuffer (xmlBuf, errorSink);
  }
예제 #6
0
int show_assert_message( const char * FileName, const int Line, const char * Expression, bool bShowWinError, bool bDumpStack )
{
	FarString FN = FileName;
	FarMessage Msg( FMSG_LEFTALIGN|FMSG_WARNING|(bShowWinError?FMSG_ERRORTYPE:0) );
	Msg.AddLine( "Debug Assertion Failed!" );
	Msg.AddFmt( "Plugin    : %s", FarSF::PointToName( Far::GetModuleName() ) );
	Msg.AddFmt( "File      : %hs, Line %d", FarSF::TruncPathStr( FN.GetBuffer(), 40 ), Line );
	Msg.AddFmt( "Expression: %s", Expression );
	Msg.AddSeparator();
	Msg.AddButton( "&Abort" );
	Msg.AddButton( "&Debug" );
	Msg.AddButton( "&Ignore" );

	if ( bDumpStack )
		Msg.AddButton( "Dump &Stack" );
	
	return Msg.Show();
}
예제 #7
0
FarString FarString::ToANSI() const
{
  FarString result (fData->fText, Length());
  OemToCharBuff (fData->fText, result.GetBuffer(), Length());
  return result;
}
예제 #8
0
FarString FarString::ToOEM() const
{
  FarString result (fData->fText, Length());
  CharToOemBuff (fData->fText, result.GetBuffer(), Length());
  return result;
}