Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > General Discussion
  New Posts New Posts RSS Feed - significance of AFX_CODEJOCK_PRIVATE
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

significance of AFX_CODEJOCK_PRIVATE

 Post Reply Post Reply
Author
Message
JohnPerks View Drop Down
Newbie
Newbie


Joined: 24 November 2009
Location: United Kingdom
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnPerks Quote  Post ReplyReply Direct Link To This Post Topic: significance of AFX_CODEJOCK_PRIVATE
    Posted: 24 November 2009 at 10:03am
I've just inherited a fairly large body of MFC code that uses Codejock. I've noticed that the code refers to types (such asCXTPPropExchangeEnumeratorPtr) and methods (such as CXTPPropExchangeXmlNode::PreformatString) that are in an AFX_CODEJOCK_PRIVATE block. (The former of these is used in the examples in the documentatin, which muddies the waters yet further.)

Is such code intended to be called, or is it best avoided as an internal detail?

Many thanks

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2009 at 5:00am
Hi,
I don't see how PreformatString can be useful in application code. Please show it with context.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
JohnPerks View Drop Down
Newbie
Newbie


Joined: 24 November 2009
Location: United Kingdom
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnPerks Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2009 at 7:49am
Originally posted by oleg oleg wrote:

I don't see how PreformatString can be useful in application code.


Without wishing to speak ill of my predecessor, neither can I at the moment. The code is below if that helps.

In general, should the items declared in such PRIVATE blocks be avoided? In which case, is std::auto_ptr<CXTPPropExchangeEnumerator> to be preferred over CXTPPropExchangeEnumeratorPtr?

void SomeClass::LoadXMLString(CXTPPropExchange* pPX, LPCTSTR pszPropName, CString& strValue)
{
#ifdef _UNICODE
    PX_String(pPX, pszPropName, strValue);
#else

    BSTR bstrValue = 0;
    PX_Bstr(pPX, pszPropName, bstrValue, 0);

    ASSERT(!bstrValue || wcslen(bstrValue) < 1024);

    if (bstrValue)
    {
        WideCharToMultiByte(0, 0, bstrValue, -1, strValue.GetBuffer(1024), 1024, 0, 0);
        strValue.ReleaseBuffer();
        SysFreeString(bstrValue);
    }
#endif
    CXTPPropExchangeXMLNode::PreformatString(strValue, FALSE);
}

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2009 at 2:02am
hmm.
Maybe it was added to support some national characters.   but XML should handle it without problems.
 
Anyway I think single
 
PX_String(pPX, pszPropName, strValue);
 
can replace it all.
 
at least move CXTPPropExchangeXMLNode::PreformatString one line up - to call it only with ANSI version. PX_String already run it.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.