Click here to Skip to main content
15,892,161 members
Articles / Desktop Programming / MFC

FiveLoaves v1.0

Rate me:
Please Sign up or sign in to vote.
3.84/5 (10 votes)
2 Jul 20028 min read 84.8K   4.4K   49  
FiveLoaves is an Internet utility designed to meet the most common needs of internet users - primarily secure connectivity
// --------------------------------------------------------------------------
//					www.UnitedBusinessTechnologies.com
//			  Copyright (c) 1998 - 2002  All Rights Reserved.
//
// Source in this file is released to the public under the following license:
// --------------------------------------------------------------------------
// This toolkit may be used free of charge for any purpose including corporate
// and academic use.  For profit, and Non-Profit uses are permitted.
//
// This source code and any work derived from this source code must retain 
// this copyright at the top of each source file.
// 
// UBT welcomes any suggestions, improvements or new platform ports.
// email to: XMLFoundation@UnitedBusinessTechnologies.com
// --------------------------------------------------------------------------
#ifndef __OBJ_FACT_H
#define __OBJ_FACT_H

#include "xmlDefines.h"
#include "xmlLex.h"
#include "GList.h"
#include "GString.h"

class MemberDescriptor;
class XMLObject;
class xmlException;
class XMLAttributeList;

class XMLObjectFactory
{
	xml::token m_tokenLookAhead;
	xml::token m_token;
	
	const char *m_pzExceptionThrower;
	XMLObject *m_pProtocolObject;
	xmlException *m_pException;
	MemberDescriptor *m_pExceptionMap;

	// member variables to reduce stack data in recursive process
	char m_pzLastFoundOID[512];
	char m_pzLastUpdateTime[32];// 256 bit object timestamp
	int m_bApplyQueryResults;

	xml::lex *m_pLex;
	GList m_paramtererEntities;
	GList m_generalEntities;
	
	// current recusrion level during factorization
	int m_nXMLRecurseLevel;
	
	// recursion level where objects for the m_pResultSetDescriptor are found
	int m_nQueryResultsLevel;

	MemberDescriptor *m_pResultSetDescriptor;

private:
	MemberDescriptor *HandleExceptions(const char *pzXml, XMLObject *pObjCurrent);
	void TraceOutBadMemberMapOrVersionMismatch(const char *pzXml, XMLObject *pObjCurrent);
	XMLObject *GetCoorespondingSubObject(MemberDescriptor *pMap,xml::token *pObjectToken,bool *bUpdateCleanMembers);
	void SetObjectIDAndUpdateTime();
	void GetFirstTokenPastDTD();
	void SetObjectOrElementAttributeValue(xml::token **attNameTok, MemberDescriptor *pMap,XMLObject *pCurObj);
	void SetRootObjectAttributeValue(xml::token **attNameTok, MemberDescriptor *pMap,XMLObject *pObjCurrent);

	void receiveIntoObject(	XMLObject *pObjCurrent, MemberDescriptor *pMap, bool bUpdateCleanMembers);

	// Obtain pointer to sub-object, Factory create if necessary
	XMLObject* CreateObject(const char *pzTag, MemberDescriptor *pMap, int *bDidCreate);

	void SetMapFromParent(	XMLObject **pObjParent,
							const char *pzTag, 
							MemberDescriptor **pMap);

	XMLAttributeList *LoadObjectAttributes();
	void FactoryInitComplete(XMLObject *pO);
public:
	XMLObjectFactory(const char *pXMLBuf, const char *pzExceptionThrower = 0);
	~XMLObjectFactory();

	static GString m_strOIDID;

	void setResultDescriptor(MemberDescriptor *pMD){m_pResultSetDescriptor = pMD;}

	/*pRootObject is the object that contains the root mapping structure to data 
	 storage locations.  pSecondaryMapHandler is an optional secondary handler
	 that will be called if pRootObject does not have the registered handler*/
	void extractObjects( XMLObject *pRootObject,
						 XMLObject *pSecondaryMapHandler = 0);
};



#endif //__OBJ_FACT_H

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Founder United Business Technologies
United States United States
http://about.me/brian.aberle
https://www.linkedin.com/in/brianaberle
http://SyrianRue.org/Brian

Comments and Discussions