Allow tag <type> in module-description
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cmdline.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cmdline.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: heap.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: heap.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: list.hxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
#
|
||||
# $RCSfile: makefile.mk,v $
|
||||
#
|
||||
# $Revision: 1.2 $
|
||||
# $Revision: 1.3 $
|
||||
#
|
||||
# last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
# last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: sistr.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -671,7 +671,7 @@ Simstr::is_no_text() const
|
||||
return true;
|
||||
|
||||
int i;
|
||||
for (i = 0; ( sz[i] == ' ' || sz[i] == '\t' ) && i < len; i++);
|
||||
for (i = 0; sz[i] <= 32 && i < len; i++);
|
||||
if (i < len)
|
||||
return false;
|
||||
return true;
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: sistr.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: syshelp.cxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -66,13 +66,26 @@
|
||||
// NOT FULLY DEFINED SERVICES
|
||||
#include <string.h>
|
||||
#include "sistr.hxx"
|
||||
#include "list.hxx"
|
||||
|
||||
#ifdef WNT
|
||||
#include <io.h>
|
||||
#elif defined(UNX)
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#define stricmp strcasecmp
|
||||
#else
|
||||
#error Must run under unix or windows, please define UNX or WNT.
|
||||
#endif
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
char C_sSpaceInName[] = " ";
|
||||
|
||||
void
|
||||
WriteName( std::ofstream & o_rFile,
|
||||
WriteName( ofstream & o_rFile,
|
||||
const Simstr & i_rIdlDocuBaseDir,
|
||||
const Simstr & i_rName,
|
||||
E_LinkType i_eLinkType )
|
||||
@@ -89,7 +102,7 @@ WriteName( std::ofstream & o_rFile,
|
||||
if ( pNameEnd != 0 )
|
||||
{
|
||||
const char * pStart = i_rName.str();
|
||||
o_rFile.write( pStart, pNameEnd -1 - pStart );
|
||||
o_rFile.write( pStart, pNameEnd - pStart );
|
||||
WriteStr( o_rFile, C_sSpaceInName );
|
||||
WriteStr( o_rFile, pNameEnd );
|
||||
}
|
||||
@@ -189,3 +202,150 @@ WriteStr( std::ofstream & o_rFile,
|
||||
o_rFile.write( i_sStr.str(), i_sStr.l() );
|
||||
}
|
||||
|
||||
|
||||
const char C_sXML_END[] = "\\*.xml";
|
||||
|
||||
void
|
||||
GatherFileNames( List<Simstr> & o_sFiles,
|
||||
const char * i_sSrcDirectory )
|
||||
{
|
||||
static int nAliveCounter = 0;
|
||||
|
||||
char * sNextDir = 0;
|
||||
Simstr sNew = 0;
|
||||
|
||||
#ifdef WNT
|
||||
struct _finddata_t aEntry;
|
||||
long hFile = 0;
|
||||
int bFindMore = 0;
|
||||
char * sFilter = new char[ strlen(i_sSrcDirectory) + sizeof C_sXML_END ];
|
||||
|
||||
// Stayingalive sign
|
||||
if (++nAliveCounter % 100 == 1)
|
||||
cout << "." << flush;
|
||||
|
||||
strcpy(sFilter, i_sSrcDirectory);
|
||||
strcat(sFilter,C_sXML_END);
|
||||
|
||||
hFile = _findfirst( sFilter, &aEntry );
|
||||
for ( bFindMore = hFile == -1;
|
||||
bFindMore == 0;
|
||||
bFindMore = _findnext( hFile, &aEntry ) )
|
||||
{
|
||||
sNew = i_sSrcDirectory;
|
||||
sNew += "\\";
|
||||
sNew += aEntry.name;
|
||||
o_sFiles.push_back(sNew);
|
||||
} // end for
|
||||
|
||||
_findclose(hFile);
|
||||
delete [] sFilter;
|
||||
#elif defined(UNX)
|
||||
DIR * pDir = opendir( i_sSrcDirectory );
|
||||
dirent * pEntry = 0;
|
||||
char * sEnding;
|
||||
|
||||
// Stayingalive sign
|
||||
if (++nAliveCounter % 100 == 1)
|
||||
cout << "." << flush;
|
||||
|
||||
while ( (pEntry = readdir(pDir)) != 0 )
|
||||
{
|
||||
sEnding = strrchr(pEntry->d_name,'.');
|
||||
if (sEnding != 0 ? stricmp(sEnding,".xml") == 0 : 0 )
|
||||
{
|
||||
sNew = i_sSrcDirectory;
|
||||
sNew += "/";
|
||||
sNew += pEntry->d_name;
|
||||
o_sFiles.push_back(sNew);
|
||||
}
|
||||
} // end while
|
||||
|
||||
closedir( pDir );
|
||||
#else
|
||||
#error Must run on unix or windows, please define UNX or WNT.
|
||||
#endif
|
||||
|
||||
// gathering from subdirectories:
|
||||
List<Simstr> aSubDirectories;
|
||||
GatherSubDirectories( aSubDirectories, i_sSrcDirectory );
|
||||
|
||||
unsigned d_max = aSubDirectories.size();
|
||||
for ( unsigned d = 0; d < d_max; ++d )
|
||||
{
|
||||
sNextDir = new char[ strlen(i_sSrcDirectory) + 2 + aSubDirectories[d].l() ];
|
||||
|
||||
strcpy(sNextDir, i_sSrcDirectory);
|
||||
strcat(sNextDir, C_sSLASH);
|
||||
strcat(sNextDir, aSubDirectories[d].str());
|
||||
GatherFileNames(o_sFiles, sNextDir);
|
||||
|
||||
delete [] sNextDir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char * C_sANYDIR = "\\*.*";
|
||||
|
||||
void
|
||||
GatherSubDirectories( List<Simstr> & o_sSubDirectories,
|
||||
const char * i_sParentdDirectory )
|
||||
{
|
||||
Simstr sNew;
|
||||
|
||||
#ifdef WNT
|
||||
struct _finddata_t aEntry;
|
||||
long hFile = 0;
|
||||
int bFindMore = 0;
|
||||
char * sFilter = new char[strlen(i_sParentdDirectory) + sizeof C_sANYDIR];
|
||||
|
||||
strcpy(sFilter, i_sParentdDirectory);
|
||||
strcat(sFilter,C_sANYDIR);
|
||||
|
||||
hFile = _findfirst( sFilter, &aEntry );
|
||||
for ( bFindMore = hFile == -1;
|
||||
bFindMore == 0;
|
||||
bFindMore = _findnext( hFile, &aEntry ) )
|
||||
{
|
||||
if (aEntry.attrib == _A_SUBDIR)
|
||||
{
|
||||
// Do not gather . .. and outputtree directories
|
||||
if ( strchr(aEntry.name,'.') == 0
|
||||
&& strncmp(aEntry.name, "wnt", 3) != 0
|
||||
&& strncmp(aEntry.name, "unx", 3) != 0 )
|
||||
{
|
||||
sNew = aEntry.name;
|
||||
o_sSubDirectories.push_back(sNew);
|
||||
}
|
||||
} // endif (aEntry.attrib == _A_SUBDIR)
|
||||
} // end for
|
||||
_findclose(hFile);
|
||||
delete [] sFilter;
|
||||
|
||||
#elif defined(UNX)
|
||||
DIR * pDir = opendir( i_sParentdDirectory );
|
||||
dirent * pEntry = 0;
|
||||
struct stat aEntryStatus;
|
||||
char * sEnding;
|
||||
|
||||
while ( ( pEntry = readdir(pDir) ) != 0 )
|
||||
{
|
||||
stat(pEntry->d_name, &aEntryStatus);
|
||||
if ( ( aEntryStatus.st_mode & S_IFDIR ) == S_IFDIR )
|
||||
{
|
||||
// Do not gather . .. and outputtree directories
|
||||
if ( strchr(pEntry->d_name,'.') == 0
|
||||
&& strncmp(pEntry->d_name, "wnt", 3) != 0
|
||||
&& strncmp(pEntry->d_name, "unx", 3) != 0 )
|
||||
{
|
||||
sNew = pEntry->d_name;
|
||||
o_sSubDirectories.push_back(sNew);
|
||||
}
|
||||
} // endif (aEntry.attrib == _A_SUBDIR)
|
||||
} // end while
|
||||
closedir( pDir );
|
||||
#else
|
||||
#error Must run on unix or windows, please define UNX or WNT.
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: syshelp.hxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:51 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:23:17 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -71,7 +71,7 @@
|
||||
#include <fstream>
|
||||
|
||||
class Simstr;
|
||||
|
||||
template <class XY> class List;
|
||||
|
||||
|
||||
#ifdef WNT
|
||||
@@ -106,6 +106,14 @@ void WriteStr(
|
||||
std::ofstream & o_rFile,
|
||||
const Simstr & i_sStr );
|
||||
|
||||
void GatherFileNames(
|
||||
List<Simstr> & o_sFiles,
|
||||
const char * i_sSrcDirectory );
|
||||
void GatherSubDirectories(
|
||||
List<Simstr> & o_sSubDirectories,
|
||||
const char * i_sParentdDirectory );
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cr_html.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -87,14 +87,14 @@ char C_sHtmlFileFoot[] = "</BODY>\n</HTML>\n";
|
||||
|
||||
|
||||
HtmlCreator::HtmlCreator( const char * i_pOutputFileName,
|
||||
const ModuleDescription & i_rDescr,
|
||||
const XmlElement & i_rDocument,
|
||||
const Simstr & i_sIDL_BaseDirectory )
|
||||
: aFile(i_pOutputFileName, ios::out
|
||||
#ifdef WNT
|
||||
| ios::binary
|
||||
#endif
|
||||
),
|
||||
rDescr(i_rDescr),
|
||||
rDocument(i_rDocument),
|
||||
sIdl_BaseDirectory(i_sIDL_BaseDirectory)
|
||||
{
|
||||
if ( !aFile )
|
||||
@@ -116,147 +116,16 @@ HtmlCreator::Run()
|
||||
WriteStr( "ModuleDescription" );
|
||||
WriteStr( C_sHtmlFileHeader2 );
|
||||
|
||||
StartTable();
|
||||
|
||||
const ParentElement::ChildList & rModuleElements = rDescr.Children();
|
||||
unsigned i_max = rModuleElements.size();
|
||||
|
||||
for (unsigned i = 0; i < i_max; i++)
|
||||
{
|
||||
Write_TextElement( *rModuleElements[i], lt_nolink ); // Name,
|
||||
// ProjectBuildDependency,
|
||||
// RuntimeModuleDependency
|
||||
} // end for
|
||||
|
||||
WriteStr( "<TR><TD COLSPAN=2>\n"
|
||||
"<H4><BR>Components</H4>\n" );
|
||||
|
||||
const ModuleDescription::CD_List & rCDs = rDescr.Components();
|
||||
unsigned d_max = rCDs.size();
|
||||
for (unsigned d = 0; d < d_max; d++)
|
||||
{
|
||||
WriteStr( "<P><BR><BR></P>\n" );
|
||||
|
||||
Write_Description( *rCDs[d] );
|
||||
} // end for
|
||||
|
||||
WriteStr( "</TD><TR>\n" );
|
||||
FinishTable();
|
||||
rDocument.Write2Html(*this);
|
||||
|
||||
WriteStr( "<P><BR><BR></P>\n" );
|
||||
WriteStr( C_sHtmlFileFoot );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HtmlCreator::Write_Description( const ComponentDescription & i_rDescr )
|
||||
{
|
||||
StartTable();
|
||||
|
||||
const ParentElement::ChildList & rDescrElements = i_rDescr.Children();
|
||||
|
||||
unsigned i_max = rDescrElements.size();
|
||||
Write_TextElement( *rDescrElements[0], lt_nolink ); // Name
|
||||
Write_TextElement( *rDescrElements[1], lt_nolink ); // Author
|
||||
Write_TextElement( *rDescrElements[2], lt_nolink ); // Description
|
||||
Write_TextElement( *rDescrElements[3], lt_idl ); // Loader Name
|
||||
Write_TextElement( *rDescrElements[4], lt_nolink ); // Language
|
||||
|
||||
Write_Status(i_rDescr.Status()); // Status
|
||||
|
||||
for (unsigned i = 5; i < i_max; i++)
|
||||
{
|
||||
Write_TextElement( *rDescrElements[i], lt_idl ); // Supported Service,
|
||||
// Service Dependency,
|
||||
// Type
|
||||
|
||||
} // end for
|
||||
|
||||
const ComponentDescription::Docu_List & rDocuRefs = i_rDescr.DocuRefs();
|
||||
unsigned r_max = rDocuRefs.size();
|
||||
for (unsigned r = 0; r < r_max; r++)
|
||||
{
|
||||
Write_ReferenceDocu(*rDocuRefs[r]);
|
||||
} // end for
|
||||
|
||||
FinishTable();
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::Write_TextElement( TextElement & i_rElement,
|
||||
E_LinkType i_eLinkType )
|
||||
{
|
||||
StartRow();
|
||||
|
||||
WriteElementName( i_rElement );
|
||||
WriteElementData( i_rElement, i_eLinkType );
|
||||
|
||||
FinishRow();
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::Write_ReferenceDocu( const ReferenceDocuElement & i_rRefDocu )
|
||||
{
|
||||
StartRow();
|
||||
|
||||
StartCell( "23%" );
|
||||
WriteStr("ReferenceDocu");
|
||||
FinishCell();
|
||||
|
||||
StartCell( "77%" );
|
||||
if ( i_rRefDocu.sAttr_href.l() > 0)
|
||||
{
|
||||
WriteStr("<A href=\"http://");
|
||||
WriteStr(i_rRefDocu.sAttr_href.str());
|
||||
WriteStr("\">");
|
||||
WriteStr(i_rRefDocu.sAttr_href.str());
|
||||
WriteStr("</A><BR>\n");
|
||||
}
|
||||
if ( i_rRefDocu.sAttr_title.l() > 0)
|
||||
{
|
||||
WriteStr("Title: ");
|
||||
WriteStr(i_rRefDocu.sAttr_title.str());
|
||||
WriteStr("<BR>\n");
|
||||
}
|
||||
if ( i_rRefDocu.sAttr_role.l() > 0)
|
||||
{
|
||||
WriteStr("Role: ");
|
||||
WriteStr(i_rRefDocu.sAttr_role.str());
|
||||
}
|
||||
FinishCell();
|
||||
|
||||
FinishRow();
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::Write_Status(const char * i_sStatus)
|
||||
{
|
||||
StartRow();
|
||||
|
||||
StartCell( "23%" );
|
||||
WriteStr("status");
|
||||
FinishCell();
|
||||
|
||||
StartCell( "77%");
|
||||
WriteName( aFile, sIdl_BaseDirectory, i_sStatus, lt_nolink );
|
||||
FinishCell();
|
||||
|
||||
FinishRow();
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::PrintH1( char * i_pText)
|
||||
{
|
||||
static char sH1a[] = "<H1 ALIGN=CENTER>";
|
||||
static char sH1e[] = "</H1>";
|
||||
WriteStr(sH1a);
|
||||
WriteStr(i_pText);
|
||||
WriteStr(sH1e);
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::StartTable()
|
||||
{
|
||||
WriteStr( "<P><BR></P>\n" );
|
||||
WriteStr(
|
||||
"<TABLE WIDTH=95% BORDER=1 CELLSPACING=0 CELLPADDING=4>\n"
|
||||
" <TBODY>\n" );
|
||||
@@ -269,6 +138,140 @@ HtmlCreator::FinishTable()
|
||||
"</TABLE>\n\n" );
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::StartBigCell( const char * i_sTitle )
|
||||
{
|
||||
WriteStr( "<TR><TD COLSPAN=2>\n"
|
||||
"<H4><BR>" );
|
||||
WriteStr( i_sTitle );
|
||||
WriteStr( "</H4>\n" );
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::FinishBigCell()
|
||||
{
|
||||
WriteStr( "</TD><TR>\n" );
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::Write_SglTextElement( const SglTextElement & i_rElement,
|
||||
bool i_bStrong )
|
||||
{
|
||||
StartRow();
|
||||
|
||||
WriteElementName( i_rElement.Name(), i_bStrong );
|
||||
|
||||
StartCell( "77%");
|
||||
if (i_bStrong)
|
||||
{
|
||||
WriteStr( "<H4><A NAME=\"" );
|
||||
unsigned nLen = strlen(i_rElement.Data());
|
||||
if ( i_rElement.IsReversedName())
|
||||
{
|
||||
const char * pEnd = strchr(i_rElement.Data(), ' ');
|
||||
nLen = pEnd - i_rElement.Data();
|
||||
}
|
||||
aFile.write( i_rElement.Data(), nLen );
|
||||
WriteStr( "\">" );
|
||||
}
|
||||
|
||||
WriteName( aFile, sIdl_BaseDirectory, i_rElement.Data(),
|
||||
i_bStrong ? lt_nolink : i_rElement.LinkType() );
|
||||
|
||||
if (i_bStrong)
|
||||
WriteStr( "</A></H4>" );
|
||||
FinishCell();
|
||||
|
||||
FinishRow();
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::Write_MultiTextElement( const MultipleTextElement & i_rElement )
|
||||
{
|
||||
StartRow();
|
||||
|
||||
WriteElementName( i_rElement.Name(), false );
|
||||
|
||||
StartCell( "77%");
|
||||
unsigned i_max = i_rElement.Size();
|
||||
for ( unsigned i = 0; i < i_max; ++i )
|
||||
{
|
||||
if (i > 0)
|
||||
WriteStr( "<BR>\n" );
|
||||
WriteName( aFile, sIdl_BaseDirectory, i_rElement.Data(i), i_rElement.LinkType() );
|
||||
} // end for
|
||||
FinishCell();
|
||||
|
||||
FinishRow();
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::Write_SglText( const Simstr & i_sName,
|
||||
const Simstr & i_sValue )
|
||||
{
|
||||
StartRow();
|
||||
|
||||
WriteElementName( i_sName, false );
|
||||
|
||||
StartCell( "77%");
|
||||
WriteStr( i_sValue );
|
||||
FinishCell();
|
||||
|
||||
FinishRow();
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::Write_ReferenceDocu( const Simstr & i_sName,
|
||||
const Simstr & i_sRef,
|
||||
const Simstr & i_sRole,
|
||||
const Simstr & i_sTitle )
|
||||
{
|
||||
StartRow();
|
||||
|
||||
StartCell( "23%" );
|
||||
WriteStr(i_sName);
|
||||
FinishCell();
|
||||
|
||||
StartCell( "77%" );
|
||||
if ( !i_sRef.is_empty() )
|
||||
{
|
||||
WriteStr("<A href=\"");
|
||||
WriteStr(i_sRef);
|
||||
WriteStr("\">");
|
||||
if ( !i_sTitle.is_empty() )
|
||||
WriteStr( i_sTitle );
|
||||
else
|
||||
WriteStr(i_sRef);
|
||||
WriteStr("</A><BR>\n");
|
||||
}
|
||||
else if ( !i_sTitle.is_empty() )
|
||||
{
|
||||
WriteStr("Title: ");
|
||||
WriteStr( i_sTitle );
|
||||
WriteStr("<BR>\n");
|
||||
}
|
||||
if ( !i_sRole.is_empty() )
|
||||
{
|
||||
WriteStr("Role: ");
|
||||
WriteStr( i_sRole );
|
||||
}
|
||||
FinishCell();
|
||||
|
||||
FinishRow();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HtmlCreator::PrintH1( char * i_pText)
|
||||
{
|
||||
static char sH1a[] = "<H1 ALIGN=CENTER>";
|
||||
static char sH1e[] = "</H1>";
|
||||
WriteStr(sH1a);
|
||||
WriteStr(i_pText);
|
||||
WriteStr(sH1e);
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::StartRow()
|
||||
{
|
||||
@@ -296,62 +299,17 @@ HtmlCreator::FinishCell()
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::WriteElementName( TextElement & i_rElement )
|
||||
HtmlCreator::WriteElementName( const Simstr & i_sName,
|
||||
bool i_bStrong )
|
||||
{
|
||||
StartCell( "23%" );
|
||||
const char * pName = i_rElement.Name();
|
||||
bool bStrong = strcmp(pName,"name") == 0 || strcmp(pName,"module-name") == 0;
|
||||
|
||||
if (bStrong)
|
||||
if (i_bStrong)
|
||||
WriteStr( "<H4>" );
|
||||
WriteStr(pName);
|
||||
if (bStrong)
|
||||
WriteStr(i_sName);
|
||||
if (i_bStrong)
|
||||
WriteStr( "</H4>" );
|
||||
FinishCell();
|
||||
}
|
||||
|
||||
void
|
||||
HtmlCreator::WriteElementData( TextElement & i_rElement,
|
||||
E_LinkType i_eLinkType )
|
||||
{
|
||||
StartCell( "77%");
|
||||
|
||||
bool bStrong = strcmp(i_rElement.Name(),"name") == 0 || strcmp(i_rElement.Name(),"module-name") == 0;
|
||||
|
||||
if (bStrong)
|
||||
{
|
||||
WriteStr( "<H4><A NAME=\"" );
|
||||
int nLen = strlen(i_rElement.Data());
|
||||
if ( *i_rElement.Name() == 'n')
|
||||
{
|
||||
const char * pEnd = strchr(i_rElement.Data(), ' ');
|
||||
if (pEnd)
|
||||
{
|
||||
nLen = pEnd - i_rElement.Data();
|
||||
}
|
||||
}
|
||||
aFile.write( i_rElement.Data(), nLen );
|
||||
WriteStr( "\">" );
|
||||
}
|
||||
|
||||
WriteName( aFile, sIdl_BaseDirectory, i_rElement.Data(), i_eLinkType );
|
||||
|
||||
if (bStrong)
|
||||
WriteStr( "</A></H4>" );
|
||||
|
||||
|
||||
unsigned i_max = i_rElement.Size();
|
||||
if ( i_max > 1 )
|
||||
{
|
||||
for ( unsigned i = 1; i < i_max; ++i )
|
||||
{
|
||||
WriteStr( "<BR>\n" );
|
||||
WriteName( aFile, sIdl_BaseDirectory, i_rElement.Data(i), i_eLinkType );
|
||||
} // end for
|
||||
} // end if
|
||||
|
||||
FinishCell();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cr_html.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -69,10 +69,9 @@
|
||||
#include "../support/syshelp.hxx"
|
||||
|
||||
|
||||
class ModuleDescription;
|
||||
class ComponentDescription;
|
||||
class TextElement;
|
||||
class ReferenceDocuElement;
|
||||
class XmlElement;
|
||||
class SglTextElement;
|
||||
class MultipleTextElement;
|
||||
|
||||
|
||||
class HtmlCreator
|
||||
@@ -80,49 +79,51 @@ class HtmlCreator
|
||||
public:
|
||||
HtmlCreator(
|
||||
const char * i_pOutputFileName,
|
||||
const ModuleDescription &
|
||||
i_rDescr,
|
||||
const XmlElement & i_rDocument,
|
||||
const Simstr & i_sIDL_BaseDirectory );
|
||||
~HtmlCreator();
|
||||
|
||||
void Run();
|
||||
|
||||
void StartTable();
|
||||
void FinishTable();
|
||||
void StartBigCell(
|
||||
const char * i_sTitle );
|
||||
void FinishBigCell();
|
||||
|
||||
void Write_SglTextElement(
|
||||
const SglTextElement &
|
||||
i_rElement,
|
||||
bool i_bStrong = false );
|
||||
void Write_MultiTextElement(
|
||||
const MultipleTextElement &
|
||||
i_rElement );
|
||||
void Write_SglText(
|
||||
const Simstr & i_sName,
|
||||
const Simstr & i_sValue );
|
||||
void Write_ReferenceDocu(
|
||||
const Simstr & i_sName,
|
||||
const Simstr & i_sRef,
|
||||
const Simstr & i_sRole,
|
||||
const Simstr & i_sTitle );
|
||||
private:
|
||||
void PrintH1(
|
||||
char * i_pText );
|
||||
void StartTable();
|
||||
void FinishTable();
|
||||
void StartRow();
|
||||
void FinishRow();
|
||||
void StartCell(
|
||||
char * i_pWidth );
|
||||
void FinishCell();
|
||||
|
||||
|
||||
void Write_Description(
|
||||
const ComponentDescription &
|
||||
i_rDescr );
|
||||
void Write_TextElement(
|
||||
TextElement & i_rElement,
|
||||
E_LinkType i_eLinkType );
|
||||
void Write_ReferenceDocu(
|
||||
const ReferenceDocuElement &
|
||||
i_rRefDocu );
|
||||
void Write_Status(
|
||||
const char * i_sStatus );
|
||||
void WriteElementName(
|
||||
TextElement & i_rElement );
|
||||
void WriteElementData(
|
||||
TextElement & i_rElement,
|
||||
E_LinkType i_eLinkType );
|
||||
|
||||
const Simstr & i_sName,
|
||||
bool i_bStrong );
|
||||
void WriteStr(
|
||||
const char * i_sStr )
|
||||
{ aFile.write( i_sStr, strlen(i_sStr) ); }
|
||||
// DATA
|
||||
ofstream aFile;
|
||||
const ModuleDescription &
|
||||
rDescr;
|
||||
const XmlElement & rDocument;
|
||||
Simstr sIdl_BaseDirectory;
|
||||
};
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cr_index.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -72,6 +72,7 @@
|
||||
using std::cerr;
|
||||
using std::ofstream;
|
||||
|
||||
extern unsigned C_nSupportedServicesIndex;
|
||||
|
||||
char C_sLineEnd[] = "\n";
|
||||
|
||||
@@ -84,83 +85,26 @@ char C_sModule[] = "ModuleName";
|
||||
char C_sComponentname[] = "ComponentName";
|
||||
|
||||
|
||||
int NrOfTagName(const char * i_sName);
|
||||
|
||||
|
||||
Simstr sIdlRootPath;
|
||||
|
||||
void WriteTableFromHeap(
|
||||
ofstream & o_rOut,
|
||||
Heap & i_rHeap,
|
||||
const char * i_sIndexKey,
|
||||
const char * i_sIndexReference,
|
||||
E_LinkType i_eLinkType );
|
||||
void WriteHeap(
|
||||
ofstream & o_rOut,
|
||||
Heap & i_rHeap,
|
||||
E_LinkType i_eLinkType );
|
||||
|
||||
|
||||
Index::Index( const char * i_sOutputDirectory,
|
||||
const char * i_sIdlRootPath,
|
||||
const List<Simstr> & i_rTagList )
|
||||
: aService2Module(20),
|
||||
aModule2Service(20),
|
||||
aTagIndices(i_rTagList),
|
||||
sOutputDirectory(i_sOutputDirectory),
|
||||
sIdlRootPath(i_sIdlRootPath)
|
||||
// sCurModule
|
||||
{
|
||||
::sIdlRootPath = i_sIdlRootPath;
|
||||
}
|
||||
|
||||
Index::IndexedTags::IndexedTags( const List<Simstr> & i_rTagList )
|
||||
: nSize(i_rTagList.size())
|
||||
{
|
||||
aTagHeaps.reserve(nSize);
|
||||
aTagNames.reserve(nSize);
|
||||
|
||||
for (int h = 0; h < C_nNrOfTagNames; ++h )
|
||||
{
|
||||
aHeapsPerIndex[h] = 0;
|
||||
}
|
||||
|
||||
for ( unsigned i = 0; i < nSize; ++i )
|
||||
{
|
||||
int nNr = NrOfTagName(i_rTagList[i]);
|
||||
if ( nNr > -1 )
|
||||
{
|
||||
Heap * pNew = new Heap(20);
|
||||
aTagHeaps.push_back( pNew );
|
||||
aTagNames.push_back( i_rTagList[i] );
|
||||
aHeapsPerIndex[nNr] = pNew;
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "Warning: It is not possible to create an index for the tag "
|
||||
<< i_rTagList[i]
|
||||
<< "."
|
||||
<< std::endl;
|
||||
}
|
||||
} // end for
|
||||
}
|
||||
|
||||
Index::~Index()
|
||||
{
|
||||
}
|
||||
|
||||
Index::IndexedTags::~IndexedTags()
|
||||
{
|
||||
}
|
||||
|
||||
Heap *
|
||||
Index::IndexedTags::HeapFor( const char * i_sTagName )
|
||||
{
|
||||
int nNr = NrOfTagName(i_sTagName);
|
||||
if (nNr > -1 )
|
||||
return aHeapsPerIndex[nNr];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
Index::GatherData( const List<Simstr> & i_rInputFileList )
|
||||
{
|
||||
@@ -192,16 +136,17 @@ Index::WriteOutput( const char * i_sOuputFile )
|
||||
WriteTableFromHeap( aOut, aService2Module, C_sService, C_sModule, lt_html );
|
||||
WriteTableFromHeap( aOut, aModule2Service, C_sModule, C_sService, lt_idl );
|
||||
|
||||
for ( unsigned i = 0; i < aTagIndices.nSize; ++i )
|
||||
{
|
||||
WriteTableFromHeap( aOut, *aTagIndices.aTagHeaps[i],
|
||||
aTagIndices.aTagNames[i], C_sComponentname, lt_html );
|
||||
}
|
||||
|
||||
WriteStr( aOut, C_sFileEnd );
|
||||
aOut.close();
|
||||
}
|
||||
|
||||
void
|
||||
Index::InsertSupportedService( const Simstr & i_sService )
|
||||
{
|
||||
aService2Module.InsertValue( i_sService, sCurModule );
|
||||
aModule2Service.InsertValue( sCurModule, i_sService );
|
||||
}
|
||||
|
||||
void
|
||||
Index::ReadFile( const char * i_sFilename )
|
||||
{
|
||||
@@ -210,7 +155,9 @@ Index::ReadFile( const char * i_sFilename )
|
||||
ModuleDescription aModule;
|
||||
X2CParser aParser(aModule);
|
||||
|
||||
if ( ! aParser.Parse(i_sFilename) )
|
||||
// Parse
|
||||
bool bResult = aParser.Parse(i_sFilename);
|
||||
if (! bResult)
|
||||
{
|
||||
cerr << "Error: File \""
|
||||
<< i_sFilename
|
||||
@@ -225,67 +172,15 @@ Index::ReadFile( const char * i_sFilename )
|
||||
aHtmlCreator.Run();
|
||||
|
||||
// GetResults:
|
||||
Simstr sModuleName = aModule.Name();
|
||||
sCurModule = aModule.ModuleName();
|
||||
|
||||
// Module Tags
|
||||
const ModuleDescription::ChildList &
|
||||
rModuleElements = aModule.Children();
|
||||
for ( unsigned mi = 1; mi < rModuleElements.size(); ++mi )
|
||||
List< const MultipleTextElement* > aSupportedServices;
|
||||
aModule.Get_SupportedServices(aSupportedServices);
|
||||
|
||||
for ( unsigned s = 0; s < aSupportedServices.size(); ++s )
|
||||
{
|
||||
Heap * pHeap = aTagIndices.HeapFor(rModuleElements[mi]->Name());
|
||||
if (pHeap != 0)
|
||||
{
|
||||
unsigned nDatSize = rModuleElements[mi]->Size();
|
||||
for ( unsigned d = 0; d < nDatSize; ++d )
|
||||
{
|
||||
pHeap->InsertValue( rModuleElements[mi]->Data(d), sModuleName.str() );
|
||||
}
|
||||
}
|
||||
} // end for
|
||||
|
||||
// Component Tags
|
||||
const ModuleDescription::CD_List &
|
||||
rCDs = aModule.Components();
|
||||
static char sCD_inModule[1020];
|
||||
strcpy( sCD_inModule, sModuleName.str() );
|
||||
strcat( sCD_inModule, "," );
|
||||
char * pCut = strchr(sCD_inModule,',') + 1;
|
||||
|
||||
for ( unsigned cd = 0; cd < rCDs.size(); ++cd )
|
||||
{
|
||||
const ComponentDescription::ChildList &
|
||||
rCD_Elements = rCDs[cd]->Children();
|
||||
strcpy( pCut, rCDs[cd]->Name() );
|
||||
for ( unsigned ci = 1; ci < rCD_Elements.size(); ++ci )
|
||||
{
|
||||
if ( ci == 5 )
|
||||
{
|
||||
TextElement * pElem = rCD_Elements[ci];
|
||||
unsigned nDatSize = pElem->Size();
|
||||
for ( unsigned d = 0; d < nDatSize; ++d )
|
||||
{
|
||||
aService2Module.InsertValue(
|
||||
pElem->Data(d),
|
||||
sModuleName );
|
||||
aModule2Service.InsertValue(
|
||||
sModuleName,
|
||||
pElem->Data(d) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Heap * pHeap = aTagIndices.HeapFor(rCD_Elements[ci]->Name());
|
||||
if (pHeap != 0)
|
||||
{
|
||||
unsigned nDatSize = rCD_Elements[ci]->Size();
|
||||
for ( unsigned d = 0; d < nDatSize; ++d )
|
||||
{
|
||||
pHeap->InsertValue( rCD_Elements[ci]->Data(d), sCD_inModule );
|
||||
}
|
||||
}
|
||||
} // end if (ci == 6) else
|
||||
} // end for
|
||||
} // for
|
||||
aSupportedServices[s]->Insert2Index(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -300,17 +195,17 @@ Index::CreateHtmlFileName( char * o_sOutputHtml,
|
||||
#else
|
||||
#error WNT or UNX have to be defined.
|
||||
#endif
|
||||
strcat( o_sOutputHtml, i_rModule.Name() );
|
||||
strcat( o_sOutputHtml, i_rModule.ModuleName() );
|
||||
strcat( o_sOutputHtml, ".html" );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WriteTableFromHeap( ofstream & o_rOut,
|
||||
Heap & i_rHeap,
|
||||
const char * i_sIndexValue,
|
||||
const char * i_sIndexReference,
|
||||
E_LinkType i_eLinkType )
|
||||
Index::WriteTableFromHeap( ofstream & o_rOut,
|
||||
Heap & i_rHeap,
|
||||
const char * i_sIndexValue,
|
||||
const char * i_sIndexReference,
|
||||
E_LinkType i_eLinkType )
|
||||
{
|
||||
WriteStr(o_rOut, "<H3><BR>");
|
||||
WriteStr(o_rOut, i_sIndexValue );
|
||||
@@ -325,9 +220,9 @@ WriteTableFromHeap( ofstream & o_rOut,
|
||||
|
||||
|
||||
void
|
||||
WriteHeap( ofstream & o_rOut,
|
||||
Heap & i_rHeap,
|
||||
E_LinkType i_eLinkType )
|
||||
Index::WriteHeap( ofstream & o_rOut,
|
||||
Heap & i_rHeap,
|
||||
E_LinkType i_eLinkType )
|
||||
{
|
||||
static Simstr S_sKey;
|
||||
static char C_sSpaceInName[] = " ";
|
||||
@@ -373,58 +268,6 @@ WriteHeap( ofstream & o_rOut,
|
||||
WriteStr( o_rOut, "</TD></TR>\n" );
|
||||
}
|
||||
|
||||
int
|
||||
NrOfTagName( const char * i_sName )
|
||||
{
|
||||
static const char * aTagNames[C_nNrOfTagNames] =
|
||||
{
|
||||
// "module-name", // 1
|
||||
"author", // 1 0
|
||||
// "name", // 1
|
||||
// "description", // 1
|
||||
"loader-name", // 1 1
|
||||
"language", // 1 2
|
||||
// "status",
|
||||
"supported-service", // + 3
|
||||
// "reference-docu",
|
||||
"service-dependency", // * 4
|
||||
"type", // * 5
|
||||
"project-build-dependency", // * 6
|
||||
"runtime-module-dependency", // * 7
|
||||
};
|
||||
if (! i_sName)
|
||||
return -1;
|
||||
|
||||
switch (*i_sName)
|
||||
{
|
||||
case 'a': if ( strcmp( aTagNames[0], i_sName ) == 0 )
|
||||
return 0;
|
||||
break;
|
||||
case 'l': if ( strcmp( aTagNames[1], i_sName ) == 0 )
|
||||
return 1;
|
||||
else if ( strcmp( aTagNames[2], i_sName ) == 0 )
|
||||
return 1;
|
||||
break;
|
||||
case 's': if ( strcmp( aTagNames[3], i_sName ) == 0 )
|
||||
return 3;
|
||||
else if ( strcmp( aTagNames[4], i_sName ) == 0 )
|
||||
return 4;
|
||||
break;
|
||||
case 't': if ( strcmp( aTagNames[5], i_sName ) == 0 )
|
||||
return 5;
|
||||
break;
|
||||
case 'p': if ( strcmp( aTagNames[6], i_sName ) == 0 )
|
||||
return 6;
|
||||
break;
|
||||
case 'r': if ( strcmp( aTagNames[7], i_sName ) == 0 )
|
||||
return 7;
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** <20>bersicht der Struktur
|
||||
@@ -447,6 +290,9 @@ MODULEDESCRIPTION
|
||||
}
|
||||
ProjectBuildDependency*
|
||||
RuntimeModuleDependency*
|
||||
ReferenceDocu*
|
||||
ServiceDependency*
|
||||
Type*
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cr_index.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -65,9 +65,9 @@
|
||||
#include "../support/sistr.hxx"
|
||||
#include "../support/heap.hxx"
|
||||
#include "../support/list.hxx"
|
||||
#include "../support/syshelp.hxx"
|
||||
|
||||
|
||||
const unsigned C_nNrOfTagNames = 8;
|
||||
class ModuleDescription;
|
||||
|
||||
|
||||
@@ -87,40 +87,35 @@ class Index
|
||||
void WriteOutput(
|
||||
const char * i_sOuputFile );
|
||||
|
||||
void InsertSupportedService(
|
||||
const Simstr & i_sService );
|
||||
private:
|
||||
struct IndexedTags
|
||||
{
|
||||
public:
|
||||
IndexedTags(
|
||||
const List<Simstr> &
|
||||
i_rTagList );
|
||||
~IndexedTags();
|
||||
|
||||
Heap * HeapFor(
|
||||
const char * i_sTagName );
|
||||
|
||||
DynamicList< Heap >
|
||||
aTagHeaps;
|
||||
List< Simstr > aTagNames;
|
||||
unsigned nSize;
|
||||
|
||||
private:
|
||||
Heap * aHeapsPerIndex[C_nNrOfTagNames];
|
||||
};
|
||||
|
||||
void ReadFile(
|
||||
const char * i_sFilename );
|
||||
void CreateHtmlFileName(
|
||||
char * o_sOutputHtml,
|
||||
const ModuleDescription &
|
||||
i_rModule );
|
||||
void WriteTableFromHeap(
|
||||
std::ofstream & o_rOut,
|
||||
Heap & i_rHeap,
|
||||
const char * i_sIndexKey,
|
||||
const char * i_sIndexReference,
|
||||
E_LinkType i_eLinkType );
|
||||
void WriteHeap(
|
||||
std::ofstream & o_rOut,
|
||||
Heap & i_rHeap,
|
||||
E_LinkType i_eLinkType );
|
||||
|
||||
// DATA
|
||||
Heap aService2Module;
|
||||
Heap aModule2Service;
|
||||
IndexedTags aTagIndices;
|
||||
|
||||
Simstr sOutputDirectory;
|
||||
Simstr sIdlRootPath;
|
||||
|
||||
// Temporary Data
|
||||
Simstr sCurModule;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cr_metho.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -77,7 +77,7 @@ char C_sFileHeader2[] = " */\r\n/* Implementation of component_getDescriptionFun
|
||||
char C_sFuncBegin[] = "#ifdef __cplusplus\r\n"
|
||||
"extern \"C\" {\r\n"
|
||||
"#endif\r\n\r\n"
|
||||
"const sal_Char * SAL_CALL\ncomponent_getDescriptionFunc()\r\n"
|
||||
"const sal_Char * SAL_CALL\r\ncomponent_getDescriptionFunc()\r\n"
|
||||
"{\r\n"
|
||||
" return (sal_Char*) \r\n"
|
||||
" \"";
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: cr_metho.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: filebuff.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: filebuff.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: main.cxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
* last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -68,37 +68,22 @@
|
||||
#include "cr_metho.hxx"
|
||||
#include "cr_html.hxx"
|
||||
#include "cr_index.hxx"
|
||||
#include "xmlelem.hxx"
|
||||
#include "xmltree.hxx"
|
||||
#include "parse.hxx"
|
||||
#include "../support/syshelp.hxx"
|
||||
#include "../support/heap.hxx"
|
||||
|
||||
|
||||
#ifdef WNT
|
||||
#include <io.h>
|
||||
#elif defined(UNX)
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#define stricmp strcasecmp
|
||||
#else
|
||||
#error Must run under unix or windows, please define UNX or WNT.
|
||||
#endif
|
||||
|
||||
|
||||
using std::cerr;
|
||||
using namespace std;
|
||||
|
||||
|
||||
int Do_IndexCommandLine(
|
||||
const CommandLine & i_rCommandLine );
|
||||
int Do_SingleFileCommandLine(
|
||||
const CommandLine & i_rCommandLine );
|
||||
void GatherFileNames(
|
||||
List<Simstr> & o_sFiles,
|
||||
const char * i_sSrcDirectory );
|
||||
void GatherSubDirectories(
|
||||
List<Simstr> & o_sSubDirectories,
|
||||
const char * i_sParentdDirectory );
|
||||
void Create_TypeInfoFile(
|
||||
const char * o_sOutputFile,
|
||||
ModuleDescription & i_rData );
|
||||
@@ -117,7 +102,7 @@ main( int argc,
|
||||
|
||||
if (! aCommandLine.IsOk())
|
||||
{
|
||||
cerr << aCommandLine.ErrorText() << std::endl;
|
||||
cerr << aCommandLine.ErrorText() << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -136,20 +121,30 @@ Do_SingleFileCommandLine(const CommandLine & i_rCommandLine)
|
||||
ModuleDescription aDescr;
|
||||
X2CParser aParser(aDescr);
|
||||
|
||||
// Parse
|
||||
bool bParseResult = aParser.Parse(i_rCommandLine.XmlSrcFile());
|
||||
if (! bParseResult)
|
||||
// Load file and create Function-file
|
||||
bool bLoadResult = aParser.LoadFile(i_rCommandLine.XmlSrcFile());
|
||||
if (! bLoadResult)
|
||||
{
|
||||
cerr << "Error: File %s could not be parsed." << i_rCommandLine.XmlSrcFile() << std::endl;
|
||||
cerr << "Error: File %s could not be loaded." << i_rCommandLine.XmlSrcFile() << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Produce output
|
||||
if ( strlen(i_rCommandLine.FuncFile()) > 0 )
|
||||
{
|
||||
Create_AccessMethod( i_rCommandLine.FuncFile(),
|
||||
aParser.PureText() );
|
||||
}
|
||||
|
||||
cout << "File "
|
||||
<< i_rCommandLine.FuncFile()
|
||||
<< " with component_getDescriptionFunc() is created now."
|
||||
<< endl;
|
||||
|
||||
|
||||
// Parse
|
||||
aParser.Parse();
|
||||
|
||||
// Produce output
|
||||
if ( strlen(i_rCommandLine.HtmlFile()) > 0 )
|
||||
{
|
||||
HtmlCreator aHtmlCreator( i_rCommandLine.HtmlFile(),
|
||||
@@ -176,162 +171,19 @@ Do_IndexCommandLine(const CommandLine & i_rCommandLine)
|
||||
i_rCommandLine.IdlRootPath(),
|
||||
i_rCommandLine.IndexedTags() );
|
||||
|
||||
std::cout << "Gather xml-files ..." << std::endl;
|
||||
std::cout << "Gather xml-files ..." << endl;
|
||||
GatherFileNames( aFiles, i_rCommandLine.XmlSrcDirectory() );
|
||||
|
||||
std::cout << "Create output ..." << std::endl;
|
||||
std::cout << "Create output ..." << endl;
|
||||
aIndex.GatherData(aFiles);
|
||||
aIndex.WriteOutput( i_rCommandLine.IndexOutputFile() );
|
||||
|
||||
std::cout << "... done." << std::endl;
|
||||
std::cout << "... done." << endl;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
const char C_sXML_END[] = "\\*.xml";
|
||||
|
||||
void
|
||||
GatherFileNames( List<Simstr> & o_sFiles,
|
||||
const char * i_sSrcDirectory )
|
||||
{
|
||||
static int nAliveCounter = 0;
|
||||
|
||||
char * sNextDir = 0;
|
||||
Simstr sNew = 0;
|
||||
|
||||
#ifdef WNT
|
||||
struct _finddata_t aEntry;
|
||||
long hFile = 0;
|
||||
int bFindMore = 0;
|
||||
char * sFilter = new char[ strlen(i_sSrcDirectory) + sizeof C_sXML_END ];
|
||||
|
||||
// Stayingalive sign
|
||||
if (++nAliveCounter % 100 == 1)
|
||||
fprintf(stdout,".");
|
||||
|
||||
strcpy(sFilter, i_sSrcDirectory);
|
||||
strcat(sFilter,C_sXML_END);
|
||||
|
||||
hFile = _findfirst( sFilter, &aEntry );
|
||||
for ( bFindMore = hFile == -1;
|
||||
bFindMore == 0;
|
||||
bFindMore = _findnext( hFile, &aEntry ) )
|
||||
{
|
||||
sNew = i_sSrcDirectory;
|
||||
sNew += "\\";
|
||||
sNew += aEntry.name;
|
||||
o_sFiles.push_back(sNew);
|
||||
} // end for
|
||||
|
||||
_findclose(hFile);
|
||||
delete [] sFilter;
|
||||
#elif defined(UNX)
|
||||
DIR * pDir = opendir( i_sSrcDirectory );
|
||||
dirent * pEntry = 0;
|
||||
char * sEnding;
|
||||
|
||||
while ( (pEntry = readdir(pDir)) != 0 )
|
||||
{
|
||||
sEnding = strrchr(pEntry->d_name,'.');
|
||||
if (sEnding != 0 ? stricmp(sEnding,".xml") == 0 : 0 )
|
||||
{
|
||||
sNew = i_sSrcDirectory;
|
||||
sNew += "/";
|
||||
sNew += pEntry->d_name;
|
||||
o_sFiles.push_back(sNew);
|
||||
}
|
||||
} // end while
|
||||
|
||||
closedir( pDir );
|
||||
#else
|
||||
#error Must run on unix or windows, please define UNX or WNT.
|
||||
#endif
|
||||
|
||||
// gathering from subdirectories:
|
||||
List<Simstr> aSubDirectories;
|
||||
GatherSubDirectories( aSubDirectories, i_sSrcDirectory );
|
||||
|
||||
unsigned d_max = aSubDirectories.size();
|
||||
for ( unsigned d = 0; d < d_max; ++d )
|
||||
{
|
||||
sNextDir = new char[ strlen(i_sSrcDirectory) + 2 + aSubDirectories[d].l() ];
|
||||
|
||||
strcpy(sNextDir, i_sSrcDirectory);
|
||||
strcat(sNextDir, C_sSLASH);
|
||||
strcat(sNextDir, aSubDirectories[d].str());
|
||||
GatherFileNames(o_sFiles, sNextDir);
|
||||
|
||||
delete [] sNextDir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char * C_sANYDIR = "\\*.*";
|
||||
|
||||
void
|
||||
GatherSubDirectories( List<Simstr> & o_sSubDirectories,
|
||||
const char * i_sParentdDirectory )
|
||||
{
|
||||
Simstr sNew;
|
||||
|
||||
#ifdef WNT
|
||||
struct _finddata_t aEntry;
|
||||
long hFile = 0;
|
||||
int bFindMore = 0;
|
||||
char * sFilter = new char[strlen(i_sParentdDirectory) + sizeof C_sANYDIR];
|
||||
|
||||
strcpy(sFilter, i_sParentdDirectory);
|
||||
strcat(sFilter,C_sANYDIR);
|
||||
|
||||
hFile = _findfirst( sFilter, &aEntry );
|
||||
for ( bFindMore = hFile == -1;
|
||||
bFindMore == 0;
|
||||
bFindMore = _findnext( hFile, &aEntry ) )
|
||||
{
|
||||
if (aEntry.attrib == _A_SUBDIR)
|
||||
{
|
||||
// Do not gather . .. and outputtree directories
|
||||
if ( strchr(aEntry.name,'.') == 0
|
||||
&& strncmp(aEntry.name, "wnt", 3) != 0
|
||||
&& strncmp(aEntry.name, "unx", 3) != 0 )
|
||||
{
|
||||
sNew = aEntry.name;
|
||||
o_sSubDirectories.push_back(sNew);
|
||||
}
|
||||
} // endif (aEntry.attrib == _A_SUBDIR)
|
||||
} // end for
|
||||
_findclose(hFile);
|
||||
delete [] sFilter;
|
||||
|
||||
#elif defined(UNX)
|
||||
DIR * pDir = opendir( i_sParentdDirectory );
|
||||
dirent * pEntry = 0;
|
||||
struct stat aEntryStatus;
|
||||
char * sEnding;
|
||||
|
||||
while ( ( pEntry = readdir(pDir) ) != 0 )
|
||||
{
|
||||
stat(pEntry->d_name, &aEntryStatus);
|
||||
if ( ( aEntryStatus.st_mode & S_IFDIR ) == S_IFDIR )
|
||||
{
|
||||
// Do not gather . .. and outputtree directories
|
||||
if ( strchr(pEntry->d_name,'.') == 0
|
||||
&& strncmp(pEntry->d_name, "wnt", 3) != 0
|
||||
&& strncmp(pEntry->d_name, "unx", 3) != 0 )
|
||||
{
|
||||
sNew = pEntry->d_name;
|
||||
o_sSubDirectories.push_back(sNew);
|
||||
}
|
||||
} // endif (aEntry.attrib == _A_SUBDIR)
|
||||
} // end while
|
||||
closedir( pDir );
|
||||
#else
|
||||
#error Must run on unix or windows, please define UNX or WNT.
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
Create_TypeInfoFile( const char * o_sOutputFile,
|
||||
@@ -344,39 +196,25 @@ Create_TypeInfoFile( const char * o_sOutputFile,
|
||||
);
|
||||
if ( !aOut )
|
||||
{
|
||||
cerr << "Error: " << o_sOutputFile << " could not be created." << std::endl;
|
||||
cerr << "Error: " << o_sOutputFile << " could not be created." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Heap aTypesHeap(12);
|
||||
Simstr sLibPrefix = i_rData.Children()[0]->Data();
|
||||
Simstr sLibPrefix = i_rData.ModuleName();
|
||||
|
||||
// Gather types:
|
||||
const ModuleDescription::CD_List & rListDescriptions = i_rData.Components();
|
||||
List< const MultipleTextElement * > aTypes;
|
||||
i_rData.Get_Types(aTypes);
|
||||
|
||||
// Descriptions:
|
||||
for ( unsigned nDescrIter = 0; nDescrIter < rListDescriptions.size(); ++nDescrIter )
|
||||
for ( unsigned t = 0; t < aTypes.size(); ++t )
|
||||
{
|
||||
// Find Type-Tag:
|
||||
TextElement * pTypes = 0;
|
||||
ComponentDescription::ChildList & rTags = rListDescriptions[nDescrIter]->Children();
|
||||
for ( unsigned nTagIter = 0; nTagIter < rTags.size(); ++nTagIter )
|
||||
unsigned i_max = aTypes[t]->Size();
|
||||
for ( unsigned i = 0; i < i_max; ++i )
|
||||
{
|
||||
if ( strcmp( rTags[nTagIter]->Name(),"type") == 0 )
|
||||
{
|
||||
pTypes = rTags[nTagIter];
|
||||
break;
|
||||
}
|
||||
} // end for (aTagIter)
|
||||
|
||||
if ( pTypes != 0)
|
||||
{
|
||||
for ( unsigned nTypeIter = 0; nTypeIter < pTypes->Size(); ++nTypeIter )
|
||||
{ // Loop Services
|
||||
aTypesHeap.InsertValue( pTypes->Data(nTypeIter), "" );
|
||||
} // end for aDataIter
|
||||
}
|
||||
} // end for (aDescrIter)
|
||||
aTypesHeap.InsertValue( aTypes[t]->Data(i), "" );
|
||||
} // end for
|
||||
}
|
||||
|
||||
// Write types:
|
||||
WriteStr( aOut, sLibPrefix );
|
||||
|
@@ -2,9 +2,9 @@
|
||||
#
|
||||
# $RCSfile: makefile.mk,v $
|
||||
#
|
||||
# $Revision: 1.2 $
|
||||
# $Revision: 1.3 $
|
||||
#
|
||||
# last change: $Author: np $ $Date: 2001-03-12 19:24:52 $
|
||||
# last change: $Author: np $ $Date: 2001-03-23 13:24:04 $
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# either of the following licenses
|
||||
@@ -76,13 +76,26 @@ TARGETTYPE=CUI
|
||||
|
||||
# --- Files --------------------------------------------------------
|
||||
|
||||
OBJFILES= \
|
||||
LIB1TARGET=$(LB)$/$(TARGET).lib
|
||||
LIB1OBJFILES=\
|
||||
$(OBJ)$/main.obj \
|
||||
$(OBJ)$/cr_html.obj \
|
||||
$(OBJ)$/cr_index.obj \
|
||||
$(OBJ)$/cr_metho.obj \
|
||||
$(OBJ)$/filebuff.obj \
|
||||
$(OBJ)$/parse.obj \
|
||||
$(OBJ)$/xmlelem.obj \
|
||||
$(OBJ)$/xmltree.obj
|
||||
|
||||
|
||||
LIB2TARGET=$(LB)$/$(TARGET)l.lib
|
||||
LIB2OBJFILES=\
|
||||
$(OBJ)$/cr_html.obj \
|
||||
$(OBJ)$/cr_index.obj \
|
||||
$(OBJ)$/cr_metho.obj \
|
||||
$(OBJ)$/filebuff.obj \
|
||||
$(OBJ)$/parse.obj \
|
||||
$(OBJ)$/xmlelem.obj \
|
||||
$(OBJ)$/xmltree.obj
|
||||
|
||||
|
||||
@@ -90,6 +103,7 @@ OBJFILES= \
|
||||
|
||||
# --- Targets ------------------------------------------------------
|
||||
|
||||
|
||||
.INCLUDE : target.mk
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* $RCSfile: parse.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $Date: $
|
||||
*
|
||||
@@ -64,45 +64,31 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <xmltree.hxx>
|
||||
#include <xmlelem.hxx>
|
||||
|
||||
#ifdef UNX
|
||||
#define strnicmp strncasecmp
|
||||
#endif
|
||||
|
||||
|
||||
using std::cerr;
|
||||
using namespace std;
|
||||
|
||||
|
||||
// NOT FULLY DEFINED SERVICES
|
||||
|
||||
char C_sMODULEDESCRIPTION[] = "module-description";
|
||||
char C_sCOMPONENTDESCRIPTION[] = "component-description";
|
||||
char C_sAuthor[] = "author";
|
||||
char C_sName[] = "name";
|
||||
char C_sDescription[] = "description";
|
||||
char C_sReferenceDocu[] = "reference-docu";
|
||||
char C_sModuleName[] = "module-name";
|
||||
char C_sLoaderName[] = "loader-name";
|
||||
char C_sSupportedService[] = "supported-service";
|
||||
char C_sServiceDependency[] = "service-dependency";
|
||||
char C_sProjectBuildDependency[] = "project-build-dependency";
|
||||
char C_sRuntimeModuleDependency[] = "runtime-module-dependency";
|
||||
char C_sLanguage[] = "language";
|
||||
char C_sStatus[] = "status";
|
||||
char C_sType[] = "type";
|
||||
|
||||
|
||||
|
||||
#define AssertionOf(x) \
|
||||
{if (!(x)) {cerr << "Assertion failed: " << #x << __FILE__ << __LINE__ << std::endl; exit(3); }}
|
||||
#define SyntaxAssertion(x,file) \
|
||||
{if (!(x)) {cerr << "Syntax error in file: " << #file << std::endl; exit(3); }}
|
||||
|
||||
|
||||
|
||||
X2CParser::X2CParser( ModuleDescription & o_rData )
|
||||
: pData(&o_rData)
|
||||
X2CParser::X2CParser( XmlElement & o_rDocumentData )
|
||||
: // sFileName,
|
||||
nFileLine(0),
|
||||
pDocumentData(&o_rDocumentData),
|
||||
// sWord,
|
||||
text(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -110,9 +96,13 @@ X2CParser::~X2CParser()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
X2CParser::Parse( const char * i_sFilename )
|
||||
X2CParser::LoadFile( const char * i_sFilename )
|
||||
{
|
||||
sFileName = i_sFilename;
|
||||
nFileLine = 1;
|
||||
|
||||
// Load file:
|
||||
if ( ! LoadXmlFile( aFile, i_sFilename ) )
|
||||
return false;
|
||||
@@ -121,20 +111,33 @@ X2CParser::Parse( const char * i_sFilename )
|
||||
const char * pLastTag = strrchr(aFile.operator const char *(),'<');
|
||||
if (pLastTag == 0)
|
||||
return false;
|
||||
if ( strnicmp(pLastTag+2, C_sMODULEDESCRIPTION, strlen(C_sMODULEDESCRIPTION)) != 0
|
||||
if ( strnicmp(pLastTag+2, pDocumentData->Name().str(), pDocumentData->Name().l()) != 0
|
||||
|| strnicmp(pLastTag, "</", 2) != 0 )
|
||||
return false;
|
||||
if (strchr(pLastTag,'>') == 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse()
|
||||
{
|
||||
// Parse:
|
||||
text = aFile.operator const char *();
|
||||
|
||||
Parse_XmlDeclaration();
|
||||
Parse_Doctype();
|
||||
Parse_ModuleDescription();
|
||||
|
||||
return true;
|
||||
pDocumentData->Parse(*this);
|
||||
}
|
||||
|
||||
bool
|
||||
X2CParser::Parse( const char * i_sFilename )
|
||||
{
|
||||
bool ret = LoadFile(i_sFilename);
|
||||
if (ret)
|
||||
Parse();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -156,176 +159,149 @@ X2CParser::Parse_Doctype()
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse_ModuleDescription()
|
||||
X2CParser::Parse_Sequence( DynamicList<XmlElement> & o_rElements,
|
||||
const Simstr & i_sElementName )
|
||||
{
|
||||
Goto('<');
|
||||
AssertionOf( IsBeginTag(C_sMODULEDESCRIPTION) );
|
||||
Goto_And_Pass('>');
|
||||
CheckAndPassBeginTag(i_sElementName.str());
|
||||
|
||||
Parse_TextElement(C_sModuleName,*pData, true, false);
|
||||
|
||||
for ( Goto('<');
|
||||
IsBeginTag(C_sCOMPONENTDESCRIPTION);
|
||||
Goto('<') )
|
||||
unsigned int i_max = o_rElements.size();
|
||||
for (unsigned i = 0; i < i_max; ++i)
|
||||
{
|
||||
Parse_ComponentDescription(*pData);
|
||||
}
|
||||
o_rElements[i]->Parse(*this);
|
||||
} // end for
|
||||
|
||||
for ( ; ! IsEndTag(C_sMODULEDESCRIPTION); Goto('<') )
|
||||
{
|
||||
if ( IsBeginTag(C_sProjectBuildDependency) )
|
||||
Parse_TextElement(C_sProjectBuildDependency,*pData,false,false);
|
||||
else if ( IsBeginTag(C_sRuntimeModuleDependency) )
|
||||
Parse_TextElement(C_sRuntimeModuleDependency,*pData,false,false);
|
||||
}
|
||||
Goto_And_Pass('>');
|
||||
CheckAndPassEndTag(i_sElementName.str());
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse_ComponentDescription(ModuleDescription & o_rParent)
|
||||
X2CParser::Parse_FreeChoice( DynamicList<XmlElement> & o_rElements )
|
||||
{
|
||||
Goto('<');
|
||||
AssertionOf( IsBeginTag(C_sCOMPONENTDESCRIPTION) );
|
||||
Goto_And_Pass('>');
|
||||
unsigned nSize = o_rElements.size();
|
||||
|
||||
ComponentDescription * dpCD = new ComponentDescription;
|
||||
o_rParent.AddComponentDescription(*dpCD);
|
||||
|
||||
Parse_TextElement(C_sAuthor,*dpCD,true,false);
|
||||
Parse_TextElement(C_sName,*dpCD,true,true);
|
||||
Parse_TextElement(C_sDescription,*dpCD,true,false);
|
||||
Parse_TextElement(C_sLoaderName,*dpCD,true,true);
|
||||
Parse_TextElement(C_sLanguage,*dpCD,true,false);
|
||||
Parse_Status(*dpCD);
|
||||
for ( Goto('<');
|
||||
IsBeginTag(C_sSupportedService);
|
||||
Goto('<') )
|
||||
for ( bool bBreak = false; !bBreak; )
|
||||
{
|
||||
Parse_TextElement(C_sSupportedService,*dpCD,false,true);
|
||||
}
|
||||
|
||||
for ( Goto('<');
|
||||
! IsEndTag(C_sCOMPONENTDESCRIPTION);
|
||||
Goto('<') )
|
||||
{
|
||||
if ( IsBeginTag(C_sReferenceDocu) )
|
||||
bBreak = true;
|
||||
for ( unsigned i = 0; i < nSize; ++i )
|
||||
{
|
||||
ReferenceDocuElement * pNewElem = new ReferenceDocuElement;
|
||||
Parse_ReferenceDocu(*pNewElem);
|
||||
dpCD->DocuRefs().push_back(pNewElem);
|
||||
}
|
||||
else if ( IsBeginTag(C_sServiceDependency) )
|
||||
Parse_TextElement(C_sServiceDependency,*dpCD,false,true);
|
||||
else if ( IsBeginTag(C_sType) )
|
||||
Parse_TextElement(C_sType,*dpCD,false,true);
|
||||
}
|
||||
Goto_And_Pass('>');
|
||||
|
||||
// Take Name to front:
|
||||
ParentElement::ChildList & rDescrElements = dpCD->Children();
|
||||
TextElement * pTE = rDescrElements[0];
|
||||
rDescrElements[0] = rDescrElements[1];
|
||||
rDescrElements[1] = pTE;
|
||||
Goto('<');
|
||||
if ( IsBeginTag(o_rElements[i]->Name().str()) )
|
||||
{
|
||||
o_rElements[i]->Parse(*this);
|
||||
bBreak = false;
|
||||
break;
|
||||
}
|
||||
} // end for i
|
||||
} // end for !bBreak
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse_ReferenceDocu(ReferenceDocuElement & o_rElement)
|
||||
X2CParser::Parse_List( ListElement & o_rListElem )
|
||||
{
|
||||
Move( strlen(C_sReferenceDocu) + 1 );
|
||||
|
||||
for ( Goto('<'); IsBeginTag(o_rListElem.Name().str()); Goto('<') )
|
||||
{
|
||||
XmlElement * pNew = o_rListElem.Create_and_Add_NewElement();
|
||||
pNew->Parse(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse_Text( Simstr & o_sText,
|
||||
const Simstr & i_sElementName,
|
||||
bool i_bReverseName )
|
||||
{
|
||||
CheckAndPassBeginTag(i_sElementName.str());
|
||||
|
||||
// Add new Element
|
||||
GetTextTill( o_sText, '<', i_bReverseName );
|
||||
o_sText.remove_trailing_blanks();
|
||||
|
||||
CheckAndPassEndTag(i_sElementName.str());
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse_MultipleText( List<Simstr> & o_rTexts,
|
||||
const Simstr & i_sElementName,
|
||||
bool i_bReverseName )
|
||||
{
|
||||
for ( Goto('<'); IsBeginTag(i_sElementName.str()); Goto('<') )
|
||||
{
|
||||
o_rTexts.push_back(Simstr());
|
||||
Parse_Text(o_rTexts.back(), i_sElementName, i_bReverseName);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse_SglAttr( Simstr & o_sAttrValue,
|
||||
const Simstr & i_sElementName,
|
||||
const Simstr & i_sAttrName )
|
||||
{
|
||||
Goto('<');
|
||||
if ( !IsBeginTag(i_sElementName.str()) )
|
||||
SyntaxError("unexpected element");
|
||||
Move( i_sElementName.l() + 1 );
|
||||
|
||||
Pass_White();
|
||||
if (*text == '>')
|
||||
SyntaxError("no attribute found, where one was expected");
|
||||
Simstr sAttrName;
|
||||
Get_Attribute(o_sAttrValue, sAttrName);
|
||||
if (sAttrName != i_sAttrName)
|
||||
SyntaxError("unknown attribute found");
|
||||
Pass_White();
|
||||
if (strncmp(text,"/>",2) != 0)
|
||||
SyntaxError("missing \"/>\" at end of empty element");
|
||||
Move(2);
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse_MultipleAttr( List<Simstr> & o_rAttrValues,
|
||||
const Simstr & i_sElementName,
|
||||
const List<Simstr> & i_rAttrNames )
|
||||
{
|
||||
Goto('<');
|
||||
if ( !IsBeginTag(i_sElementName.str()) )
|
||||
SyntaxError("unexpected element");
|
||||
Move( i_sElementName.l() + 1 );
|
||||
Simstr sAttrName;
|
||||
Simstr sAttrValue;
|
||||
unsigned nSize = i_rAttrNames.size();
|
||||
|
||||
for ( Pass_White(); *text != '/'; Pass_White() )
|
||||
{
|
||||
Get_ReferenceDocuAttribute(o_rElement);
|
||||
}
|
||||
Move(1);
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse_TextElement( const char * i_sElementName,
|
||||
ParentElement & o_rParent,
|
||||
bool i_bSingle,
|
||||
bool i_bReverseName )
|
||||
{
|
||||
Goto('<');
|
||||
text++;
|
||||
AssertionOf( IsText(i_sElementName) );
|
||||
Goto_And_Pass('>');
|
||||
Pass_White();
|
||||
Get_Attribute(sAttrValue, sAttrName);
|
||||
|
||||
TextElement * pNew = 0;
|
||||
|
||||
if ( !i_bSingle && o_rParent.Children().size() > 0 )
|
||||
{
|
||||
if ( strcmp( o_rParent.Children().back()->Name(),
|
||||
i_sElementName ) == 0 )
|
||||
for ( unsigned i = 0; i < nSize; ++i )
|
||||
{
|
||||
pNew = o_rParent.Children().back();
|
||||
if ( i_rAttrNames[i] == sAttrName )
|
||||
{
|
||||
o_rAttrValues[i] = sAttrValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == nSize)
|
||||
SyntaxError("unknown attribute found");
|
||||
}
|
||||
if (pNew == 0)
|
||||
{
|
||||
pNew = i_bSingle
|
||||
? (TextElement*) new SglTextElement(i_sElementName)
|
||||
: (TextElement*) new MultipleTextElement(i_sElementName);
|
||||
o_rParent.AddChild(*pNew);
|
||||
}
|
||||
|
||||
// Add new Element
|
||||
Simstr sText;
|
||||
GetTextTill( sText, '<', i_bReverseName );
|
||||
sText.remove_trailing_blanks();
|
||||
pNew->SetText(sText);
|
||||
|
||||
AssertionOf( IsText("</") );
|
||||
Move(2);
|
||||
AssertionOf( IsText(i_sElementName) );
|
||||
Goto_And_Pass('>');
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Parse_Status( ComponentDescription & o_rParent )
|
||||
{
|
||||
Goto('<');
|
||||
AssertionOf( IsBeginTag(C_sStatus) );
|
||||
Move( strlen(C_sStatus) + 1 );
|
||||
|
||||
Pass_White();
|
||||
AssertionOf(*text != '>');
|
||||
Simstr sAttrName;
|
||||
Simstr sAttrValue = Get_Attribute(sAttrName);
|
||||
o_rParent.SetStatus(sAttrValue);
|
||||
|
||||
Move(2);
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::Get_ReferenceDocuAttribute( ReferenceDocuElement & o_rElement )
|
||||
{
|
||||
Simstr sAttrName;
|
||||
Simstr sAttrValue = Get_Attribute(sAttrName);
|
||||
if ( strcmp( sAttrName.str(), "xlink:href") == 0 )
|
||||
o_rElement.sAttr_href = sAttrValue;
|
||||
else if ( strcmp( sAttrName.str(), "xlink:role") == 0 )
|
||||
o_rElement.sAttr_role = sAttrValue;
|
||||
else if ( strcmp( sAttrName.str(), "xlink:title") == 0 )
|
||||
o_rElement.sAttr_title = sAttrValue;
|
||||
}
|
||||
|
||||
Simstr
|
||||
X2CParser::Get_Attribute( Simstr & o_rAttrName )
|
||||
void
|
||||
X2CParser::Get_Attribute( Simstr & o_rAttrValue,
|
||||
Simstr & o_rAttrName )
|
||||
{
|
||||
GetTextTill( o_rAttrName, '=');
|
||||
|
||||
while (*(++text) != '"')
|
||||
{
|
||||
AssertionOf(*text != '\0');
|
||||
if (*text == '\0')
|
||||
SyntaxError("unexpected end of file");
|
||||
}
|
||||
|
||||
++text;
|
||||
Simstr ret;
|
||||
GetTextTill( ret, '"');
|
||||
GetTextTill( o_rAttrValue, '"');
|
||||
++text;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -353,8 +329,8 @@ X2CParser::Goto( char i_cNext )
|
||||
{
|
||||
while (*text != i_cNext)
|
||||
{
|
||||
TestCurChar();
|
||||
++text;
|
||||
AssertionOf(*text != '\0');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,8 +352,8 @@ X2CParser::Pass_White()
|
||||
{
|
||||
while (*text <= 32)
|
||||
{
|
||||
TestCurChar();
|
||||
++text;
|
||||
AssertionOf(*text != '\0');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +368,7 @@ X2CParser::GetTextTill( Simstr & o_rText,
|
||||
*text != i_cEnd;
|
||||
++text )
|
||||
{
|
||||
AssertionOf(*text !='\0');
|
||||
TestCurChar();
|
||||
*pSet++ = *text;
|
||||
}
|
||||
|
||||
@@ -426,4 +402,50 @@ X2CParser::GetTextTill( Simstr & o_rText,
|
||||
o_rText = &sWord[0];
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::CheckAndPassBeginTag( const char * i_sElementName )
|
||||
{
|
||||
Goto('<');
|
||||
if ( ! IsBeginTag(i_sElementName) )
|
||||
SyntaxError( "unexpected element");
|
||||
Goto_And_Pass('>');
|
||||
Pass_White();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::CheckAndPassEndTag( const char * i_sElementName )
|
||||
{
|
||||
Pass_White();
|
||||
if ( !IsEndTag(i_sElementName) )
|
||||
SyntaxError("missing or not matching end tag");
|
||||
Goto_And_Pass('>');
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::SyntaxError( const char * i_sText )
|
||||
{
|
||||
cerr << "Syntax error "
|
||||
<< i_sText
|
||||
<< " in file: "
|
||||
<< sFileName.str()
|
||||
<< " in line "
|
||||
<< nFileLine
|
||||
<< "."
|
||||
<< endl;
|
||||
|
||||
exit(3);
|
||||
}
|
||||
|
||||
void
|
||||
X2CParser::TestCurChar()
|
||||
{
|
||||
// if (*text == '\0')
|
||||
// SyntaxError("unexpected end of file");
|
||||
// else
|
||||
|
||||
if (*text == '\n')
|
||||
nFileLine++;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* $RCSfile: parse.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $Date: $
|
||||
*
|
||||
@@ -69,46 +69,64 @@
|
||||
// COMPONENTS
|
||||
#include "filebuff.hxx"
|
||||
#include "../support/sistr.hxx"
|
||||
#include "../support/list.hxx"
|
||||
// PARAMETERS
|
||||
|
||||
|
||||
class ModuleDescription;
|
||||
class ParentElement;
|
||||
class ComponentDescription;
|
||||
class ReferenceDocuElement;
|
||||
class XmlElement;
|
||||
class ListElement;
|
||||
|
||||
class X2CParser
|
||||
{
|
||||
public:
|
||||
typedef XmlElement * (*F_CREATE)(const Simstr &);
|
||||
|
||||
X2CParser(
|
||||
ModuleDescription & o_rData );
|
||||
XmlElement & o_rDocumentData );
|
||||
~X2CParser();
|
||||
|
||||
bool Parse(
|
||||
bool LoadFile(
|
||||
const char * i_sFilename );
|
||||
void Parse();
|
||||
bool Parse(
|
||||
const char * i_sFilename );
|
||||
|
||||
|
||||
const char * PureText() const { return aFile.operator const char*(); }
|
||||
|
||||
void Parse_Sequence(
|
||||
DynamicList<XmlElement> &
|
||||
o_rElements,
|
||||
const Simstr & i_sElementName );
|
||||
void Parse_FreeChoice(
|
||||
DynamicList<XmlElement> &
|
||||
o_rElements );
|
||||
void Parse_List(
|
||||
ListElement & o_rListElem );
|
||||
void Parse_Text(
|
||||
Simstr & o_sText,
|
||||
const Simstr & i_sElementName,
|
||||
bool i_bReverseName );
|
||||
void Parse_MultipleText(
|
||||
List<Simstr> & o_rTexts,
|
||||
const Simstr & i_sElementName,
|
||||
bool i_bReverseName );
|
||||
void Parse_SglAttr(
|
||||
Simstr & o_sAttrValue,
|
||||
const Simstr & i_sElementName,
|
||||
const Simstr & i_sAttrName );
|
||||
void Parse_MultipleAttr(
|
||||
List<Simstr> & o_rAttrValues,
|
||||
const Simstr & i_sElementName,
|
||||
const List<Simstr> &
|
||||
i_rAttrNames );
|
||||
|
||||
private:
|
||||
void Parse_XmlDeclaration();
|
||||
void Parse_Doctype();
|
||||
void Parse_ModuleDescription();
|
||||
void Parse_ComponentDescription(
|
||||
ModuleDescription & o_rParent );
|
||||
void Parse_ReferenceDocu(
|
||||
ReferenceDocuElement &
|
||||
o_rElement );
|
||||
void Parse_TextElement(
|
||||
const char * i_sElementName,
|
||||
ParentElement & o_rParent,
|
||||
bool i_bSingle,
|
||||
bool i_bReverseName );
|
||||
void Parse_Status(
|
||||
ComponentDescription &
|
||||
o_rParent );
|
||||
void Get_ReferenceDocuAttribute(
|
||||
ReferenceDocuElement &
|
||||
o_rElement );
|
||||
Simstr Get_Attribute(
|
||||
|
||||
void Get_Attribute(
|
||||
Simstr & o_rAttrValue,
|
||||
Simstr & o_rAttrName );
|
||||
bool IsText(
|
||||
const char * i_sComparedText );
|
||||
@@ -127,10 +145,22 @@ class X2CParser
|
||||
Simstr & o_rText,
|
||||
char i_cEnd,
|
||||
bool i_bReverseName = false );
|
||||
void CheckAndPassBeginTag(
|
||||
const char * i_sElementName );
|
||||
void CheckAndPassEndTag(
|
||||
const char * i_sElementName );
|
||||
|
||||
|
||||
void SyntaxError(
|
||||
const char * i_sText );
|
||||
void TestCurChar();
|
||||
|
||||
// DATA
|
||||
Simstr sFileName;
|
||||
unsigned nFileLine;
|
||||
|
||||
Buffer aFile;
|
||||
ModuleDescription * pData;
|
||||
XmlElement * pDocumentData;
|
||||
|
||||
char sWord[8192];
|
||||
const char * text;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* $RCSfile: xmltree.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $Date: $
|
||||
*
|
||||
@@ -64,86 +64,257 @@
|
||||
|
||||
|
||||
// NOT FULLY DEFINED SERVICES
|
||||
#include <cr_html.hxx>
|
||||
#include <cr_index.hxx>
|
||||
|
||||
|
||||
void
|
||||
ParentElement::AddChild( TextElement & let_drElement )
|
||||
char C_sMODULEDESCRIPTION[] = "module-description";
|
||||
char C_sCOMPONENTDESCRIPTION[] = "component-description";
|
||||
char C_sAuthor[] = "author";
|
||||
char C_sName[] = "name";
|
||||
char C_sDescription[] = "description";
|
||||
char C_sReferenceDocu[] = "reference-docu";
|
||||
char C_sModuleName[] = "module-name";
|
||||
char C_sLoaderName[] = "loader-name";
|
||||
char C_sSupportedService[] = "supported-service";
|
||||
char C_sServiceDependency[] = "service-dependency";
|
||||
char C_sProjectBuildDependency[] = "project-build-dependency";
|
||||
char C_sRuntimeModuleDependency[] = "runtime-module-dependency";
|
||||
char C_sLanguage[] = "language";
|
||||
char C_sStatus[] = "status";
|
||||
char C_sType[] = "type";
|
||||
char C_sAttr_value[] = "value";
|
||||
char C_sAttr_xl_href[] = "xlink:href";
|
||||
char C_sAttr_xl_role[] = "xlink:role";
|
||||
char C_sAttr_xl_title[] = "xlink:title";
|
||||
char C_sAttr_xmlns[] = "xmlns:xlink";
|
||||
char C_sAttr_xl_type[] = "xlink:type";
|
||||
char C_sCompDescrListTitle[] = "Component Descriptions";
|
||||
|
||||
|
||||
FreeChoiceElement * Create_ModuleDescrOptional_Element(
|
||||
MultipleTextElement * &
|
||||
o_rTypes,
|
||||
MultipleTextElement * &
|
||||
o_rServiceDependencies );
|
||||
FreeChoiceElement * Create_CompDescrOptional_Element(
|
||||
MultipleTextElement * &
|
||||
o_rTypes,
|
||||
MultipleTextElement * &
|
||||
o_rServiceDependencies );
|
||||
|
||||
|
||||
|
||||
ModuleDescription::ModuleDescription()
|
||||
: SequenceElement(C_sMODULEDESCRIPTION),
|
||||
pModuleName(0),
|
||||
pCdList(0),
|
||||
pTypes(0),
|
||||
pServiceDependencies(0)
|
||||
{
|
||||
aChildren.push_back(&let_drElement);
|
||||
pModuleName = new MdName;
|
||||
AddChild( *pModuleName );
|
||||
pCdList = new CompDescrList;
|
||||
AddChild( *pCdList );
|
||||
AddChild( *Create_ModuleDescrOptional_Element( pTypes, pServiceDependencies ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ModuleDescription::AddComponentDescription( ComponentDescription & let_drCD )
|
||||
const Simstr &
|
||||
ModuleDescription::ModuleName() const
|
||||
{
|
||||
aCDs.push_back(&let_drCD);
|
||||
return pModuleName->Data();
|
||||
}
|
||||
|
||||
void
|
||||
ComponentDescription::SetStatus( const char * i_sText )
|
||||
ModuleDescription::Get_SupportedServices( List< const MultipleTextElement * > & o_rServices ) const
|
||||
{
|
||||
sStatus = i_sText;
|
||||
o_rServices.push_back(pServiceDependencies);
|
||||
pCdList->Get_SupportedServices( o_rServices );
|
||||
}
|
||||
|
||||
SglTextElement::SglTextElement( const char * i_sName )
|
||||
: sName(i_sName)
|
||||
void
|
||||
ModuleDescription::Get_Types( List< const MultipleTextElement * > & o_rTypes ) const
|
||||
{
|
||||
o_rTypes.push_back(pTypes);
|
||||
pCdList->Get_Types( o_rTypes );
|
||||
}
|
||||
|
||||
void
|
||||
ModuleDescription::Get_ServiceDependencies( List< const MultipleTextElement * > & o_rServices ) const
|
||||
{
|
||||
pCdList->Get_ServiceDependencies( o_rServices );
|
||||
}
|
||||
|
||||
ComponentDescription::ComponentDescription()
|
||||
: SequenceElement(C_sCOMPONENTDESCRIPTION,1),
|
||||
pComponentName(0),
|
||||
pSupportedServices(0),
|
||||
pTypes(0),
|
||||
pServiceDependencies(0)
|
||||
{
|
||||
AddChild( *new SglTextElement(C_sAuthor, lt_nolink, false) );
|
||||
pComponentName = new CdName;
|
||||
AddChild( *pComponentName );
|
||||
AddChild( *new SglTextElement(C_sDescription, lt_nolink, false) );
|
||||
AddChild( *new SglTextElement(C_sLoaderName, lt_idl, true) );
|
||||
AddChild( *new SglTextElement(C_sLanguage, lt_nolink, false) );
|
||||
AddChild( *new SglAttrElement(C_sStatus, C_sAttr_value) );
|
||||
pSupportedServices = new SupportedService;
|
||||
AddChild( *pSupportedServices );
|
||||
AddChild( *Create_CompDescrOptional_Element( pTypes, pServiceDependencies ) );
|
||||
}
|
||||
|
||||
CompDescrList::CompDescrList()
|
||||
: ListElement(C_sCOMPONENTDESCRIPTION, 0)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SglTextElement::SetText( const char * i_sText )
|
||||
CompDescrList::Write2Html( HtmlCreator & io_rHC ) const
|
||||
{
|
||||
sContent = i_sText;
|
||||
io_rHC.StartBigCell(C_sCompDescrListTitle);
|
||||
ListElement::Write2Html(io_rHC);
|
||||
io_rHC.FinishBigCell();
|
||||
}
|
||||
|
||||
const char *
|
||||
SglTextElement::Name() const
|
||||
XmlElement *
|
||||
CompDescrList::Create_and_Add_NewElement()
|
||||
{
|
||||
return sName;
|
||||
ComponentDescription * pCD = new ComponentDescription;
|
||||
Children().push_back(pCD);
|
||||
aCDs.push_back(pCD);
|
||||
return pCD;
|
||||
}
|
||||
|
||||
const char *
|
||||
SglTextElement::Data( unsigned i_nNr ) const
|
||||
void
|
||||
CompDescrList::Get_SupportedServices( List< const MultipleTextElement * > & o_rResult ) const
|
||||
{
|
||||
return sContent.str();
|
||||
unsigned i_max = aCDs.size();;
|
||||
for (unsigned i = 0; i < i_max; ++i)
|
||||
{
|
||||
o_rResult.push_back(& aCDs[i]->SupportedServices());
|
||||
} // end for
|
||||
}
|
||||
|
||||
unsigned
|
||||
SglTextElement::Size() const
|
||||
void
|
||||
CompDescrList::Get_Types( List< const MultipleTextElement * > & o_rResult ) const
|
||||
{
|
||||
return 1;
|
||||
unsigned i_max = aCDs.size();;
|
||||
for (unsigned i = 0; i < i_max; ++i)
|
||||
{
|
||||
o_rResult.push_back(& aCDs[i]->Types());
|
||||
} // end for
|
||||
}
|
||||
|
||||
void
|
||||
CompDescrList::Get_ServiceDependencies( List< const MultipleTextElement * > & o_rResult ) const
|
||||
{
|
||||
unsigned i_max = aCDs.size();;
|
||||
for (unsigned i = 0; i < i_max; ++i)
|
||||
{
|
||||
o_rResult.push_back(& aCDs[i]->ServiceDependencies());
|
||||
} // end for
|
||||
}
|
||||
|
||||
MultipleTextElement::MultipleTextElement( const char * i_sName )
|
||||
: sName(i_sName)
|
||||
MdName::MdName()
|
||||
: SglTextElement(C_sModuleName, lt_html, false)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
MultipleTextElement::SetText( const char * i_sText )
|
||||
MdName::Write2Html( HtmlCreator & io_rHC ) const
|
||||
{
|
||||
aContent.push_back(i_sText);
|
||||
io_rHC.Write_SglTextElement( *this, true );
|
||||
}
|
||||
|
||||
const char *
|
||||
MultipleTextElement::Name() const
|
||||
CdName::CdName()
|
||||
: SglTextElement(C_sName, lt_html, true)
|
||||
{
|
||||
return sName;
|
||||
}
|
||||
|
||||
const char *
|
||||
MultipleTextElement::Data( unsigned i_nNr ) const
|
||||
void
|
||||
CdName::Write2Html( HtmlCreator & io_rHC ) const
|
||||
{
|
||||
if (i_nNr < aContent.size())
|
||||
return aContent[i_nNr].str();
|
||||
else
|
||||
return "";
|
||||
io_rHC.Write_SglTextElement( *this, true );
|
||||
}
|
||||
|
||||
unsigned
|
||||
MultipleTextElement::Size() const
|
||||
SupportedService::SupportedService()
|
||||
: MultipleTextElement(C_sSupportedService, lt_idl, true)
|
||||
{
|
||||
return aContent.size();
|
||||
}
|
||||
|
||||
void
|
||||
SupportedService::Insert2Index( Index & o_rIndex ) const
|
||||
{
|
||||
for ( unsigned i = 0; i < Size(); ++i )
|
||||
{
|
||||
o_rIndex.InsertSupportedService( Data(i) );
|
||||
}
|
||||
}
|
||||
|
||||
FreeChoiceElement *
|
||||
Create_ModuleDescrOptional_Element( MultipleTextElement * & o_rTypes,
|
||||
MultipleTextElement * & o_rServiceDependencies )
|
||||
{
|
||||
FreeChoiceElement * ret = Create_CompDescrOptional_Element( o_rTypes, o_rServiceDependencies );
|
||||
|
||||
ret->AddChild( *new MultipleTextElement(C_sProjectBuildDependency, lt_nolink, false) );
|
||||
ret->AddChild( *new MultipleTextElement(C_sRuntimeModuleDependency, lt_nolink, false) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
FreeChoiceElement *
|
||||
Create_CompDescrOptional_Element( MultipleTextElement * & o_rTypes,
|
||||
MultipleTextElement * & o_rServiceDependencies )
|
||||
{
|
||||
FreeChoiceElement * ret = new FreeChoiceElement;
|
||||
const unsigned C_sRefDocuAttrNumber = 5;
|
||||
static const char * C_sRefDocuAttrNames[C_sRefDocuAttrNumber]
|
||||
= { C_sAttr_xl_href, C_sAttr_xl_role, C_sAttr_xl_title, C_sAttr_xmlns, C_sAttr_xl_type };
|
||||
|
||||
ret->AddChild( *new MultipleAttrElement(C_sReferenceDocu, C_sRefDocuAttrNames, C_sRefDocuAttrNumber) );
|
||||
o_rServiceDependencies = new MultipleTextElement(C_sServiceDependency, lt_idl, true);
|
||||
ret->AddChild( *o_rServiceDependencies );
|
||||
o_rTypes = new MultipleTextElement(C_sType, lt_idl, true);
|
||||
ret->AddChild( *o_rTypes );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
const TextElement *
|
||||
ModuleDescription::ServiceDependencies() const
|
||||
{
|
||||
const unsigned nEarliestPossibleServiceDependenciesIndexInModules = 1;
|
||||
|
||||
for ( unsigned i = nEarliestPossibleServiceDependenciesIndexInModules;
|
||||
i < Children().size();
|
||||
++i )
|
||||
{
|
||||
if ( strcmp(Children()[i]->Name(), C_sServiceDependency) == 0 )
|
||||
return Children()[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const TextElement &
|
||||
ComponentDescription::SupportedServices() const
|
||||
{
|
||||
return *Children()[C_nSupportedServicesIndex];
|
||||
}
|
||||
|
||||
const TextElement *
|
||||
ComponentDescription::ServiceDependencies() const
|
||||
{
|
||||
for ( unsigned i = C_nEarliestPossibleServiceDependenciesIndex; i < Children().size(); ++i )
|
||||
{
|
||||
if ( strcmp(Children()[i]->Name(),C_sServiceDependency) == 0)
|
||||
return Children()[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* $RCSfile: xmltree.hxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: np $Date: $
|
||||
*
|
||||
@@ -66,131 +66,113 @@
|
||||
|
||||
// USED SERVICES
|
||||
// BASE CLASSES
|
||||
#include "xmlelem.hxx"
|
||||
// COMPONENTS
|
||||
#include "../support/sistr.hxx"
|
||||
#include "../support/list.hxx"
|
||||
// PARAMETERS
|
||||
|
||||
|
||||
class ComponentDescription;
|
||||
class ReferenceDocuElement;
|
||||
class CompDescrList;
|
||||
|
||||
class TextElement
|
||||
class ModuleDescription : public SequenceElement
|
||||
{
|
||||
public:
|
||||
virtual void SetText(
|
||||
const char * i_sText ) = 0;
|
||||
virtual const char *
|
||||
Name() const = 0;
|
||||
virtual const char *
|
||||
Data(
|
||||
unsigned i_nNr = 0 ) const = 0;
|
||||
virtual unsigned Size() const = 0;
|
||||
};
|
||||
|
||||
class ParentElement
|
||||
{
|
||||
public:
|
||||
typedef DynamicList<TextElement> ChildList;
|
||||
void AddChild(
|
||||
TextElement & let_drElement );
|
||||
|
||||
const ChildList & Children() const { return aChildren; }
|
||||
ChildList & Children() { return aChildren; }
|
||||
ModuleDescription();
|
||||
|
||||
const Simstr & ModuleName() const;
|
||||
void Get_SupportedServices( /// @return also the children of component-description.
|
||||
List< const MultipleTextElement * > &
|
||||
o_rServices ) const;
|
||||
void Get_Types(
|
||||
List< const MultipleTextElement * > &
|
||||
o_rTypes ) const;
|
||||
void Get_ServiceDependencies(
|
||||
List< const MultipleTextElement * > &
|
||||
o_rServices ) const;
|
||||
private:
|
||||
ChildList aChildren;
|
||||
SglTextElement * pModuleName;
|
||||
CompDescrList * pCdList;
|
||||
MultipleTextElement *
|
||||
pTypes;
|
||||
MultipleTextElement *
|
||||
pServiceDependencies;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ModuleDescription : public ParentElement
|
||||
class ComponentDescription : public SequenceElement
|
||||
{
|
||||
public:
|
||||
typedef DynamicList<ComponentDescription> CD_List;
|
||||
|
||||
void AddComponentDescription(
|
||||
ComponentDescription &
|
||||
let_drCD );
|
||||
|
||||
const char * Name() const { return Children()[0]->Data(); }
|
||||
const CD_List & Components() const { return aCDs; }
|
||||
ComponentDescription();
|
||||
|
||||
const Simstr & ComponentName() const { return pComponentName->Data(); }
|
||||
const MultipleTextElement &
|
||||
SupportedServices() const
|
||||
{ return *pSupportedServices; }
|
||||
const MultipleTextElement &
|
||||
Types() const { return *pTypes; }
|
||||
const MultipleTextElement &
|
||||
ServiceDependencies() const
|
||||
{ return *pServiceDependencies; }
|
||||
private:
|
||||
CD_List aCDs;
|
||||
SglTextElement * pComponentName;
|
||||
MultipleTextElement *
|
||||
pSupportedServices;
|
||||
MultipleTextElement *
|
||||
pTypes;
|
||||
MultipleTextElement *
|
||||
pServiceDependencies;
|
||||
};
|
||||
|
||||
|
||||
class ComponentDescription : public ParentElement
|
||||
class CompDescrList : public ListElement
|
||||
{
|
||||
public:
|
||||
typedef DynamicList<ReferenceDocuElement> Docu_List;
|
||||
|
||||
void SetStatus(
|
||||
const char * i_sText );
|
||||
|
||||
const char * Name() const { return Children()[0]->Data(); }
|
||||
const Docu_List & DocuRefs() const { return aDocuRefs; }
|
||||
Docu_List & DocuRefs() { return aDocuRefs; }
|
||||
const char * Status() const { return sStatus; }
|
||||
CompDescrList();
|
||||
virtual void Write2Html(
|
||||
HtmlCreator & io_rHC ) const;
|
||||
virtual XmlElement *
|
||||
Create_and_Add_NewElement();
|
||||
|
||||
void Get_SupportedServices(
|
||||
List< const MultipleTextElement * > &
|
||||
o_rResult ) const;
|
||||
void Get_Types(
|
||||
List< const MultipleTextElement * > &
|
||||
o_rResult ) const;
|
||||
void Get_ServiceDependencies(
|
||||
List< const MultipleTextElement * > &
|
||||
o_rResult ) const;
|
||||
private:
|
||||
Simstr sStatus;
|
||||
Docu_List aDocuRefs;
|
||||
List< ComponentDescription * >
|
||||
aCDs;
|
||||
};
|
||||
|
||||
|
||||
class SglTextElement : public TextElement
|
||||
class MdName : public SglTextElement
|
||||
{
|
||||
public:
|
||||
SglTextElement(
|
||||
const char * i_sName );
|
||||
virtual void SetText(
|
||||
const char * i_sText );
|
||||
|
||||
virtual const char *
|
||||
Name() const;
|
||||
virtual const char *
|
||||
Data(
|
||||
unsigned i_nNr = 0 ) const;
|
||||
virtual unsigned Size() const;
|
||||
|
||||
private:
|
||||
Simstr sName;
|
||||
Simstr sContent;
|
||||
MdName();
|
||||
virtual void Write2Html(
|
||||
HtmlCreator & io_rHC ) const;
|
||||
};
|
||||
|
||||
|
||||
class MultipleTextElement : public TextElement
|
||||
class CdName : public SglTextElement
|
||||
{
|
||||
public:
|
||||
MultipleTextElement(
|
||||
const char * i_sName );
|
||||
virtual void SetText(
|
||||
const char * i_sText );
|
||||
|
||||
virtual const char *
|
||||
Name() const;
|
||||
virtual const char *
|
||||
Data(
|
||||
unsigned i_nNr = 0 ) const;
|
||||
virtual unsigned Size() const;
|
||||
|
||||
private:
|
||||
Simstr sName;
|
||||
List<Simstr> aContent;
|
||||
CdName();
|
||||
virtual void Write2Html(
|
||||
HtmlCreator & io_rHC ) const;
|
||||
};
|
||||
|
||||
|
||||
class ReferenceDocuElement
|
||||
class SupportedService : public MultipleTextElement
|
||||
{
|
||||
public:
|
||||
SupportedService();
|
||||
|
||||
Simstr sAttr_href;
|
||||
Simstr sAttr_role;
|
||||
Simstr sAttr_title;
|
||||
virtual void Insert2Index(
|
||||
Index & o_rIndex ) const;
|
||||
};
|
||||
|
||||
|
||||
// IMPLEMENTATION
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user