Update of /cvsroot/babylonlib/_SrcPool/Cpp/Samples/Stream
In directory sc8-pr-cvs1:/tmp/cvs-serv9108
Added Files:
Resource.h StdAfx.cpp StdAfx.h Stream.clw Stream.cpp
Stream.dsp Stream.h Stream.rc TsFileHanling.cpp
Log Message:
New sample (STL)
--- NEW FILE: Resource.h ---
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Stream.rc
//
#define IDS_HELLO 1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
--- NEW FILE: StdAfx.cpp ---
// stdafx.cpp : source file that includes just the standard includes
// Stream.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
--- NEW FILE: StdAfx.h ---
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__894836F2_3581_4248_881D_B32255767D58__INCLUDED_)
#define AFX_STDAFX_H__894836F2_3581_4248_881D_B32255767D58__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afx.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <iostream>
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__894836F2_3581_4248_881D_B32255767D58__INCLUDED_)
--- NEW FILE: Stream.clw ---
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "Stream.h"
LastPage=0
ClassCount=0
ResourceCount=0
--- NEW FILE: Stream.cpp ---
// Stream.cpp : Defines the entry point for the console application.
//
// Group=Examples
#include "StdAfx.h"
#include "Stream.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern bool TestFileHandling();
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
//_tmain()---------------------------------------------------------------------
/*
*/
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = EXIT_SUCCESS;
//Initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = EXIT_FAILURE;
}
else
{
// TODO: code your application's behavior here.
CString strHello;
strHello.LoadString(IDS_HELLO);
cout << (LPCTSTR)strHello << endl;
if (!TestFileHandling())
{
cout << _T(" Failed!") << endl;
nRetCode = EXIT_FAILURE;
}
}
return nRetCode;
}
--- NEW FILE: Stream.dsp ---
# Microsoft Developer Studio Project File - Name="Stream" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=Stream - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Stream.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Stream.mak" CFG="Stream - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Stream - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "Stream - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Stream - Win32 Release"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../.." /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD BASE RSC /l 0x1009 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x1009 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "Stream - Win32 Debug"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../.." /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x1009 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x1009 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "Stream - Win32 Release"
# Name "Stream - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\KFileExtR.cpp
!IF "$(CFG)" == "Stream - Win32 Release"
!ELSEIF "$(CFG)" == "Stream - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\KFileFindOld.cpp
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\KFileNam.cpp
!IF "$(CFG)" == "Stream - Win32 Release"
!ELSEIF "$(CFG)" == "Stream - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\KFileNmB.cpp
!IF "$(CFG)" == "Stream - Win32 Release"
!ELSEIF "$(CFG)" == "Stream - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\KFileNmF.cpp
# End Source File
# Begin Source File
SOURCE=..\..\KFileShortcut.cpp
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\KFileTmpName.cpp
!IF "$(CFG)" == "Stream - Win32 Release"
!ELSEIF "$(CFG)" == "Stream - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\KGetLine.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"StdAfx.h"
# End Source File
# Begin Source File
SOURCE=.\Stream.cpp
# End Source File
# Begin Source File
SOURCE=.\Stream.rc
# End Source File
# Begin Source File
SOURCE=.\TsFileHanling.cpp
# ADD CPP /Yu"StdAfx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\KFileExtR.h
# End Source File
# Begin Source File
SOURCE=..\..\KFileHnd.inl
# End Source File
# Begin Source File
SOURCE=..\..\KFileN32.inl
# End Source File
# Begin Source File
SOURCE=..\..\KFileNam.h
# End Source File
# Begin Source File
SOURCE=..\..\KFileNmB.h
# End Source File
# Begin Source File
SOURCE=..\..\KFileShortcut.h
# End Source File
# Begin Source File
SOURCE=..\..\KFileTimeCm.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\Stream.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project
--- NEW FILE: Stream.h ---
#if !defined(AFX_STREAM_H__C200E54E_0A0F_491D_B54A_052886A73BFF__INCLUDED_)
#define AFX_STREAM_H__C200E54E_0A0F_491D_B54A_052886A73BFF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "resource.h"
#endif // !defined(AFX_STREAM_H__C200E54E_0A0F_491D_B54A_052886A73BFF__INCLUDED_)
--- NEW FILE: Stream.rc ---
//Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELLO "Hello from MFC!"
END
#endif
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
--- NEW FILE: TsFileHanling.cpp ---
/*$Workfile: TsFileHanling.cpp$: implementation file
$Revision: 3$ $Date: 16/07/2002 12:41:55 AM$
$Author: Darko$
Test file handling
Copyright: CommonSoft Inc.
Mar 2k2 D.Kolakovic
*/
// Group=Examples
#include "StdAfx.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#ifdef _MSC_VER /*MS VC/C++ - Disable warning */
//Fix for the warning(4786) cannot debug code with symbols longer
//than 255 characters
#pragma warning (disable: 4786)
#endif
#endif
#include <vector>
#include <iostream>
#include <iomanip.h> //std::endl
#include "KFileNmB.h" //CFileNameBrowser class
extern CString FindOldestFile(LPCTSTR strDirectoryPath,LPCTSTR strFileExt);
extern LPCTSTR CreateTmpFileName(CString& strResult, LPCTSTR strPrefix);
//TestFileHandling()-----------------------------------------------------------
/*Test file handling functions.
*/
bool TestFileHandling()
{
cout << endl << "====================" << endl;
cout << "TestFileHandling()" << endl;
bool bResult = true;
std::vector<std::string> listFileNames;
//Test browsing a directory
CFileNameBrowser FileName("*");
while(!FileName.IsLastFileFound())
{
listFileNames.push_back(++FileName);
cout << listFileNames.size() << ".\t"
<< (LPCTSTR)FileName
<< (FileName.IsDirectory()? _T(" directory ") : _T(""))
<< endl;
}
//Find oldest file
CString strOldFile;
CString strDirectory = "./";
strOldFile = FindOldestFile(strDirectory,NULL);
if ((GetLastError() == ERROR_SUCCESS) && !strOldFile.IsEmpty())
{
strDirectory += strOldFile;
cout << _T("oldest file is ") << (LPCTSTR)strDirectory << endl;
}
//Create Tmp File Name
LPCTSTR szTmpFileName = CreateTmpFileName(strDirectory,"New");
if( szTmpFileName != NULL )
cout << _T("Unique file name is ") << szTmpFileName << endl;
else
bResult = false;
return bResult;
}
///////////////////////////////////////////////////////////////////////////////
/******************************************************************************
*$Log:
* 3 Biblioteka1.2 16/07/2002 12:41:55 AMDarko Fixed VSS Log
* tag
* 2 Biblioteka1.1 04/04/2002 11:49:18 PMDarko
* CreateTmpFileName()
* 1 Biblioteka1.0 12/03/2002 10:01:17 PMDarko
*$
*****************************************************************************/
|