home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 February
/
PCWorld_2000-02_cd.bin
/
Software
/
TemaCD
/
tcvpa
/
data1.cab
/
MyFileGroup
/
INCLUDE
/
FmtParse.hpp
< prev
next >
Wrap
C/C++ Source or Header
|
1999-06-03
|
2KB
|
74 lines
#ifndef _INC_FMTPARSE_HPP
#define _INC_FMTPARSE_HPP
// **********************************************************************
struct TC_2xLong
{
public: unsigned long l1 ;
public: unsigned long l2 ;
}; // end of class TC_2xLong
// **********************************************************************
typedef TC_TArrayCPP <TC_2xLong> TCArray2xLong;
// **********************************************************************
struct TC_FmtToken
{
public: unsigned long mask ;
public: char t ;
public: char has_val ;
public: long min_val ;
public: long max_val ;
public: char ordered ;
}; // end of class TC_FmtToken
// **********************************************************************
enum TCFmtTokTypes {
tok_Undef,
tok_Str,
tok_Num,
tok_Sym,
tok_End,
};
TC_COREEX_EXPORT void tcStrARepeat (TC_CString &s, char * val, int cnt) ;
// **********************************************************************
class TC_COREEX_EXPORT TC_CFmtParse
{
private: char * m_Fmt ;
private: TC_FmtToken * m_Tokens ;
private: TCArray2xLong m_Values ;
private: TCArrayLONG m_Order ;
public: TC_CFmtParse (char * fmt, TC_FmtToken * tokens) ;
private: BOOL TokStrVal (TC_FmtToken * tok, char * &ptr) ;
private: BOOL TokNumVal (TC_FmtToken * tok, char * &ptr) ;
private: TC_FmtToken * GetToken (char t) ;
private: unsigned long GetValue (long mask) ;
public: void GetStrValue (long mask, TC_CString & s) ;
public: long GetNumValue (long mask) ;
public: int GetOrderedCnt ()
{
return m_Order.Count();
} // end of func
// **********************************************************************
public: unsigned long GetOrderedMask (int idx)
{
if(idx < 0 || idx > m_Order.Count())
return 0;
return m_Order[idx];
} // end of func
// **********************************************************************
public: void SetFmt (char * fmt) ;
public: unsigned long Parse () ;
public: static int NextToken (char *&ptr, TC_CString &dest, TCFmtTokTypes &tokType, char * syms=0) ;
}; // end of class TC_CFmtParse
// **********************************************************************
#endif // _INC_FMTPARSE_HPP