significance of AFX_CODEJOCK_PRIVATE |
Post Reply |
Author | |
JohnPerks
Newbie Joined: 24 November 2009 Location: United Kingdom Status: Offline Points: 2 |
Post Options
Thanks(0)
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 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
I don't see how PreformatString can be useful in application code. Please show it with context.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
JohnPerks
Newbie Joined: 24 November 2009 Location: United Kingdom Status: Offline Points: 2 |
Post Options
Thanks(0)
|
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); } |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |