Kaydet (Commit) 00c8e75b authored tarafından Nikolai Pretzell's avatar Nikolai Pretzell

Allow tag <type> in module-description

üst e566db9b
......@@ -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[] = "&nbsp;&nbsp;&nbsp;";
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,133 +116,151 @@ HtmlCreator::Run()
WriteStr( "ModuleDescription" );
WriteStr( C_sHtmlFileHeader2 );
StartTable();
rDocument.Write2Html(*this);
const ParentElement::ChildList & rModuleElements = rDescr.Children();
unsigned i_max = rModuleElements.size();
WriteStr( "<P><BR><BR></P>\n" );
WriteStr( C_sHtmlFileFoot );
}
for (unsigned i = 0; i < i_max; i++)
{
Write_TextElement( *rModuleElements[i], lt_nolink ); // Name,
// ProjectBuildDependency,
// RuntimeModuleDependency
} // end for
void
HtmlCreator::StartTable()
{
WriteStr( "<P><BR></P>\n" );
WriteStr(
"<TABLE WIDTH=95% BORDER=1 CELLSPACING=0 CELLPADDING=4>\n"
" <TBODY>\n" );
}
WriteStr( "<TR><TD COLSPAN=2>\n"
"<H4><BR>Components</H4>\n" );
void
HtmlCreator::FinishTable()
{
WriteStr( " </TBODY>\n"
"</TABLE>\n\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" );
void
HtmlCreator::StartBigCell( const char * i_sTitle )
{
WriteStr( "<TR><TD COLSPAN=2>\n"
"<H4><BR>" );
WriteStr( i_sTitle );
WriteStr( "</H4>\n" );
Write_Description( *rCDs[d] );
} // end for
}
void
HtmlCreator::FinishBigCell()
{
WriteStr( "</TD><TR>\n" );
FinishTable();
WriteStr( "<P><BR><BR></P>\n" );
WriteStr( C_sHtmlFileFoot );
}
void
HtmlCreator::Write_Description( const ComponentDescription & i_rDescr )
HtmlCreator::Write_SglTextElement( const SglTextElement & i_rElement,
bool i_bStrong )
{
StartTable();
StartRow();
const ParentElement::ChildList & rDescrElements = i_rDescr.Children();
WriteElementName( i_rElement.Name(), i_bStrong );
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
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( "\">" );
}
Write_Status(i_rDescr.Status()); // Status
WriteName( aFile, sIdl_BaseDirectory, i_rElement.Data(),
i_bStrong ? lt_nolink : i_rElement.LinkType() );
for (unsigned i = 5; i < i_max; i++)
{
Write_TextElement( *rDescrElements[i], lt_idl ); // Supported Service,
// Service Dependency,
// Type
if (i_bStrong)
WriteStr( "</A></H4>" );
FinishCell();
} // end for
FinishRow();
}
void
HtmlCreator::Write_MultiTextElement( const MultipleTextElement & i_rElement )
{
StartRow();
WriteElementName( i_rElement.Name(), false );
const ComponentDescription::Docu_List & rDocuRefs = i_rDescr.DocuRefs();
unsigned r_max = rDocuRefs.size();
for (unsigned r = 0; r < r_max; r++)
StartCell( "77%");
unsigned i_max = i_rElement.Size();
for ( unsigned i = 0; i < i_max; ++i )
{
Write_ReferenceDocu(*rDocuRefs[r]);
} // end for
if (i > 0)
WriteStr( "<BR>\n" );
WriteName( aFile, sIdl_BaseDirectory, i_rElement.Data(i), i_rElement.LinkType() );
} // end for
FinishCell();
FinishTable();
FinishRow();
}
void
HtmlCreator::Write_TextElement( TextElement & i_rElement,
E_LinkType i_eLinkType )
HtmlCreator::Write_SglText( const Simstr & i_sName,
const Simstr & i_sValue )
{
StartRow();
WriteElementName( i_rElement );
WriteElementData( i_rElement, i_eLinkType );
WriteElementName( i_sName, false );
StartCell( "77%");
WriteStr( i_sValue );
FinishCell();
FinishRow();
}
void
HtmlCreator::Write_ReferenceDocu( const ReferenceDocuElement & i_rRefDocu )
HtmlCreator::Write_ReferenceDocu( const Simstr & i_sName,
const Simstr & i_sRef,
const Simstr & i_sRole,
const Simstr & i_sTitle )
{
StartRow();
StartCell( "23%" );
WriteStr("ReferenceDocu");
WriteStr(i_sName);
FinishCell();
StartCell( "77%" );
if ( i_rRefDocu.sAttr_href.l() > 0)
if ( !i_sRef.is_empty() )
{
WriteStr("<A href=\"http://");
WriteStr(i_rRefDocu.sAttr_href.str());
WriteStr("<A href=\"");
WriteStr(i_sRef);
WriteStr("\">");
WriteStr(i_rRefDocu.sAttr_href.str());
if ( !i_sTitle.is_empty() )
WriteStr( i_sTitle );
else
WriteStr(i_sRef);
WriteStr("</A><BR>\n");
}
if ( i_rRefDocu.sAttr_title.l() > 0)
else if ( !i_sTitle.is_empty() )
{
WriteStr("Title: ");
WriteStr(i_rRefDocu.sAttr_title.str());
WriteStr( i_sTitle );
WriteStr("<BR>\n");
}
if ( i_rRefDocu.sAttr_role.l() > 0)
if ( !i_sRole.is_empty() )
{
WriteStr("Role: ");
WriteStr(i_rRefDocu.sAttr_role.str());
WriteStr( i_sRole );
}
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)
......@@ -254,21 +272,6 @@ HtmlCreator::PrintH1( char * i_pText)
WriteStr(sH1e);
}
void
HtmlCreator::StartTable()
{
WriteStr(
"<TABLE WIDTH=95% BORDER=1 CELLSPACING=0 CELLPADDING=4>\n"
" <TBODY>\n" );
}
void
HtmlCreator::FinishTable()
{
WriteStr( " </TBODY>\n"
"</TABLE>\n\n" );
}
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;
};
......
This diff is collapsed.
......@@ -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
......
This diff is collapsed.
......@@ -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>
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)
{
pModuleName = new MdName;
AddChild( *pModuleName );
pCdList = new CompDescrList;
AddChild( *pCdList );
AddChild( *Create_ModuleDescrOptional_Element( pTypes, pServiceDependencies ) );
}
const Simstr &
ModuleDescription::ModuleName() const
{
return pModuleName->Data();
}
void
ParentElement::AddChild( TextElement & let_drElement )
ModuleDescription::Get_SupportedServices( List< const MultipleTextElement * > & o_rServices ) const
{
aChildren.push_back(&let_drElement);
o_rServices.push_back(pServiceDependencies);
pCdList->Get_SupportedServices( o_rServices );
}
void
ModuleDescription::Get_Types( List< const MultipleTextElement * > & o_rTypes ) const
{
o_rTypes.push_back(pTypes);
pCdList->Get_Types( o_rTypes );
}
void
ModuleDescription::AddComponentDescription( ComponentDescription & let_drCD )
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)
{
aCDs.push_back(&let_drCD);
}
void
ComponentDescription::SetStatus( const char * i_sText )
CompDescrList::Write2Html( HtmlCreator & io_rHC ) const
{
sStatus = i_sText;
io_rHC.StartBigCell(C_sCompDescrListTitle);
ListElement::Write2Html(io_rHC);
io_rHC.FinishBigCell();
}
SglTextElement::SglTextElement( const char * i_sName )
: sName(i_sName)
XmlElement *
CompDescrList::Create_and_Add_NewElement()
{
ComponentDescription * pCD = new ComponentDescription;
Children().push_back(pCD);
aCDs.push_back(pCD);
return pCD;
}
void
SglTextElement::SetText( const char * i_sText )
CompDescrList::Get_SupportedServices( List< const MultipleTextElement * > & o_rResult ) const
{
sContent = i_sText;
unsigned i_max = aCDs.size();;
for (unsigned i = 0; i < i_max; ++i)
{
o_rResult.push_back(& aCDs[i]->SupportedServices());
} // end for
}
const char *
SglTextElement::Name() const
void
CompDescrList::Get_Types( List< const MultipleTextElement * > & o_rResult ) const
{
return sName;
unsigned i_max = aCDs.size();;
for (unsigned i = 0; i < i_max; ++i)
{
o_rResult.push_back(& aCDs[i]->Types());
} // end for
}
const char *
SglTextElement::Data( unsigned i_nNr ) const
void
CompDescrList::Get_ServiceDependencies( 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]->ServiceDependencies());
} // end for
}
unsigned
SglTextElement::Size() const
MdName::MdName()
: SglTextElement(C_sModuleName, lt_html, false)
{
return 1;
}
void
MdName::Write2Html( HtmlCreator & io_rHC ) const
{
io_rHC.Write_SglTextElement( *this, true );
}
MultipleTextElement::MultipleTextElement( const char * i_sName )
: sName(i_sName)
CdName::CdName()
: SglTextElement(C_sName, lt_html, true)
{
}
void
MultipleTextElement::SetText( const char * i_sText )
CdName::Write2Html( HtmlCreator & io_rHC ) const
{
io_rHC.Write_SglTextElement( *this, true );
}
SupportedService::SupportedService()
: MultipleTextElement(C_sSupportedService, lt_idl, true)
{
}
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 )
{
aContent.push_back(i_sText);
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;
}
const char *
MultipleTextElement::Name() const
FreeChoiceElement *
Create_CompDescrOptional_Element( MultipleTextElement * & o_rTypes,
MultipleTextElement * & o_rServiceDependencies )
{
return sName;
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;
}
const char *
MultipleTextElement::Data( unsigned i_nNr ) const
#if 0
const TextElement *
ModuleDescription::ServiceDependencies() const
{
if (i_nNr < aContent.size())
return aContent[i_nNr].str();
else
return "";
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;
}
unsigned
MultipleTextElement::Size() const
const TextElement &
ComponentDescription::SupportedServices() const
{
return aContent.size();
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment