///
/// Copyright © 2003-2008 JetBrains s.r.o.
/// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder).
///
#pragma once
#include "emapi.h"
#include "rcobject.h"
class EMAPIFolder;
typedef RCPtr EMAPIFolderSPtr;
class ETable;
typedef RCPtr ETableSPtr;
class ELPSRowSet;
typedef RCPtr ELPSRowSetSPtr;
class PersistMessage;
typedef RCPtr PersistMessageSPtr;
class MAPIForm;
typedef RCPtr MAPIFormSPtr;
class AddrBook;
typedef RCPtr AddrBookSPtr;
class ABContainer;
typedef RCPtr ABContainerSPtr;
class MsgStores;
typedef RCPtr MsgStoresSPtr;
class MsgStore;
typedef RCPtr MsgStoreSPtr;
class Messages;
typedef RCPtr MessagesSPtr;
class EMAPIFolders;
typedef RCPtr EMAPIFoldersSPtr;
class EMessage;
typedef RCPtr EMessageSPtr;
class EntryID;
typedef RCPtr EntryIDSPtr;
class MailUser;
typedef RCPtr MailUserSPtr;
class EAttach;
typedef RCPtr EAttachSPtr;
class ESPropValue;
typedef RCPtr ESPropValueSPtr;
class CharBuffer;
typedef RCPtr CharBufferSPtr;
class CharsStorage;
typedef RCPtr CharsStorageSPtr;
class StringStream;
typedef RCPtr StringStreamSPtr;
class FormManager;
typedef RCPtr FormManagerSPtr;
class ANSIString;
typedef RCPtr ANSIStringSPtr;
class UNIString;
typedef RCPtr UNIStringSPtr;
class MAPISession;
class Chars;
typedef RCPtr CharsSPtr;
class PropTagArray;
typedef RCPtr PropTagArraySPtr;
class TypeFactory
{
public:
static PropTagArraySPtr CreatePropTagArray( LPSPropTagArray propTags );
static UNIStringSPtr CreateUNIString( LPWSTR str );
static ANSIStringSPtr CreateANSIString( LPSTR str );
static EMAPIFoldersSPtr CreateEMAPIFolders( LPMAPIFOLDER pFolder, LPMAPITABLE pTable );
static EMAPIFolderSPtr CreateEMAPIFolder( LPMAPIFOLDER pFolder );
static ESPropValueSPtr CreateESPropValue( LPSPropValue pVal, bool isFreeNecessary = true );
static CharBufferSPtr CreateCharBuffer( int length );
static CharsStorageSPtr CreateCharsStorage();
static StringStreamSPtr CreateStringStream( LPSTREAM lpStream );
static EAttachSPtr CreateEAttach( LPATTACH lpAttach );
static MailUserSPtr CreateMailUser( IMailUser* lpMailUser );
static EntryIDSPtr CreateEntryID( LPBYTE bytes, int cb );
static ELPSRowSetSPtr CreateELPSRowSet( LPSRowSet lpSRowSet );
static ETableSPtr CreateETable( LPMAPITABLE lpMAPITable );
static ETableSPtr CreateAttachmentsETable( LPMAPITABLE lpMAPITable );
static EMessageSPtr CreateEMessage( LPMESSAGE lpMessage );
static MessagesSPtr CreateMessages( LPMAPIFOLDER pFolder );
static MsgStoreSPtr CreateMsgStore( LPMDB pMDB, LPMAPISESSION lpMAPISession );
static MsgStoresSPtr CreateMsgStores( LPMAPISESSION pSession );
static ABContainerSPtr CreateABContainer( IABContainer* lpABContainer );
static AddrBookSPtr CreateAddrBook( LPADRBOOK lpAdrBook );
static FormManagerSPtr CreateFormManager( LPMAPIFORMMGR pFormManager );
static MAPIFormSPtr CreateMAPIForm( LPMAPIFORM pForm );
static PersistMessageSPtr CreatePersistMessage( LPPERSISTMESSAGE lpPersistMessage );
static ANSIString* CreateANSIStrings( int count );
static LPSTR* CreateLPSTRArray( int count );
static MAPISession* CreateMAPISession();
static void Delete( RCPtrBase* ptr );
static void Delete( MAPISession* ptr );
private:
TypeFactory();
};