ATTRSTR.H

//////////////////////////////////////////////////////////////////////////////// 
// attrstr.h
//
// Copyright (C) 1987-1997 By Microsoft Corp. All rights reserved.
// Copyright (C) 1997 Metawise Computing, Inc. All rights reserved.
//
////////////////////////////////////////////////////////////////////////////////


#ifndef _ATTRSTR_H_
#define _ATTRSTR_H_

// An attribute string has the following syntax:
// attribute-string ::= attribute[;attribute[;attribute...]]
// attribute ::= attribute-keyword=attribute-value
// where ';' is m_chAttrSeparator and '=' is m_chKeyValueSeparator

// attribute-keyword is case insensitive
class CAttrString : public CString
{
public:
CAttrString ();
CAttrString (LPCSTR lpsz);
CAttrString (LPCWSTR lpsz);

TCHAR m_chAttrSeparator;// separator between attributes; default is ';'
TCHAR m_chKeyValueSeparator;// separator between key and value; default is '='

BOOL GetAttribute (LPCTSTR lpszKey, CString* pstrValue);
void AddAttribute (LPCTSTR lpszKey, LPCTSTR lpszValue, BOOL bOverwrite = TRUE);
void RemoveAttribute (LPCTSTR lpszKey, BOOL bAll = TRUE);

private:
// Implementations:
BOOL GetNextKeyValue (int* pnIndex, CString* pstrKey, CString* pstrValue);// to get 1st one, set *pnIndex to 0
};

#endif // _ATTRSTR_H_