//  Beta release only.
//
//  Copyright(c) Ivyware Pty Ltd 2013  (all rights reserved)
//               MELBOURNE, VICTORIA, AUSTRALIA, 3130
//
//  Provided no fee is charged (either by the distributer or user)
//  permission to use, copy, modify, and distribute this software and
//  its documentation for any purpose and without fee is hereby granted,
//  provided that the above copyright notice appear in all copies and
//  that both that copyright notice and this permission notice appear
//  in supporting documentation.
//
//  No waranty or suitablity for purpose is implied.
//
//
//  P2Pmsg extension definitions and prototypes
//
#pragma once

#ifndef NO_DEBUG_NEW
#define new DEBUG_NEW
#endif

#include "P2Pmsg.h"


///////////////////////////////////////////////////////////////////////
//  P2Pmsg serialisation helpers
//  NOTES: Perform standard activities
//P2PmsgKERNEL_EXT P3PmsgNode&
//P3PmsgField_SERIALISE ( P3PmsgNode& oNode
//                      , LPCTSTR lpszFieldname, const P3PmsgData& oData
//                      , bool bDscAttr, LPCTSTR lpszDescription );
//
//P2PmsgKERNEL_EXT P3PmsgAttr&
//P2PmsgAttr_SERIALISE  ( P3PmsgAttr& oAttr, bool bOverwrite
//                      , LPCTSTR lpszFieldname, const P3PmsgData& oData
//                      , bool bDscAttr = false, LPCTSTR lpszDescription = 0 );

///////////////////////////////////////////////////////////////////////
//  P2Pmsg CMFCPropertyGridCtrl decoration helpers
//  NOTES: Perform standard activities
P2PmsgKERNEL_EXT P3PmsgField&
Decorate4Grid ( P3PmsgField& oField, UCHAR ucAttributes
              , LPCTSTR lpszGridLabel, LPCTSTR lpszGridDescription );
P2PmsgKERNEL_EXT P3PmsgField&
Decorate4Grid_FONT ( P3PmsgField& oField, UCHAR ucAttributes
                   , LPCTSTR lpszGridLabel, LPCTSTR lpszGridDescription );
P2PmsgKERNEL_EXT P3PmsgField&
Decorate4Grid_COLOR ( P3PmsgField& oField, UCHAR ucAttributes
                    , LPCTSTR lpszGridLabel, LPCTSTR lpszGridDescription );
P2PmsgKERNEL_EXT P3PmsgField&
Decorate4Grid_FILE ( P3PmsgField& oField, UCHAR ucAttributes
                   , LPCTSTR lpszGridLabel, LPCTSTR lpszGridDescription );

///////////////////////////////////////////////////////////////////////
//  P2Pmsg object helpers

P2PmsgKERNEL_EXT CString
P3Pmsg_GetPath ( const P3PmsgField *pField );
P2PmsgKERNEL_EXT CString
P3Pmsg_GetPath ( const P3PmsgAttr *pAttr );
P2PmsgKERNEL_EXT CString
P3Pmsg_GetParentName ( const P3PmsgNode *pNode );
P2PmsgKERNEL_EXT P3PmsgObject
P3Pmsg_FindParentWithAttr ( const P3PmsgObject& oObject, LPCTSTR lpszAttributeName );
P2PmsgKERNEL_EXT P3PmsgObject
P3Pmsg_FindChildWithAttr ( const P3PmsgNode& oNode
                         , LPCTSTR lpszAttributeName, LPCTSTR lpszObjectName );

P2PmsgKERNEL_EXT P3PmsgObject
P3Pmsg_SelectObject ( const P3PmsgObject *pObject, LPCTSTR lpszObjectPath );

///////////////////////////////////////////////////////////////////////
//  Boolean operations

P2PmsgKERNEL_EXT P3PmsgNode&
P2PmsgNode_AND ( P3PmsgNode& oNodeLValue, const P3PmsgNode& oNodeRValue );
P2PmsgKERNEL_EXT P3PmsgNode&
P2PmsgNode_AND ( P3PmsgNode& oNodeLValue, const P3PmsgField& oFieldRValue );
P2PmsgKERNEL_EXT P3PmsgField&
P2PmsgField_AND ( P3PmsgField& oFieldLValue, const P3PmsgField& oFieldRValue );
P2PmsgKERNEL_EXT P3PmsgAttr&
P2PmsgAttr_AND ( P3PmsgAttr& oAttrLValue, const P3PmsgAttr& oAttrRValue );

P2PmsgKERNEL_EXT void
GuidToString ( GUID& oGUID, LPTSTR lpszGUID );