CRioMMTopics Class Reference
#include <RioMMTopics.h>
Inherits CRioMMObject.
Detailed Description
Definition at line 40 of file RioMMTopics.h.
Constructor & Destructor Documentation
CRioMMTopics::CRioMMTopics |
( |
char * |
TopicsName, |
|
|
unsigned int |
blocksize, |
|
|
RioBlock |
numBuffers, |
|
|
struct timeval |
RTT_average, |
|
|
RioMMInterface * |
rio_interface | |
|
) |
| | |
CRioMMTopics::~CRioMMTopics |
( |
|
) |
|
Member Function Documentation
void CRioMMTopics::FastForward |
( |
void |
|
) |
[virtual] |
void CRioMMTopics::FastRewind |
( |
void |
|
) |
[virtual] |
RioBlock CRioMMTopics::GetCurrentPosition |
( |
void |
|
) |
[virtual] |
QDomDocument * CRioMMTopics::getDomTree |
( |
|
) |
|
Definition at line 42 of file RioMMTopics.cpp.
00043 {
00044 int rc;
00045 char tempdir[MAXPATHSIZE] = "RIOxmlXXXXXX";
00046 char tempfilename[MAXPATHSIZE];
00047
00048 TopicsFile = new RioFile( MMObjectName, BlockSize );
00049 RioFile *DTDFile = new RioFile( "/etc/dtd/index.dtd", BlockSize );
00050
00051 rc = TopicsFile->Open( Access, Stream );
00052 if( rc < 0 )
00053 {
00054 return rc;
00055 }
00056
00057 rc = DTDFile->Open( Access, Stream );
00058 if( rc < 0 )
00059 {
00060 sendMsg( QString( "RioMMTopics" ), QString( "DTD file not found " ) +
00061 QString( "at server.\nIndex file will not be loaded." ),
00062 getRio() );
00063
00064 TopicsFile->Close();
00065 return rc;
00066 }
00067
00068
00069
00070
00071
00072 if( RIOmktemp( tempdir ) == false )
00073 {
00074 RioErr << "[RioMMTopics]: Cannot create directory " << tempdir << endl;
00075
00076 TopicsFile->Close();
00077 delete DTDFile;
00078 return 0;
00079 }
00080
00081 mkdir( tempdir, 0700 );
00082
00083 strcpy( tempfilename, tempdir );
00084 strcat( tempfilename, "/topics.index" );
00085 TopicsFile->Download( tempfilename );
00086
00087 strcpy( tempfilename, tempdir );
00088 strcat( tempfilename, "/index.dtd" );
00089 DTDFile->Download( tempfilename );
00090 setDomTree( new QDomDocument );
00091
00092 QFile opmlFile( TopicsFile->GetLocalFilename() );
00093
00094 QFile dtdLocalFile( DTDFile->GetLocalFilename() );
00095
00096
00097 xmlDoValidityCheckingDefaultValue = 1;
00098 xmlDocPtr doc = xmlParseFile( TopicsFile->GetLocalFilename() );
00099
00100 xmlValidCtxt cvp;
00101 cvp.userData = NULL;
00102 cvp.error = (xmlValidityErrorFunc) donothing;
00103 cvp.warning = (xmlValidityWarningFunc) donothing;
00104
00105 if( !xmlValidateDocumentFinal( &cvp, doc ) ||
00106 !xmlValidateDocument( &cvp, doc )
00107 )
00108 {
00109 sendMsg( QString( "RioMMTopics" ),
00110 QString( "Invalid index file according to DTD.\n") +
00111 QString( "It will not be loaded." ), getRio() );
00112 opmlFile.close();
00113 opmlFile.remove();
00114 dtdLocalFile.remove();
00115 rmdir( tempdir );
00116
00117 TopicsFile->Close();
00118 delete DTDFile;
00119 return 0;
00120 }
00121 xmlXIncludeProcess( doc );
00122 xmlFreeDoc( doc );
00123 xmlCleanupParser();
00124 xmlMemoryDump();
00125
00126 if( !opmlFile.open( IO_ReadOnly ) )
00127 {
00128 RioErr << "[RioMMTopics]: Cannot open topics file." << endl;
00129 opmlFile.close();
00130 opmlFile.remove();
00131 dtdLocalFile.remove();
00132 rmdir( tempdir );
00133
00134 TopicsFile->Close();
00135 delete DTDFile;
00136 return 0;
00137 }
00138 if( !getDomTree()->setContent( &opmlFile ) )
00139 {
00140 RioErr << "[RioMMTopics]: Parsing error for index file." << endl;
00141 opmlFile.close();
00142 opmlFile.remove();
00143 dtdLocalFile.remove();
00144 rmdir( tempdir );
00145
00146 TopicsFile->Close();
00147 delete DTDFile;
00148 return 0;
00149 }
00150 opmlFile.close();
00151 opmlFile.remove();
00152 dtdLocalFile.remove();
00153 rmdir( tempdir );
00154
00155
00156 QCustomEvent *event = new QCustomEvent( (QEvent::Type)(QEvent::User + 3),
00157 getDomTree() );
00158 QApplication::postEvent( getRio(), event );
00159
00160
00161 TopicsFile->Close();
00162 delete DTDFile;
00163
00164 return 1;
00165 }
RioBlock CRioMMTopics::GetTotalPositions |
( |
void |
|
) |
[virtual] |
void CRioMMTopics::GoTo |
( |
unsigned |
int |
) |
|
int CRioMMTopics::init |
( |
void |
|
) |
[virtual] |
void CRioMMTopics::Pause |
( |
void |
|
) |
[virtual] |
void CRioMMTopics::Play |
( |
void |
|
) |
[virtual] |
void CRioMMTopics::setDomTree |
( |
QDomDocument * |
d |
) |
|
void CRioMMTopics::Stop |
( |
void |
|
) |
[virtual] |
Field Documentation
The documentation for this class was generated from the following files: