GME
13
|
00001 // TokenEx.h: interface for the CTokenEx class. 00002 // 00003 // 00004 // MFC Simple CString Tokenizer (Version 1) 00005 // 00006 // Written by Daniel Madden (daniel.madden@compaq.com) 00007 // Copyright (c) 1999 00008 // 00009 // This code may be used in compiled form in any way you desire. This 00010 // file may be redistributed unmodified by any means PROVIDING it is 00011 // not sold for profit without the authors written consent, and 00012 // providing that this notice and the authors name and all copyright 00013 // notices remains intact. 00014 // 00015 // This file is provided "as is" with no expressed or implied warranty. 00016 // The author accepts no liability for any damage/loss of business that 00017 // this product may cause. 00018 // 00019 // Please use and enjoy. Please let me know of any bugs/mods/improvements 00020 // that you have found/implemented and I will fix/incorporate them into this 00021 // file. 00022 // 00023 // 00025 00026 #if !defined(AFX_TOKENEX_H__7CEAEBEE_D15D_11D2_9CA9_444553540000__INCLUDED_) 00027 #define AFX_TOKENEX_H__7CEAEBEE_D15D_11D2_9CA9_444553540000__INCLUDED_ 00028 00029 #if _MSC_VER > 1000 00030 #pragma once 00031 #endif // _MSC_VER > 1000 00032 00033 class CTokenEx 00034 { 00035 public: 00036 CTokenEx(); 00037 ~CTokenEx(); 00038 00039 00040 /* 00041 @FUNCTION: Splits a Path into 4 parts (Directory, Drive, Filename, Extention). 00042 NOTE: Supports UNC path names. 00043 @PARAM1: Whether the Supplied Path (PARAM2) contains a directory name only 00044 or a file name (Reason: some directories will end with "xxx.xxx" 00045 which is like a file name). 00046 @PARAM2: Path to Split. 00047 @PARAM3: (Referenced) Directory. 00048 @PARAM4: (Referenced) Drive. 00049 @PARAM5: (Referenced) Filename. 00050 @PARAM6: (Referenced) Extention. 00051 */ 00052 void SplitPath(BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir, CString& FName, CString& Ext); 00053 00054 /* 00055 @FUNCTION: Splits a CString into an CStringArray according the Deliminator. 00056 NOTE: Supports UNC path names. 00057 @PARAM1: Source string to be Split. 00058 @PARAM2: Deliminator. 00059 @PARAM3: (Referenced) CStringArray to Add to. 00060 */ 00061 void Split(CString Source, CString Deliminator, CStringArray& AddIt); 00062 00063 /* 00064 @FUNCTION: Joins a CStringArray to create a CString according the Deliminator. 00065 @PARAM1: Deliminator. 00066 @PARAM2: (Referenced) CStringArray to Add to. 00067 */ 00068 CString Join(CString Deliminator, CStringArray& AddIt); 00069 00070 /* 00071 @FUNCTION: Returns the first string found (according to the token given). If the 00072 string does not contain a token, then it returns the first param. 00073 NOTE: This uses a REFERENCE as the first param, so everytime it finds 00074 a token, the string (& deliminator) are removed from the referenced 00075 string. SEE CODE EXAMPLE! 00076 @PARAM1: (Referenced) csRefered. 00077 @PARAM2: Deliminator. 00078 */ 00079 CString GetString(CString &csRefered, CString Deliminator); 00080 00081 protected: 00082 00083 }; 00084 00085 #endif // !defined(AFX_TOKENEX_H__7CEAEBEE_D15D_11D2_9CA9_444553540000__INCLUDED_)