DCL 4.0
Loading...
Searching...
No Matches
BufferedHttpFormData Class Reference

#include <HttpCollection.h>

Inheritance diagram for BufferedHttpFormData:
HttpFormData Object

Public Member Functions

 BufferedHttpFormData ()
virtual ~BufferedHttpFormData ()
size_t size () const
bool isEmpty () const
FileInfoArray & operator[] (size_t _index)
FileInfoArray & byName (const wchar_t *_name)
Public Member Functions inherited from Object
virtual String toString () const
virtual void destroy ()
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Protected Member Functions

virtual bool onFileStart (const PartHeader &header, void **ppCallbackData, String &strCallbackError)
virtual bool onFileData (const void *pData, size_t nSize, void *pCallbackData, String &strCallbackError)
virtual bool onFileEnd (const PartHeader &header, void *pCallbackData, bool bDataSuccess, String &strCallbackError)
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Detailed Description

Definition at line 223 of file HttpCollection.h.

Constructor & Destructor Documentation

◆ BufferedHttpFormData()

BufferedHttpFormData::BufferedHttpFormData ( )

Definition at line 900 of file HttpCollection.cpp.

901{
902 __handle = new PointerArray();
903 __DCL_ASSERT(__handle != NULL);
904}
#define NULL
Definition Config.h:340
#define __DCL_ASSERT(expr)
Definition Object.h:371

◆ ~BufferedHttpFormData()

BufferedHttpFormData::~BufferedHttpFormData ( )
virtual

Definition at line 906 of file HttpCollection.cpp.

907{
908 __DCL_ASSERT(__handle != NULL);
909 PointerArray* p = __V();
910 PointerArray& v = *p;
911 for(size_t i = 0; i < v.size(); i++)
912 delete (FileInfoArray*)v[i];
913 v.clear();
914 delete p;
915}
#define __V()

Member Function Documentation

◆ byName()

BufferedHttpFormData::FileInfoArray & BufferedHttpFormData::byName ( const wchar_t * _name)

Definition at line 938 of file HttpCollection.cpp.

940{
941 __DCL_ASSERT(_name != NULL && *_name != '\0');
942
943 FileInfoArray* pV = NULL;
944 PointerArray& v = *(PointerArray*)__handle;
945 for(size_t i = 0; i < v.size(); i++)
946 {
947 pV = (FileInfoArray*)(v[i]);
948 if (pV->__name == _name)
949 return *pV;
950 }
951
952 pV = new FileInfoArray(_name);
953 v.add(pV);
954 return *pV;
955}

◆ isEmpty()

bool BufferedHttpFormData::isEmpty ( ) const

Definition at line 923 of file HttpCollection.cpp.

924{
925 __DCL_ASSERT(__handle != NULL);
926
927 return __V()->isEmpty();
928}

◆ onFileData()

bool BufferedHttpFormData::onFileData ( const void * pData,
size_t nSize,
void * pCallbackData,
String & strCallbackError )
protectedvirtual

Reimplemented from HttpFormData.

Definition at line 983 of file HttpCollection.cpp.

989{
990 BytesOutputStream* pOut = (BytesOutputStream*)pCallbackData;
991 __DCL_ASSERT(pOut != NULL);
992
993 try {
994 pOut->write(pData, nSize);
995 }
996 catch(IOException* e) {
997 delete pOut;
998
999 strCallbackError = e->toString();
1000 e->destroy();
1001 return false;
1002 }
1003
1004 return true;
1005}
virtual void destroy()
Definition Exception.cpp:74
virtual String toString() const

◆ onFileEnd()

bool BufferedHttpFormData::onFileEnd ( const PartHeader & header,
void * pCallbackData,
bool bDataSuccess,
String & strCallbackError )
protectedvirtual

Reimplemented from HttpFormData.

Definition at line 1007 of file HttpCollection.cpp.

1013{
1014 BytesOutputStream* pOut = (BytesOutputStream*)pCallbackData;
1015 __DCL_ASSERT(pOut != NULL);
1016
1017 if (bDataSuccess) {
1018 FileInfo* pInfo = new FileInfo;
1019
1020 pInfo->filename = header.filename;
1021 pInfo->contentType = header.contentType;
1022 pInfo->fileData = pOut->toByteString();
1023
1024 delete pOut;
1025
1026 insert(header.name, pInfo);
1027 }
1028
1029 return true;
1030}

◆ onFileStart()

bool BufferedHttpFormData::onFileStart ( const PartHeader & header,
void ** ppCallbackData,
String & strCallbackError )
protectedvirtual

Reimplemented from HttpFormData.

Definition at line 969 of file HttpCollection.cpp.

974{
975 BytesOutputStream* pOut = new BytesOutputStream;
976 __DCL_ASSERT(pOut != NULL);
977
978 *ppCallbackData = pOut;
979
980 return true;
981}

◆ operator[]()

BufferedHttpFormData::FileInfoArray & BufferedHttpFormData::operator[] ( size_t _index)

Definition at line 931 of file HttpCollection.cpp.

932{
933 __DCL_ASSERT(_index < __V()->size());
934 return *((FileInfoArray*)((*__V())[_index]));
935}

◆ size()

size_t BufferedHttpFormData::size ( ) const

Definition at line 917 of file HttpCollection.cpp.

918{
919 __DCL_ASSERT(__handle != NULL);
920 return __V()->size();
921}

The documentation for this class was generated from the following files: