diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-10-03 13:40:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-03 18:24:40 +0200 |
commit | f9b4426b9783eb989878bbb3c71f245b1cc5b780 (patch) | |
tree | 0542948c467780f1eaf58953f5c5cf72455aa9e3 /xml2cmp | |
parent | 7997d8b0cb1347c1eaa6e676d0c4ff182812d345 (diff) |
xml2cmp no longer used
Change-Id: Idba65371b8778521bc767fe4893340cf13a8ff3b
Diffstat (limited to 'xml2cmp')
33 files changed, 0 insertions, 4536 deletions
diff --git a/xml2cmp/Executable_xml2cmp.mk b/xml2cmp/Executable_xml2cmp.mk deleted file mode 100644 index 600302977d5c..000000000000 --- a/xml2cmp/Executable_xml2cmp.mk +++ /dev/null @@ -1,49 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# Peter Foley <pefoley2@verizon.net> -# Portions created by the Initial Developer are Copyright (C) 2011 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. -# - -$(eval $(call gb_Executable_Executable,xml2cmp)) - -$(eval $(call gb_Executable_add_exception_objects,xml2cmp,\ - xml2cmp/source/xcd/main \ - xml2cmp/source/support/cmdline \ - xml2cmp/source/support/heap \ - xml2cmp/source/support/sistr \ - xml2cmp/source/support/syshelp \ - xml2cmp/source/support/badcast \ - xml2cmp/source/xcd/cr_html \ - xml2cmp/source/xcd/cr_metho \ - xml2cmp/source/xcd/filebuff \ - xml2cmp/source/xcd/parse \ - xml2cmp/source/xcd/xmlelem \ - xml2cmp/source/xcd/xmltree \ - xml2cmp/source/xcd/dependy \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/xml2cmp/Makefile b/xml2cmp/Makefile deleted file mode 100644 index ccb1c85a04da..000000000000 --- a/xml2cmp/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- - -module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) - -include $(module_directory)/../solenv/gbuild/partial_build.mk - -# vim: set noet sw=4 ts=4: diff --git a/xml2cmp/Module_xml2cmp.mk b/xml2cmp/Module_xml2cmp.mk deleted file mode 100644 index c4279fbffb15..000000000000 --- a/xml2cmp/Module_xml2cmp.mk +++ /dev/null @@ -1,38 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# Peter Foley <pefoley2@verizon.net> -# Portions created by the Initial Developer are Copyright (C) 2011 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. -# - -$(eval $(call gb_Module_Module,xml2cmp)) - -ifneq ($(CROSS_COMPILING),YES) -$(eval $(call gb_Module_add_targets,xml2cmp,\ - Executable_xml2cmp \ -)) -endif - diff --git a/xml2cmp/README b/xml2cmp/README deleted file mode 100644 index d8e12d439c51..000000000000 --- a/xml2cmp/README +++ /dev/null @@ -1,3 +0,0 @@ -Part of the LibreOffice SDK. - -Mostly used by makefiles to pull out types from xml. diff --git a/xml2cmp/prj/build.lst b/xml2cmp/prj/build.lst deleted file mode 100644 index b486de70513c..000000000000 --- a/xml2cmp/prj/build.lst +++ /dev/null @@ -1,2 +0,0 @@ -xc xml2cmp : solenv NULL -xc xml2cmp\prj nmake - all xc_prj NULL diff --git a/xml2cmp/prj/d.lst b/xml2cmp/prj/d.lst deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/xml2cmp/prj/d.lst +++ /dev/null diff --git a/xml2cmp/source/finder/dep_main.cxx b/xml2cmp/source/finder/dep_main.cxx deleted file mode 100644 index 33fd7fcc9cfb..000000000000 --- a/xml2cmp/source/finder/dep_main.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <iostream> - -#include "dependy.hxx" - - -int -#ifdef WNT -_cdecl -#endif -main( int argc, - char * argv[] ) -{ - if (argc < 2 || *argv[1] == '?') - { - std::cout << "\nUse:\n" - << "srvdepy.exe <xml-component-descriptions-root-directory>\n" - << std::endl; - return 0; - } - - - DependencyFinder aDependencies; - - aDependencies.GatherData(argv[1]); - char sInput[500] = ""; - std::vector<Simstr> aLibs; - std::vector<Simstr> aServs; - - - std::cout - << "\nNow you can start to put in Service names.\n" - << "Please use correct case, but don't use namespaces.\n" - << "Just the Service's own name.\n\n" - << "To stop the program, put in a hashmark \"#\" + ENTER.\n" - << std::endl; - - - - do { - - sInput[0] = 0; - std::cin >> sInput; - Simstr sImplService(sInput); - if (*sInput != '#') - { - aLibs.erase( aLibs.begin(), aLibs.end() ); - aServs.erase( aServs.begin(), aServs.end() ); - - aDependencies.FindNeededServices( aLibs, aServs, sImplService ); - - std::cout << "\n\n\nNeeded libraries: " << std::endl; - for ( unsigned i = 0; i < aLibs.size(); ++i ) - { - std::cout << " " << aLibs[i].str() << std::endl; - } - std::cout << "\nNeeded services: " << std::endl; - for ( unsigned s= 0; s < aServs.size(); ++s ) - { - std::cout << " " << aServs[s].str() << std::endl; - } - std::cout << "\n\n" << std::endl; - } - } while (*sInput != '#'); - - return 0; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/inc/precomp.h b/xml2cmp/source/inc/precomp.h deleted file mode 100644 index aa7f115a836a..000000000000 --- a/xml2cmp/source/inc/precomp.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef CPV_PRECOMP_H -#define CPV_PRECOMP_H - -typedef short Bool; -#define True 1 -#define False 0 - - - -typedef long intt; - -#define AND && -#define OR || -#define NOT ! - - -#define REF( x ) (&(x)) -#define THIS_ pThis - - - -#endif - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/badcast.cxx b/xml2cmp/source/support/badcast.cxx deleted file mode 100644 index 09afc27ddfc0..000000000000 --- a/xml2cmp/source/support/badcast.cxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - - -/* Include this for instantiating bad-cast, - due to problems with WNT-STL-headers. -*/ - -// If anybody who happens to read this has any idea what dark magic -// this is supposed to achieve, and whether it is needed or in any way -// relevant with MSVC2008 (or eventually newer), please add a -// comment... - -#if defined(WNT) && !defined(__MINGW32__) - -#define _NTSDK -#include<typeinfo> - -_STD_BEGIN -bad_cast G_Dummy_Inst_bad_cast; -_STD_END -#endif // WNT - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/cmdline.cxx b/xml2cmp/source/support/cmdline.cxx deleted file mode 100644 index cdf484fb52e7..000000000000 --- a/xml2cmp/source/support/cmdline.cxx +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "cmdline.hxx" - -#include <ctype.h> -#include <string.h> -#include <stdlib.h> -#include <iostream> - - -char C_sUseText[] = "Use: xml2cmp.exe \n" - " [-dep <xml-component-descriptions-root-directory> \n" - " [-func funcFile] \n" - " [-html htmlFile] \n" - " [-types typeFile] \n" - " [-idlpath idlPath] \n" - " Xml_FileName\n"; - - -char C_sCmdFunc[] = "-func"; -char C_sCmdDep[] = "-dep"; -char C_sCmdHtml[] = "-html"; -char C_sCmdType[] = "-types"; -char C_sCmdIdlPath[] = "-idlpath"; - - - -bool GetParameter( Simstr & o_rMemory, int & io_nCountArg, int argc, char * argv[] ); - - -CommandLine::CommandLine( int argc, - char * argv[] ) - : bIsOk(true) -{ - bool bDisplayUse = false; - - /* Check command line: */ - if ( argc < 2 ) - bDisplayUse = true; - else if ( argc == 2 && ! isalnum(argv[1][0]) ) - bDisplayUse = true; - - if (bDisplayUse) - { - std::cout << C_sUseText << std::endl; - bIsOk = false; - exit(0); - } - - ParseSingleFileCommand(argc,argv); - - if ( sXmlSourceFile.l() == 0 - && sXmlSourceDirectory.l() == 0 ) - { - bIsOk = false; - } - else if ( sXmlSourceFile.l() > 0 - && sXmlSourceDirectory.l() > 0 ) - { - bIsOk = false; - } -} - -CommandLine::~CommandLine() -{ -} - - -const char * -CommandLine::ErrorText() const -{ - static char cOut[] = "Error: Command line was incorrect. Probably there was a flag without\n" - " the corresponding parameter. Or there was no XML-sourcefile specified.\n"; - return cOut; -} - -bool -GetParameter( Simstr & o_pMemory, - int & io_pCountArg, - int argc, char * argv[] ) -{ - io_pCountArg++; - if( io_pCountArg < argc ) - { - o_pMemory = argv[io_pCountArg]; - return true; - } - return false; -} - -void -CommandLine::ParseSingleFileCommand( int argc, - char * argv[] ) -{ - for ( int nCountArg = 1; nCountArg < argc && bIsOk; ++nCountArg ) - { - if ( strcmp( argv[nCountArg], C_sCmdFunc ) == 0 ) - { - bIsOk = GetParameter( - sFuncFile, - nCountArg, - argc, - argv ); - } - else if ( strcmp( argv[nCountArg], C_sCmdHtml ) == 0 ) - { - bIsOk = GetParameter( - sHtmlFile, - nCountArg, - argc, - argv ); - } - else if ( strcmp( argv[nCountArg], C_sCmdType ) == 0 ) - { - bIsOk = GetParameter( - sTypeInfoFile, - nCountArg, - argc, - argv ); - } - else if ( strcmp( argv[nCountArg], C_sCmdIdlPath ) == 0 ) - { - bIsOk = GetParameter( - sIdlRootPath, - nCountArg, - argc, - argv ); - } - else if ( strcmp( argv[nCountArg], C_sCmdDep ) == 0 ) - { - bIsOk = GetParameter( - sDepPath, - nCountArg, - argc, - argv ); - } - else - { - sXmlSourceFile = argv[nCountArg]; - } - } /* end for */ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/cmdline.hxx b/xml2cmp/source/support/cmdline.hxx deleted file mode 100644 index 89052fc3547f..000000000000 --- a/xml2cmp/source/support/cmdline.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef X2C_CMDLINE_HXX -#define X2C_CMDLINE_HXX - -#include "sistr.hxx" - -class CommandLine -{ - public: - CommandLine( - int i_argc, - char * i_argv[] ); - ~CommandLine(); - - bool IsOk() const { return bIsOk; } - const char * ErrorText() const; - - const char * XmlSrcFile() const { return sXmlSourceFile.str(); } - const char * FuncFile() const { return sFuncFile.str(); } - const char * HtmlFile() const { return sHtmlFile.str(); } - const char * TypeInfoFile() const { return sTypeInfoFile.str(); } - const char * DepPath() const { return sDepPath.str(); } - - bool IsDepCommand() const { return sDepPath.l() > 0; } - const char * XmlSrcDirectory() const { return sXmlSourceDirectory.str(); } - const char * OutputDirectory() const { return sOutputDirectory.str(); } - - const char * IdlRootPath() const { return sIdlRootPath.str(); } - - private: - void ParseSingleFileCommand( - int argc, - char * argv[] ); - Simstr sXmlSourceFile; - Simstr sFuncFile; - Simstr sHtmlFile; - Simstr sTypeInfoFile; - - Simstr sXmlSourceDirectory; - Simstr sOutputDirectory; - - Simstr sIdlRootPath; - Simstr sDepPath; - - bool bIsOk; -}; - - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/heap.cxx b/xml2cmp/source/support/heap.cxx deleted file mode 100644 index d0e0e961c1c7..000000000000 --- a/xml2cmp/source/support/heap.cxx +++ /dev/null @@ -1,194 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <string.h> -#include "heap.hxx" - - -#include <iostream> -#include <stdlib.h> -#define AssertionOf(x) {if (!(x)) {std::cerr << "Assertion failed: " << #x << __FILE__ << __LINE__ << std::endl; exit(3); }} - -#ifdef UNX -#define stricmp strcasecmp -#endif - - - -Heap::Heap(unsigned i_nWidth) - : dpColumnsArray(new Column[i_nWidth]), - nColumnsArraySize(i_nWidth), - nActiveColumn(nColumnsArraySize-1) -{ - for ( unsigned i = 0; i < nColumnsArraySize; i++) - { - dpColumnsArray[i] = 0; - } // end for -} - -Heap::~Heap() -{ - for ( unsigned i = 0; i < nColumnsArraySize; i++) - { - HeapItem * & rColumn = dpColumnsArray[i]; - for ( HeapItem * pValue = rColumn; pValue != 0; pValue = rColumn ) - { - rColumn = rColumn->Next(); - delete pValue; - } - } // end for - - delete [] dpColumnsArray; -} - -void -Heap::InsertValue( const char * i_sKey, - const char * i_sValue ) -{ - HeapItem * pSearch1 = 0; - HeapItem * pSearch2 = 0; - HeapItem * pNew = new HeapItem(i_sKey, i_sValue); - - IncColumn(); - pSearch1 = ActiveColumn(); - - if ( pSearch1 != 0 ? *pNew < *pSearch1 : true ) - { - pNew->SetNext( pSearch1 ); - ActiveColumn() = pNew; - - if ( pNew->Next() != 0) - { - AssertionOf( *pNew <= *pNew->Next() ); - } - - return; - } - - do - { - pSearch2 = pSearch1; - pSearch1 = pSearch1->Next(); - - if ( pSearch1 != 0 ? *pNew < *pSearch1 : true ) - { - pNew->SetNext( pSearch1 ); - pSearch2->SetNext(pNew); - - - AssertionOf( *pSearch2 <= *pNew ); - if ( pNew->Next() != 0) - { - AssertionOf( *pNew <= *pNew->Next() ); - } - - } - } while (pSearch2->Next() != pNew); -} - - -Simstr sKey1; -Simstr sValue1; -Simstr sKey2; -Simstr sValue2; -int nCol1 = 0; -int nCol2 = 0; - - -HeapItem * -Heap::ReleaseTop() -{ - unsigned nRetColumn = 0; - HeapItem * ret = dpColumnsArray[0]; - HeapItem * pSearch = 0; - - for ( unsigned i = 1; i < nColumnsArraySize; ++i ) - { - pSearch = dpColumnsArray[i]; - if (pSearch != 0) - { - if ( ret == 0 ? true : *pSearch < *ret) - { - ret = pSearch; - nRetColumn = i; - } - } - } // for - - if (ret != 0) - { - dpColumnsArray[nRetColumn] = ret->Next(); - } - return ret; -} - -void -Heap::IncColumn() -{ - if (++nActiveColumn >= nColumnsArraySize) - nActiveColumn = 0; -} - - - -HeapItem::HeapItem( const char * i_sKey, - const char * i_sValue ) - : sValue(i_sValue), - sKey(i_sKey), - pNext(0) -{ -} - -HeapItem::~HeapItem() -{ -} - -bool -HeapItem::operator<( const HeapItem & i_rOther ) const -{ - int ret = stricmp(sKey.str(), i_rOther.sKey.str()); - if (ret == 0) - ret = strcmp(sKey.str(), i_rOther.sKey.str()); - if (ret == 0) - ret = stricmp(sValue.str(), i_rOther.sValue.str()); - if (ret == 0) - ret = strcmp(sValue.str(), i_rOther.sValue.str()); - return ret < 0; -} - -const Simstr & -HeapItem::Key() const -{ - return sKey; -} - -HeapItem * -HeapItem::Next() const -{ - return pNext; -} - -void -HeapItem::SetNext( HeapItem * i_pNext ) -{ - pNext = i_pNext; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/heap.hxx b/xml2cmp/source/support/heap.hxx deleted file mode 100644 index df6969ec4b93..000000000000 --- a/xml2cmp/source/support/heap.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef X2C_HEAP_HXX -#define X2C_HEAP_HXX - -#include "sistr.hxx" - -class HeapItem; - -class Heap -{ - public: - Heap( - unsigned i_nWidth ); - ~Heap(); - - void InsertValue( - const char * i_sKey, - const char * i_sValue ); - HeapItem * ReleaseTop(); /// @return must be deleted by caller of method. - - private: - typedef HeapItem * Column; - - void IncColumn(); - Column & ActiveColumn() { return dpColumnsArray[nActiveColumn]; } - - Column * dpColumnsArray; - unsigned nColumnsArraySize; - unsigned nActiveColumn; -}; - - -class HeapItem -{ - public: - HeapItem( - const char * i_sKey, - const char * i_sValue ); - ~HeapItem( ); - - bool operator<( - const HeapItem & i_rOther ) const; - bool operator<=( - const HeapItem & i_rOther ) const - { return ! (i_rOther < *this); } - const Simstr & Key() const; - HeapItem * Next() const; - - void SetNext( - HeapItem * i_pNext ); - private: - Simstr sValue; - Simstr sKey; - HeapItem * pNext; -}; - - - - - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/list.hxx b/xml2cmp/source/support/list.hxx deleted file mode 100644 index 77da1608e10a..000000000000 --- a/xml2cmp/source/support/list.hxx +++ /dev/null @@ -1,244 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef __LISTEN_123456__ -#define __LISTEN_123456__ - -#include <string.h> -#include <iostream> -#include <stdlib.h> - -template <class XX> -class List -{ - public : - typedef XX * iterator; - typedef const XX * const_iterator; - - // LIFECYCLE - List(); - virtual ~List() { delete [] inhalt; } - - // OPERATORS - const XX & operator[]( - unsigned n) const - { return elem(n); } - XX & operator[]( - unsigned n) - { return elem(n); } - // OPERATIONS - void reserve( - unsigned i_nSize ) - { alloc(i_nSize,true); } - virtual void insert( - unsigned pos, - const XX & elem ); - void push_back( - const XX & elem_) - { insert(size(),elem_); } - - virtual void remove( - unsigned pos ); - void pop_back() { remove(size()-1); } - void erase_all() { while (size()) remove(size()-1); } - - // INQUIRY - const XX & front() const { return elem(0); } - const XX & back() const { return elem(len-1); } - - unsigned size() const { return len; } - unsigned space() const { return allocated; } - bool is_valid_index( - unsigned n) const - { return n < len; } - // ACCESS - XX & front() { return elem(0); } - XX & back() { return elem(len-1); } - - protected: - void checkSize( - unsigned newLength); - void alloc( - unsigned newSpace, - bool re = false ); - - const XX & elem( - unsigned n ) const - { return inhalt[n]; } - XX & elem( - unsigned n ) - { return inhalt[n]; } - // DATA - XX * inhalt; - unsigned len; - unsigned allocated; - - private: - // forbidden functions - List(const List<XX> & L); - List<XX> & operator=( - const List<XX> & L); - -}; - -template <class XY> -class DynamicList : public List<XY*> -{ - public: - virtual ~DynamicList(); - - virtual void insert( - unsigned pos, - XY * const & elem ); - virtual void remove( - unsigned pos ); -}; - - - -template <class XX> -List<XX>::List() - : inhalt(0), - len(0), - allocated(0) - -{ - alloc(1); -} - - -template <class XX> -void -List<XX>::insert(unsigned pos, const XX & elem_) -{ - if ( pos > len ) - return; - - checkSize(len+2); - for ( unsigned p = len; p > pos; --p) - { - inhalt[p] = inhalt[p-1]; - } - inhalt[pos] = elem_; - len++; -} - - -template <class XX> -void -List<XX>::remove(unsigned pos) -{ - if ( pos >= len ) - return; - len--; - for ( unsigned p = pos; p < len; ++p) - { - inhalt[p] = inhalt[p+1]; - } -} - - -// Protected: -template <class XX> -void -List<XX>::checkSize(unsigned newLength) -{ - // test new size requirement: - unsigned newSpace = space(); - if (newLength > newSpace) - { - if (!newSpace) - newSpace = 1; - const unsigned nBorder = 65536 / 2; - while(newLength > newSpace) - { - if (newSpace < nBorder) - newSpace <<= 1; - else - { - std::cerr << "List becomes too big" << std::endl; - exit(1); - } - } - } - - // change? - if (newSpace != space()) - alloc(newSpace,true); -} - -template <class XX> -void -List<XX>::alloc( unsigned newSpace, - bool re ) -{ - XX * pNew = new XX[newSpace]; - - if (inhalt != 0) - { - if (re) - { - for (unsigned i = 0; i < len; ++i) - { - pNew[i] = inhalt[i]; - } // end for - } - delete [] inhalt; - } - - inhalt = pNew; - allocated = newSpace; -} - - -template <class XY> -DynamicList<XY>::~DynamicList() -{ - this->erase_all(); -} - -template <class XY> -void -DynamicList<XY>::insert(unsigned pos, XY * const & elem_) -{ - if ( pos > this->len ) - return; - - this->checkSize(this->len+2); - memmove(&this->inhalt[pos+1], &this->inhalt[pos], (this->len-pos) * sizeof(XY*) ); - this->inhalt[pos] = elem_; - this->len++; -} - -template <class XY> -void -DynamicList<XY>::remove( unsigned pos ) -{ - if (!this->is_valid_index(pos) ) - return; - this->len--; - delete this->inhalt[pos]; - memmove(&this->inhalt[pos], &this->inhalt[pos+1], (this->len-pos) * sizeof(XY*) ); -} - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/sistr.cxx b/xml2cmp/source/support/sistr.cxx deleted file mode 100644 index a3464175bf9f..000000000000 --- a/xml2cmp/source/support/sistr.cxx +++ /dev/null @@ -1,393 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <sistr.hxx> - -// The following two header-files declare -// standard ANSI-C++ functions. They may be replaced -// by the corresponding header-file-names of the -// actually used runtime library. -#include <string.h> // strlen(), memcpy(), memset() -#include <ctype.h> // tolower() -#include <limits.h> // INT_MAX - -#if (_MSC_VER >=1400) -#pragma warning(disable:4365) -#endif - -const char NULCH = '\0'; -const int NO_POS = -1; - - -Simstr::Simstr(const char * str_) -{ - if (str_ == 0) - { - len = 0; - sz = new char[1]; - *sz = 0; - } - else - { - len = strlen(str_); - sz = new char[len+1]; - memcpy(sz,str_,len+1); - } -} - -Simstr::Simstr( const char * anybytes, - int firstBytesPos, - int nrOfBytes) -{ - unsigned slen = strlen(anybytes); - if (anybytes == 0 || slen <= unsigned(firstBytesPos)) - { - len = 0; - sz = new char[1]; - *sz = 0; - } - else - { - int maxLen = slen - unsigned(firstBytesPos); - len = maxLen < nrOfBytes - ? maxLen - : nrOfBytes; - sz = new char[len+1]; - memcpy(sz,anybytes+firstBytesPos,len); - *(sz+len) = 0; - } -} - - -Simstr::Simstr(const Simstr & S) -{ - len = S.len; - sz = new char[len+1]; - memcpy(sz,S.sz,len+1); -} - -Simstr & Simstr::operator=(const Simstr & S) -{ - if (sz == S.sz) - return *this; - - delete [] sz; - - len = S.len; - sz = new char[len+1]; - memcpy(sz,S.sz,len+1); - - return *this; -} - -Simstr::~Simstr() -{ - delete [] sz; -} - -Simstr -Simstr::operator+(const Simstr & S) const -{ - Simstr ret = sz; - ret.push_back(S); - return ret; -} - -Simstr & -Simstr::operator+=(const Simstr & S) -{ - push_back(S); - return *this; -} - - -// REL - -bool -Simstr::operator==(const Simstr & S) const -{ return !strcmp(sz,S.sz) ? true : false; } - -bool -Simstr::operator!=(const Simstr & S) const -{ return strcmp(sz,S.sz) ? true : false; } - -bool -Simstr::operator<(const Simstr & S) const -{ return (strcmp(sz,S.sz) < 0) ? true : false; } - -bool -Simstr::operator>(const Simstr & S) const -{ return (strcmp(sz,S.sz) > 0) ? true : false; } - -bool -Simstr::operator<=(const Simstr & S) const -{ return (strcmp(sz,S.sz) <= 0) ? true : false; } - -bool -Simstr::operator>=(const Simstr & S) const -{ return (strcmp(sz,S.sz) >= 0) ? true : false; } - - - - -// ************** LIST - Funktionen ***************** - -// Insert - -void -Simstr::push_front(char c) -{ - char * result = new char[len+2]; - - result[0] = c; - memcpy(result+1,sz,len+1); - - delete [] sz; - sz = result; - len++; -} - -void -Simstr::push_back(char c) -{ - char * result = new char[len+2]; - - memcpy(result,sz,len); - result[len] = c; - result[len+1] = 0; - - delete [] sz; - sz = result; - len++; -} - -void -Simstr::push_front(const Simstr & S) -{ - char * result = new char[len+1+S.len]; - - memcpy(result,S.sz,S.len); - memcpy(result+S.len,sz,len+1); - - delete [] sz; - sz = result; - len += S.len; -} - -void -Simstr::push_back(const Simstr & S) -{ - char * result = new char[len+1+S.len]; - - memcpy(result,sz,len); - memcpy(result+len,S.sz,S.len+1); - - delete [] sz; - sz = result; - len += S.len; -} - - -// Remove - -void -Simstr::remove(int pos, int anzahl) -{ - if (pos >= len || pos < 0 || anzahl < 1) - return; - - int anz = len - pos < anzahl ? len - pos : anzahl; - - char * result = new char[len-anz+1]; - - memcpy(result,sz,pos); - memcpy(result+pos,sz+pos+anz,len-pos-anz+1); - - delete [] sz; - sz = result; - len -= anz; -} - -void -Simstr::remove_trailing_blanks() -{ - int newlen = len-1; - for ( ; newlen > 1 && sz[newlen] <= 32; --newlen ) {} - - if (newlen < len-1) - remove ( newlen+1, len-newlen); -} - -// Find - -int -Simstr::pos_first(char c) const -{ - int i = 0; - for (i = 0; i < len ? sz[i] != c : false; i++) ; - if (i >= len) - return NO_POS; - else - return i; -} - -int -Simstr::pos_last(char c) const -{ - int i = 0; - for (i = len-1; i >= 0 ? sz[i] != c : false; i--) ; - if (i < 0) - return NO_POS; - else - return i; -} - -bool -Simstr::is_no_text() const -{ - if (!len) - return true; - - int i; - for (i = 0; i < len && sz[i] <= 32 ; i++) ; - if (i < len) - return false; - return true; -} - -// Change - -void -Simstr::replace_all(char oldCh, char newCh) -{ - for (int i=0; i < len; i++) - if (sz[i] == oldCh) - sz[i] = newCh; -} - -// Simstr addition -Simstr -operator+(const char * str, const Simstr & S) -{ - Simstr ret = S; - ret.push_front(str); - return ret; -} - -Simstr -operator+(const Simstr & S, const char * str) -{ - Simstr ret = S; - ret.push_back(str); - return ret; -} - -Simstr -operator+(char c, const Simstr & S) -{ - Simstr ret = S; - ret.push_front(c); - return ret; -} - -Simstr -operator+(const Simstr & S, char c) -{ - Simstr ret = S; - ret.push_back(c); - return ret; -} - - -// Simstr-Vergleiche mit char * -bool -operator==(const Simstr & S, const char * str) -{ - return strcmp(S,str) == 0; -} - -bool -operator!=(const Simstr & S, const char * str) -{ - return strcmp(S,str) != 0; -} - -bool -operator<(const Simstr & S, const char * str) -{ - return strcmp(S,str) < 0; -} - -bool -operator>(const Simstr & S, const char * str) -{ - return strcmp(S,str) > 0; -} - -bool -operator<=(const Simstr & S, const char * str) -{ - return strcmp(S,str) <= 0; -} - -bool -operator>=(const Simstr & S, const char * str) -{ - return strcmp(S,str) >= 0; -} - -bool -operator==(const char * str, const Simstr & S) -{ - return strcmp(str,S) == 0; -} - -bool -operator!=(const char * str, const Simstr & S) -{ - return strcmp(str,S) != 0; -} - -bool -operator<(const char * str, const Simstr & S) -{ - return strcmp(str,S) < 0; -} - -bool -operator>(const char * str, const Simstr & S) -{ - return strcmp(str,S) > 0; -} - -bool -operator<=(const char * str, const Simstr & S) -{ - return strcmp(str,S) <= 0; -} - -bool -operator>=(const char * str, const Simstr & S) -{ - return strcmp(str,S) >= 0; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/sistr.hxx b/xml2cmp/source/support/sistr.hxx deleted file mode 100644 index de2000424202..000000000000 --- a/xml2cmp/source/support/sistr.hxx +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef XML2CMP_SISTR_HXX -#define XML2CMP_SISTR_HXX - - -class Simstr -{ -// INTERFACE - public: - // Constructors, destructor, '=' and typecasts - Simstr( - const char * str = 0); - Simstr( // Creates Simstr out of a copy of the described bytes within 'anyBytes'. - // Adds a '\0' at the end. - const char * anybytes, - int firstBytesPos, - int nrOfBytes); - virtual ~Simstr(); - Simstr( - const Simstr & S); - Simstr & operator=( - const Simstr & S); - operator const char*() const; - - // diverse utility functions - const char * str() const { return sz; } - char * s(); // CAUTION!!! // Only use when a function needs a 'char*' but - // still will NOT MODIFY THE STRING! - // Typecasts to 'const char*' are performed automatically. - int l() const; // Length of string without '\0' at end. - Simstr operator+( - const Simstr & S) const; - Simstr & operator+=( - const Simstr & S); - - // comparison operators - bool operator==( - const Simstr & S) const; - bool operator!=( - const Simstr & S) const; - bool operator<( - const Simstr & S) const; - bool operator>( - const Simstr & S) const; - bool operator<=( - const Simstr & S) const; - bool operator>=( - const Simstr & S) const; - - - // 'List of characters' - functions - // insert - functions - void push_front( - char c); - void push_back( - char c); - void push_front( - const Simstr & S); - void push_back( - const Simstr & S); - // remove - functions - void remove( - int pos, - int anzahl = 1); - void remove_trailing_blanks(); - - // search functions - int pos_first( - char c) const; - int pos_last( - char c) const; - bool is_empty() const; // Only true if object == "". - bool is_no_text() const; // String may contain spaces or tabs. - - // substitution functions - void replace_all( - char oldCh, - char newCh); - // token functions - // get...-functions return the token, separated by char 'c' and leave the object unchanged. - // take...-functions return the same, but remove the token and the corresponding separator from the object. - Simstr get_last_token( - char c) const; - - private: - char * sz; - int len; -}; - -// Simstr - char* / char - concatenations -Simstr operator+(const char * str, const Simstr & S); -Simstr operator+(const Simstr & S, const char * str); -Simstr operator+(char c, const Simstr & S); -Simstr operator+(const Simstr & S, char c); - -// Simstr - char* - comparison operators -bool operator==(const Simstr & S, const char * str); -bool operator!=(const Simstr & S, const char * str); -bool operator<(const Simstr & S, const char * str); -bool operator>(const Simstr & S, const char * str); -bool operator<=(const Simstr & S, const char * str); -bool operator>=(const Simstr & S, const char * str); -bool operator==(const char * str, const Simstr & S); -bool operator!=(const char * str, const Simstr & S); -bool operator<(const char * str, const Simstr & S); -bool operator>(const char * str, const Simstr & S); -bool operator<=(const char * str, const Simstr & S); -bool operator>=(const char * str, const Simstr & S); - - -inline char * -Simstr::s() { return sz; } -inline int -Simstr::l() const { return len; } -inline -Simstr::operator const char*() const { return sz; } -inline bool -Simstr::is_empty() const { return len == 0; } - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/syshelp.cxx b/xml2cmp/source/support/syshelp.cxx deleted file mode 100644 index 6cc915a68b12..000000000000 --- a/xml2cmp/source/support/syshelp.cxx +++ /dev/null @@ -1,307 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <syshelp.hxx> - - -// 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 - - -char C_sSpaceInName[] = " "; - -void -WriteName( std::ostream & o_rFile, - const Simstr & i_rIdlDocuBaseDir, - const Simstr & i_rName, - E_LinkType i_eLinkType ) -{ - if (i_rName.l() == 0) - return; - - - const char * pNameEnd = strstr( i_rName.str(), " in " ); - - // No link: - if ( i_eLinkType == lt_nolink ) - { - if ( pNameEnd != 0 ) - { - const char * pStart = i_rName.str(); - o_rFile.write( pStart, pNameEnd - pStart ); - WriteStr( o_rFile, C_sSpaceInName ); - WriteStr( o_rFile, pNameEnd ); - } - else - { - WriteStr( o_rFile, i_rName ); - } - return; - } - - if ( i_eLinkType == lt_idl ) - { - Simstr sPath(i_rName); - sPath.replace_all('.','/'); - int nNameEnd = sPath.pos_first(' '); - int nPathStart = sPath.pos_last(' '); - WriteStr( o_rFile, "<A HREF=\"" ); - - if ( nNameEnd > -1 ) - { - WriteStr( o_rFile, "file:///" ); - WriteStr( o_rFile, i_rIdlDocuBaseDir ); - WriteStr( o_rFile, "/" ); - WriteStr( o_rFile, sPath.str() + 1 + nPathStart ); - WriteStr( o_rFile, "/" ); - o_rFile.write( sPath.str(), nNameEnd ); - WriteStr( o_rFile, ".html\">" ); - } - else - { // Should not be reached: - WriteStr(o_rFile, i_rName); - return; - } - } - else if ( i_eLinkType == lt_html ) - { - int nKomma = i_rName.pos_first(','); - int nEnd = i_rName.pos_first(' '); - if ( nKomma > -1 ) - { - o_rFile.write( i_rName.str(), nKomma ); - WriteStr( o_rFile, ": " ); - - WriteStr( o_rFile, "<A HREF=\"" ); - - o_rFile.write( i_rName.str(), nKomma ); - WriteStr( o_rFile, ".html#" ); - if ( nEnd > -1 ) - o_rFile.write( i_rName.str() + nKomma + 1, nEnd - nKomma ); - else - WriteStr( o_rFile, i_rName.str() + nKomma + 1 ); - WriteStr( o_rFile, "\">" ); - - o_rFile.write( i_rName.str() + nKomma + 1, nEnd - nKomma ); - } - else - { - WriteStr( o_rFile, "<A HREF=\"" ); - WriteStr( o_rFile, i_rName ); - WriteStr( o_rFile, ".html\">" ); - - WriteStr( o_rFile, i_rName ); - } - WriteStr( o_rFile, "</A>" ); - return; - } - - if ( pNameEnd != 0 ) - { - const char * pStart = i_rName.str(); - if ( pNameEnd > pStart ) - o_rFile.write( pStart, pNameEnd - pStart ); - WriteStr( o_rFile, "</A>" ); - - WriteStr( o_rFile, C_sSpaceInName ); - WriteStr( o_rFile, pNameEnd ); - } - else - { - WriteStr( o_rFile, i_rName ); - WriteStr( o_rFile, "</A>" ); - } -} - - -void -WriteStr( std::ostream & o_rFile, - const char * i_sStr ) -{ - o_rFile.write( i_sStr, (int) strlen(i_sStr) ); -} - -void -WriteStr( std::ostream & o_rFile, - const Simstr & i_sStr ) -{ - 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) - std::cout << "." << std::flush; - - strcpy(sFilter, i_sSrcDirectory); // STRCPY SAFE HERE - strcat(sFilter,C_sXML_END); // STRCAT SAFE HERE - - 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) - std::cout << "." << std::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; - - 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 -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/syshelp.hxx b/xml2cmp/source/support/syshelp.hxx deleted file mode 100644 index 91c231bd9187..000000000000 --- a/xml2cmp/source/support/syshelp.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef X2C_SYSHELP_HXX -#define X2C_SYSHELP_HXX - - - -// USED SERVICES - // BASE CLASSES - // COMPONENTS - // PARAMETERS -#include <iosfwd> - -class Simstr; -template <class XY> class List; - - -#if defined(WNT) -const char C_sSLASH[] = "\\"; -const char C_cSLASH = '\\'; -#elif defined(UNX) -const char C_sSLASH[] = "/"; -const char C_cSLASH = '/'; -#else -#error Must run under unix or windows, please define UNX or WNT. -#endif - -enum E_LinkType -{ - lt_nolink = 0, - lt_idl, - lt_html -}; - - -void WriteName( - std::ostream & o_rFile, - const Simstr & i_rIdlDocuBaseDir, - const Simstr & i_rName, - E_LinkType i_eLinkType ); - - -void WriteStr( - std::ostream & o_rFile, - const char * i_sStr ); -void WriteStr( - std::ostream & 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 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_html.cxx b/xml2cmp/source/xcd/cr_html.cxx deleted file mode 100644 index b268d14d04b3..000000000000 --- a/xml2cmp/source/xcd/cr_html.cxx +++ /dev/null @@ -1,261 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <fstream> -#include "cr_html.hxx" -#include "xmltree.hxx" -#include "../support/syshelp.hxx" - - - - -char C_sHtmlFileHeader1[] = - "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n" - "<HTML>\n" - "<HEAD>\n" - " <TITLE>"; - -char C_sHtmlFileHeader2[] = - "</TITLE>\n" - " <META NAME=\"GENERATOR\" CONTENT=\"xml2cmp\">\n" - "</HEAD>\n" - "<BODY BGCOLOR=\"#ffffff\">\n<P><BR></P>"; - - -char C_sHtmlFileFoot[] = "</BODY>\n</HTML>\n"; - - -HtmlCreator::HtmlCreator( const char * i_pOutputFileName, - const XmlElement & i_rDocument, - const Simstr & i_sIDL_BaseDirectory ) - : aFile(i_pOutputFileName, std::ios::out -#if defined(WNT) - | std::ios::binary -#endif - ), - rDocument(i_rDocument), - sIdl_BaseDirectory(i_sIDL_BaseDirectory) -{ - if ( !aFile ) - { - std::cerr << "Error: " << i_pOutputFileName << " could not be created." << std::endl; - exit(0); - } -} - -HtmlCreator::~HtmlCreator() -{ - aFile.close(); -} - -void -HtmlCreator::Run() -{ - WriteStr( C_sHtmlFileHeader1 ); - WriteStr( "ModuleDescription" ); - WriteStr( C_sHtmlFileHeader2 ); - - rDocument.Write2Html(*this); - - WriteStr( "<P><BR><BR></P>\n" ); - WriteStr( C_sHtmlFileFoot ); -} - -void -HtmlCreator::StartTable() -{ - WriteStr( "<P><BR></P>\n" ); - WriteStr( - "<TABLE WIDTH=95% BORDER=1 CELLSPACING=0 CELLPADDING=4>\n" - " <TBODY>\n" ); -} - -void -HtmlCreator::FinishTable() -{ - WriteStr( " </TBODY>\n" - "</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 = (unsigned)( pEnd - i_rElement.Data() ); - } - aFile.write( i_rElement.Data(), (int) 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::StartRow() -{ - WriteStr( " <TR VALIGN=TOP>\n" ); -} - -void -HtmlCreator::FinishRow() -{ - WriteStr( " </TR>\n" ); -} - -void -HtmlCreator::StartCell( const char * i_pWidth) -{ - WriteStr( " <TD WIDTH=" ); - WriteStr( i_pWidth ); - WriteStr( ">\n <P>" ); -} - -void -HtmlCreator::FinishCell() -{ - WriteStr( "</P>\n </TD>\n" ); -} - -void -HtmlCreator::WriteElementName( const Simstr & i_sName, - bool i_bStrong ) -{ - StartCell( "23%" ); - if (i_bStrong) - WriteStr( "<H4>" ); - WriteStr(i_sName); - if (i_bStrong) - WriteStr( "</H4>" ); - FinishCell(); -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_html.hxx b/xml2cmp/source/xcd/cr_html.hxx deleted file mode 100644 index a49f1bd43f56..000000000000 --- a/xml2cmp/source/xcd/cr_html.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef X2C_CR_HTML_HXX -#define X2C_CR_HTML_HXX - - -#include <string.h> -#include <fstream> -#include "../support/sistr.hxx" -#include "../support/syshelp.hxx" - - -class XmlElement; -class SglTextElement; -class MultipleTextElement; - - -class HtmlCreator -{ - public: - HtmlCreator( - const char * i_pOutputFileName, - 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 StartRow(); - void FinishRow(); - void StartCell( - const char * i_pWidth ); - void FinishCell(); - - void WriteElementName( - const Simstr & i_sName, - bool i_bStrong ); - void WriteStr( - const char * i_sStr ) - { aFile.write( i_sStr, (int) strlen(i_sStr) ); } - // DATA - std::ofstream aFile; - const XmlElement & rDocument; - Simstr sIdl_BaseDirectory; -}; - - - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_metho.cxx b/xml2cmp/source/xcd/cr_metho.cxx deleted file mode 100644 index 3927c029d505..000000000000 --- a/xml2cmp/source/xcd/cr_metho.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "cr_metho.hxx" - -#include <string.h> -#include <fstream> -#include <iostream> - - - -const char C_sFileHeader1[] - = "/* "; -const char C_sFileHeader2[] - = " */\r\n/* Implementation of component_getDescriptionFunc() */\r\n\r\n" - "#include <sal/types.h>\r\n\r\n"; -const char C_sFuncBegin[] - = "#ifdef __cplusplus\r\n" - "extern \"C\" {\r\n" - "#endif\r\n\r\n" - "const sal_Char * SAL_CALL\r\ncomponent_getDescriptionFunc()\r\n" - "{\r\n" - " return (const sal_Char*) \r\n" - " \""; -const char C_sFuncEnd[] = "\";\r\n" - "}\r\n\r\n" - "#ifdef __cplusplus\r\n" - "} /* end of extern \"C\" */\r\n" - "#endif\r\n"; - - -void -Create_AccessMethod( const char * i_pOutputFileName, - const char * i_sText ) -{ - const char * pText = i_sText; - const char * pTrans = 0; - const char sDescrLineChange[] = "\"\r\n \""; - int sDescrLen = (int) strlen(sDescrLineChange); - - std::ofstream aFile(i_pOutputFileName, std::ios::out -#if defined(WNT) - | std::ios::binary -#endif - ); - - - if ( !aFile ) - { - std::cerr << "Error: " << i_pOutputFileName << " could not be created." << std::endl; - return; - } - - aFile.write( C_sFileHeader1, (int) strlen(C_sFileHeader1) ); - aFile.write( i_pOutputFileName, (int) strlen(i_pOutputFileName) ); - aFile.write( C_sFileHeader2, (int) strlen(C_sFileHeader2) ); - aFile.write( C_sFuncBegin, (int) strlen(C_sFuncBegin) ); - - for ( pTrans = pText; *pTrans != '\0'; pTrans++ ) - { - switch (*pTrans) - { - case '"': aFile.write( "\\\"", 2); - break; - case '\n': aFile.write( "\\n", 2); - aFile.write( sDescrLineChange, sDescrLen); - break; - case '\r': aFile.write( "\\r", 2); - break; - default: aFile.write( pTrans, 1); - } - } /* end for */ - - aFile.write( C_sFuncEnd, (int) strlen(C_sFuncEnd) ); - - - aFile.close(); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_metho.hxx b/xml2cmp/source/xcd/cr_metho.hxx deleted file mode 100644 index 73e6b3ba6e24..000000000000 --- a/xml2cmp/source/xcd/cr_metho.hxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef CPV_CR_METHOD_H -#define CPV_CR_METHOD_H - - - -void Create_AccessMethod( - const char * i_pOutputFileName, - const char * i_sText ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/dependy.cxx b/xml2cmp/source/xcd/dependy.cxx deleted file mode 100644 index 66f99698cc4c..000000000000 --- a/xml2cmp/source/xcd/dependy.cxx +++ /dev/null @@ -1,218 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "dependy.hxx" -#include <iostream> -#include "../support/syshelp.hxx" -#include "../support/list.hxx" -#include "xmltree.hxx" -#include "parse.hxx" - - - -Simstr ShortName(const Simstr & i_rService); - - - -Service::Service( const char * i_sName ) - : sName(i_sName) - // aImplementations -{ -} - -ServiceInfo & -Service::AddImplementation( const char * i_sLibrary ) -{ - ServiceInfo * ret = new ServiceInfo(i_sLibrary); - aImplementations.push_back(ret); - return *ret; -} - -ServiceInfo::ServiceInfo( const char * i_sLibrary ) - : sImplementingLibrary(i_sLibrary) - // aNeededServices -{ -} - -void -ServiceInfo::AddDependency( const char * i_sNeededService ) -{ - aNeededServices.push_back(i_sNeededService); -} - -DependencyFinder::DependencyFinder() -{ -} - -DependencyFinder::~DependencyFinder() -{ - for (Map_Services::const_iterator aIter = aServices.begin(); aIter != aServices.end(); ++aIter) - delete aIter->second; -} - -void -DependencyFinder::GatherData( const char * i_sSearchDirectory ) -{ - List<Simstr> aFiles; - GatherFileNames( aFiles, i_sSearchDirectory ); - - for ( unsigned i = 0; i < aFiles.size(); ++i ) - { - ReadFile( aFiles[i].str() ); - } -} - -void -DependencyFinder::FindNeededServices( StringVector & o_rLibraries, - StringVector & o_rServices, - const Simstr & i_rService ) -{ - Map_Services::const_iterator itService = aServices.find(i_rService); - if ( itService == aServices.end() ) - { - std::cerr << "Error: Service \"" - << i_rService.str() - << "\" not found." - << std::endl; - return ; - } - - aResult_Libraries.erase( aResult_Libraries.begin(), aResult_Libraries.end() ); - aResult_Services.erase( aResult_Services.begin(), aResult_Services.end() ); - - Add2Result( *(*itService).second ); - - for ( std::set< Simstr >::const_iterator il = aResult_Libraries.begin(); - il != aResult_Libraries.end(); - ++il ) - { - o_rLibraries.push_back(*il); - } - - for ( std::set< Simstr >::const_iterator is = aResult_Services.begin(); - is != aResult_Services.end(); - ++is ) - { - o_rServices.push_back(*is); - } -} - -void -DependencyFinder::ReadFile( const char * i_sFilename ) -{ - ModuleDescription aModule; - X2CParser aParser(aModule); - - if ( !aParser.Parse(i_sFilename) ) - { - std::cerr << "Error: File \"" - << i_sFilename - << "\" could not be parsed." - << std::endl; - return; - } - - // GetResults: - Simstr sModule = aModule.ModuleName(); - - List < const MultipleTextElement* > aImplServices; - List < const MultipleTextElement* > aNeededServices; - - aModule.Get_SupportedServices(aImplServices); - aModule.Get_ServiceDependencies(aNeededServices); - - unsigned nImplServicesSize = aImplServices.size(); - unsigned nNeededServicesSize = aNeededServices.size(); - - for ( unsigned i = 0; i < nImplServicesSize; ++i ) - { - const MultipleTextElement & rImpl = *aImplServices[i]; - - unsigned nImplDataSize = rImpl.Size(); - for ( unsigned di = 0; di < nImplDataSize; ++di ) - { - Simstr sService = ShortName(rImpl.Data(di)); - Service * pService = aServices[sService]; - if (pService == 0) - { - pService = new Service(rImpl.Data(di)); - aServices[sService] = pService; - } - ServiceInfo & rSInfo = pService->AddImplementation(sModule); - - for ( unsigned n = 0; n < nNeededServicesSize; ++n ) - { - unsigned nNeededDataSize = aNeededServices[n]->Size(); - for ( unsigned dn = 0; dn < nNeededDataSize; ++dn ) - { - if (! aNeededServices[n]->Data(dn).is_no_text()) - rSInfo.AddDependency( ShortName(aNeededServices[n]->Data(dn)) ); - } // end for dn - } // end for n - } // end for di - } // end for i -} - -void -DependencyFinder::Add2Result( const Service & i_rService ) -{ - const ServiceInfo & rSInfo = i_rService.FirstImplementation(); - aResult_Libraries.insert(rSInfo.Library()); - - const ServiceInfo::List_NeededServices & rNeededs - = rSInfo.NeededServices(); - for ( StringVector::const_iterator it = rNeededs.begin(); - it != rNeededs.end(); - ++it ) - { - std::pair< std::set< Simstr >::iterator, bool > aInsertResult - = aResult_Services.insert(*it); - if (aInsertResult.second) - { // Needed service not yet known - Map_Services::const_iterator itFound = aServices.find(*it); - if ( itFound == aServices.end() ) - { - std::cerr << "Needed service \"" - << (*it).str() - << "\" not found," - << std::endl; - } - else - { - Add2Result( *(*itFound).second ); - } - } // endif (! aInsertResult.second) - } // end for (it) -} - - - -Simstr -ShortName(const Simstr & i_rService) -{ - const char * pStart = i_rService.str(); - const char * pEnd = strchr(pStart,' '); - if (pEnd != 0) - return Simstr(pStart, 0, int(pEnd-pStart)); - else - return i_rService; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/dependy.hxx b/xml2cmp/source/xcd/dependy.hxx deleted file mode 100644 index 8658eb48c937..000000000000 --- a/xml2cmp/source/xcd/dependy.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef X2C_DEPENDY_HXX -#define X2C_DEPENDY_HXX - - -#include <vector> -#include <map> -#include <set> -#include <../support/sistr.hxx> - -class Service; -class ServiceInfo; - -typedef std::vector< Simstr> StringVector; -typedef std::vector< ServiceInfo* > List_Implementations; -typedef std::map< Simstr, Service* > Map_Services; - -class Service -{ - public: - Service( - const char * i_sName ); - - ServiceInfo & AddImplementation( - const char * i_sLibrary ); /// That is: module-name. - - const Simstr & Name() const { return sName; } - const ServiceInfo & FirstImplementation() const - { return *aImplementations[0]; } - - private: - Simstr sName; - List_Implementations - aImplementations; -}; - -class ServiceInfo -{ - public: - typedef StringVector List_NeededServices; - - ServiceInfo( - const char * i_sLibrary ); - - void AddDependency( - const char * i_sNeededService ); - - const Simstr & Library() const { return sImplementingLibrary; } - const List_NeededServices & - NeededServices() const { return aNeededServices; } - - - private: - Simstr sImplementingLibrary; - List_NeededServices aNeededServices; -}; - - -class DependencyFinder -{ - public: - DependencyFinder(); - ~DependencyFinder(); - - void GatherData( - const char * i_sSearchDirectory ); - - void FindNeededServices( - StringVector & o_rLibraries, - StringVector & o_rServices, - const Simstr & i_rService ); - private: - void ReadFile( - const char * i_sFilename ); - void Add2Result( - const Service & i_rService ); - - // Data - Map_Services aServices; - - // Temporary data - std::set< Simstr > aResult_Libraries; - std::set< Simstr > aResult_Services; -}; - - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/filebuff.cxx b/xml2cmp/source/xcd/filebuff.cxx deleted file mode 100644 index b271a59d5b5a..000000000000 --- a/xml2cmp/source/xcd/filebuff.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifdef AIX -# undef _THREAD_SAFE -#endif - -#include "filebuff.hxx" - -#include <string.h> -#include <fstream> -#include <ctype.h> - - -bool -LoadXmlFile( Buffer & o_rBuffer, - const char * i_sXmlFilePath ) -{ - std::ifstream aXmlFile; - - aXmlFile.open(i_sXmlFilePath, std::ios::in -#if defined(WNT) - | std::ios::binary -#endif // WNT - ); - - if (! aXmlFile) - return false; - - // Prepare buffer: - aXmlFile.seekg(0, std::ios::end); - unsigned long nBufferSize = (unsigned long) aXmlFile.tellg(); - o_rBuffer.SetSize(nBufferSize + 1); - o_rBuffer.Data()[nBufferSize] = '\0'; - aXmlFile.seekg(0); - - // Read file: - aXmlFile.read(o_rBuffer.Data(), (int) nBufferSize); - bool ret = aXmlFile.good() != 0; - aXmlFile.close(); - return ret; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/filebuff.hxx b/xml2cmp/source/xcd/filebuff.hxx deleted file mode 100644 index 8dafd08d6779..000000000000 --- a/xml2cmp/source/xcd/filebuff.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef X2C_FILEBUFF_HXX -#define X2C_FILEBUFF_HXX - - -class Buffer -{ - public: - Buffer() : s(0) {} - ~Buffer() { if (s) delete [] s; } - operator const char *() const - { return s; } - char * Data() { return s; } - void SetSize( - unsigned long i_size ) - { if (s) delete [] s; s = new char [i_size]; } - private: - char * s; -}; - - -bool LoadXmlFile( - Buffer & o_rBuffer, - const char * i_sXmlFilePath ); - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/main.cxx b/xml2cmp/source/xcd/main.cxx deleted file mode 100644 index 21393d3c42de..000000000000 --- a/xml2cmp/source/xcd/main.cxx +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <iostream> -#include <fstream> -#include <stdio.h> - - -#include <string.h> -#include "../support/cmdline.hxx" -#include "cr_metho.hxx" -#include "cr_html.hxx" -#include "xmlelem.hxx" -#include "xmltree.hxx" -#include "parse.hxx" -#include "../support/syshelp.hxx" -#include "../support/heap.hxx" -#include "dependy.hxx" - - - -void StreamOut_TypeInfo( std::ostream& o_rOut, ModuleDescription& i_rData, - const char* i_sSeparator ) -{ - Heap aTypesHeap(12); - - // Gather types: - List< const MultipleTextElement * > aTypes; - i_rData.Get_Types(aTypes); - - for ( unsigned t = 0; t < aTypes.size(); ++t ) - { - unsigned i_max = aTypes[t]->Size(); - for ( unsigned i = 0; i < i_max; ++i ) - { - aTypesHeap.InsertValue( aTypes[t]->Data(i), "" ); - } // end for - } - - // Write types: - HeapItem * pLastHeapTop = 0; - for ( HeapItem * pHeapTop = aTypesHeap.ReleaseTop(); pHeapTop != 0; pHeapTop = aTypesHeap.ReleaseTop() ) - { - if (pLastHeapTop != 0) - { - if ( 0 == strcmp(pHeapTop->Key(), pLastHeapTop->Key()) ) - continue; - delete pLastHeapTop; - } - pLastHeapTop = pHeapTop; - - WriteStr( o_rOut, i_sSeparator ); - - const char * sEnd = strchr( pHeapTop->Key(), ' ' ); - if (sEnd != 0) - { - const char * sQuali = strrchr( pHeapTop->Key(), ' ' ) + 1; - WriteStr( o_rOut, sQuali ); - WriteStr( o_rOut, "." ); - o_rOut.write( pHeapTop->Key(), sEnd - pHeapTop->Key() ); - } - else - { - WriteStr( o_rOut, pHeapTop->Key() ); - } - } // end for - - if (pLastHeapTop != 0) - { - delete pLastHeapTop; - pLastHeapTop = 0; - } -} - -void Put2StdOut_TypeInfo( ModuleDescription& i_rData ) -{ - StreamOut_TypeInfo(std::cout, i_rData, " "); -} - -void Put2File_TypeInfo( const char* i_sOutputFile, ModuleDescription& i_rData ) -{ - std::ofstream aOut(i_sOutputFile, std::ios::out -#if defined(WNT) - | std::ios::binary -#endif - ); - if ( !aOut ) - { - std::cerr << "Error: " << i_sOutputFile << " could not be created." << std::endl; - return; - } - - Simstr sLibPrefix = i_rData.ModuleName(); - WriteStr( aOut, sLibPrefix ); - WriteStr( aOut, "_XML2CMPTYPES= "); - - StreamOut_TypeInfo(aOut, i_rData, "\t\\\n\t\t"); - - aOut.close(); -} - -void Create_TypeInfo( const char* o_sOutputFile, ModuleDescription& i_rData ) -{ - if ( strcmp(o_sOutputFile, "stdout") == 0 ) - { - Put2StdOut_TypeInfo(i_rData); - } - else - { - Put2File_TypeInfo(o_sOutputFile,i_rData); - } -} - -int Do_DepCommandLine(const CommandLine & i_rCommandLine) -{ - DependencyFinder aDependencies; - - aDependencies.GatherData(i_rCommandLine.DepPath()); - char sInput[500] = ""; - std::vector<Simstr> aLibs; - std::vector<Simstr> aServs; - - - std::cout - << "\nNow you can start to put in Service names.\n" - << "Please use correct case, but don't use namespaces.\n" - << "Just the Service's own name.\n\n" - << "To stop the program, put in a hashmark \"#\" + ENTER.\n" - << std::endl; - - do - { - sInput[0] = 0; - std::cin >> sInput; - Simstr sImplService(sInput); - if (*sInput != '#') - { - aLibs.erase( aLibs.begin(), aLibs.end() ); - aServs.erase( aServs.begin(), aServs.end() ); - - aDependencies.FindNeededServices( aLibs, aServs, sImplService ); - - std::cout << "\n\n\nNeeded libraries: " << std::endl; - for ( unsigned i = 0; i < aLibs.size(); ++i ) - { - std::cout << " " << aLibs[i].str() << std::endl; - } - std::cout << "\nNeeded services: " << std::endl; - for ( unsigned s= 0; s < aServs.size(); ++s ) - { - std::cout << " " << aServs[s].str() << std::endl; - } - std::cout << "\n\n" << std::endl; - } - } - while (*sInput != '#'); - - return 0; - -} - -int Do_SingleFileCommandLine(const CommandLine & i_rCommandLine) -{ - ModuleDescription aDescr; - X2CParser aParser(aDescr); - - // Load file and create Function-file - bool bLoadResult = aParser.LoadFile(i_rCommandLine.XmlSrcFile()); - if (! bLoadResult) - { - std::cerr << "Error: File " << i_rCommandLine.XmlSrcFile() << " could not be loaded." << std::endl; - return 1; - } - - if ( strlen(i_rCommandLine.FuncFile()) > 0 ) - { - Create_AccessMethod( i_rCommandLine.FuncFile(), aParser.PureText() ); - - std::cout << "File " - << i_rCommandLine.FuncFile() - << " with component_getDescriptionFunc() is created now." - << std::endl; - } - - // Parse - aParser.Parse(); - - // Produce output - if ( strlen(i_rCommandLine.HtmlFile()) > 0 ) - { - HtmlCreator aHtmlCreator( i_rCommandLine.HtmlFile(), - aDescr, - i_rCommandLine.IdlRootPath() ); - aHtmlCreator.Run(); - } - - if (strlen(i_rCommandLine.TypeInfoFile()) > 0) - { - Create_TypeInfo( i_rCommandLine.TypeInfoFile(), aDescr ); - } - - return 0; -}; - -int -#ifdef WNT -_cdecl -#endif -main( int argc, char* argv[] ) -{ - // Variables - CommandLine aCommandLine(argc, argv); - int ret = 0; - - if (! aCommandLine.IsOk()) - { - std::cerr << aCommandLine.ErrorText() << std::endl ; - return 1; - } - - if ( aCommandLine.IsDepCommand() ) - { - ret = Do_DepCommandLine(aCommandLine); - } - else - { - ret = Do_SingleFileCommandLine(aCommandLine); - } - return ret; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/parse.cxx b/xml2cmp/source/xcd/parse.cxx deleted file mode 100644 index fab09d926e36..000000000000 --- a/xml2cmp/source/xcd/parse.cxx +++ /dev/null @@ -1,440 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <parse.hxx> - -#include <string.h> -#include <iostream> -#include <xmlelem.hxx> - -#if (_MSC_VER >=1400) -#pragma warning(disable:4365) -#endif - -#ifdef UNX -#define strnicmp strncasecmp -#endif - - - -// NOT FULLY DEFINED SERVICES - - -X2CParser::X2CParser( XmlElement & o_rDocumentData ) - : // sFileName, - nFileLine(0), - pDocumentData(&o_rDocumentData), - // sWord, - text(0) -{ -} - -X2CParser::~X2CParser() -{ -} - - -bool -X2CParser::LoadFile( const char * i_sFilename ) -{ - sFileName = i_sFilename; - nFileLine = 1; - - // Load file: - if ( ! LoadXmlFile( aFile, i_sFilename ) ) - return false; - - // Test correct end: - const char * pLastTag = strrchr(aFile.operator const char *(),'<'); - if (pLastTag == 0) - return false; - 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(); - - // skip XML comment - Goto('<'); - if ( IsText("<!--") ) - Goto_And_Pass('>'); - - pDocumentData->Parse(*this); -} - -bool -X2CParser::Parse( const char * i_sFilename ) -{ - bool ret = LoadFile(i_sFilename); - if (ret) - Parse(); - return ret; -} - -void -X2CParser::Parse_XmlDeclaration() -{ - Goto('<'); - if ( IsText("<?xml") ) - { - Goto_And_Pass('>'); - } -} - -void -X2CParser::Parse_Doctype() -{ - Goto('<'); - if ( IsText("<!DOCTYPE") ) - Goto_And_Pass('>'); -} - -void -X2CParser::Parse_Sequence( DynamicList<XmlElement> & o_rElements, - const Simstr & i_sElementName ) -{ - CheckAndPassBeginTag(i_sElementName.str()); - - unsigned int i_max = o_rElements.size(); - for (unsigned i = 0; i < i_max; ++i) - { - o_rElements[i]->Parse(*this); - } // end for - - CheckAndPassEndTag(i_sElementName.str()); -} - -void -X2CParser::Parse_FreeChoice( DynamicList<XmlElement> & o_rElements ) -{ - unsigned nSize = o_rElements.size(); - - for ( bool bBreak = false; !bBreak; ) - { - bBreak = true; - for ( unsigned i = 0; i < nSize; ++i ) - { - 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_List( ListElement & o_rListElem ) -{ - - 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 ) -{ - - if ( ! CheckAndPassBeginTag(i_sElementName.str()) ) - return; - - // 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('<') ) - { - Simstr sNew; - Parse_Text(sNew, i_sElementName, i_bReverseName); - if (sNew.l() > 0) - o_rTexts.push_back(sNew); - } -} - -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(); - unsigned i; - - for ( Pass_White(); *text != '/'; Pass_White() ) - { - - Get_Attribute(sAttrValue, sAttrName); - - for ( i = 0; i < nSize; ++i ) - { - if ( i_rAttrNames[i] == sAttrName ) - { - o_rAttrValues[i] = sAttrValue; - break; - } - } - if (i == nSize) - SyntaxError("unknown attribute found"); - } - Move(2); -} - - -void -X2CParser::Get_Attribute( Simstr & o_rAttrValue, - Simstr & o_rAttrName ) -{ - GetTextTill( o_rAttrName, '='); - - while (*(++text) != '"') - { - if (*text == '\0') - SyntaxError("unexpected end of file"); - } - - ++text; - GetTextTill( o_rAttrValue, '"'); - ++text; -} - -bool -X2CParser::IsText( const char * i_sComparedText ) -{ - return strnicmp( text, i_sComparedText, strlen(i_sComparedText) ) == 0; -} - -bool -X2CParser::IsBeginTag( const char * i_sTagName ) -{ - return strnicmp( text+1, i_sTagName, strlen(i_sTagName) ) == 0 - && *text == '<'; -} - -bool -X2CParser::IsEndTag( const char * i_sTagName ) -{ - return strnicmp( text+2, i_sTagName, strlen(i_sTagName) ) == 0 - && strnicmp( text, "</", 2 ) == 0; -} - -void -X2CParser::Goto( char i_cNext ) -{ - while (*text != i_cNext) - { - TestCurChar(); - ++text; - } -} - -void -X2CParser::Goto_And_Pass( char i_cNext ) -{ - Goto(i_cNext); - ++text; -} - -void -X2CParser::Move( int i_nForward ) -{ - text += i_nForward; -} - -void -X2CParser::Pass_White() -{ - while (*text <= 32) - { - TestCurChar(); - ++text; - } -} - -void -X2CParser::GetTextTill( Simstr & o_rText, - char i_cEnd, - bool i_bReverseName ) -{ - char * pResult = &sWord[0]; - char * pSet; - - for ( pSet = pResult; - *text != i_cEnd; - ++text ) - { - TestCurChar(); - *pSet++ = *text; - } - - while ( *pResult < 33 && *pResult > 0 ) - ++pResult; - while ( pSet > pResult ? *(pSet-1) < 33 : false ) - pSet--; - *pSet = '\0'; - - - if (i_bReverseName) - { - const unsigned int nMaxLen = 1000; - if (strlen(pResult) < nMaxLen) - { - char * sBreak = strrchr(pResult,'.'); - if (sBreak != 0) - { - static char sScope[nMaxLen+10]; - static char sName[nMaxLen+10]; - - unsigned nScopeLen = sBreak - pResult; - strncpy ( sScope, pResult, nScopeLen ); // STRNCPY SAFE HERE - sScope[nScopeLen] = '\0'; - strcpy( sName, sBreak + 1 ); // STRCPY SAFE HERE - strcat( sName, " in " ); // STRCAT SAFE HERE - strcat( sName, sScope ); // STRCAT SAFE HERE - - o_rText = sName; - return; - } - } - } // endif (i_bReverseName) - - o_rText = &sWord[0]; -} - -bool -X2CParser::CheckAndPassBeginTag( const char * i_sElementName ) -{ - bool ret = true; - Goto('<'); - if ( ! IsBeginTag(i_sElementName) ) - SyntaxError( "unexpected element"); - if (IsAbsoluteEmpty()) - ret = false; - Goto_And_Pass('>'); - if (ret) - Pass_White(); - return ret; -} - -void -X2CParser::CheckAndPassEndTag( const char * i_sElementName ) -{ - Pass_White(); - if ( !IsEndTag(i_sElementName) ) - SyntaxError("missing or not matching end tag"); - Goto_And_Pass('>'); -} - -bool -X2CParser::IsAbsoluteEmpty() const -{ - const char * pEnd = strchr(text+1, '>'); - if (pEnd != 0) - { - if ( *(pEnd-1) == '/' ) - { - const char * pAttr = strchr(text+1, '"'); - if (pAttr == 0) - return true; - else if ( (pAttr-text) > (pEnd-text) ) - return true; - } - } - return false; -} - -void -X2CParser::SyntaxError( const char * i_sText ) -{ - std::cerr - << "Syntax error " - << i_sText - << " in file: " - << sFileName.str() - << " in line " - << nFileLine - << "." - << std::endl; - - exit(3); -} - -void -X2CParser::TestCurChar() -{ - if (*text == '\n') - nFileLine++; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/parse.hxx b/xml2cmp/source/xcd/parse.hxx deleted file mode 100644 index e0579e516651..000000000000 --- a/xml2cmp/source/xcd/parse.hxx +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef X2C_PARSE_HXX -#define X2C_PARSE_HXX - - - -// USED SERVICES - // BASE CLASSES - // COMPONENTS -#include "filebuff.hxx" -#include "../support/sistr.hxx" -#include "../support/list.hxx" - // PARAMETERS - - -class XmlElement; -class ListElement; - -class X2CParser -{ - public: - typedef XmlElement * (*F_CREATE)(const Simstr &); - - X2CParser( - XmlElement & o_rDocumentData ); - ~X2CParser(); - - 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 Get_Attribute( - Simstr & o_rAttrValue, - Simstr & o_rAttrName ); - bool IsText( - const char * i_sComparedText ); - bool IsBeginTag( - const char * i_sTagName ); - bool IsEndTag( - const char * i_sTagName ); - void Goto( - char i_cNext ); - void Goto_And_Pass( - char i_cNext ); - void Move( - int i_nForward ); - void Pass_White(); - void GetTextTill( - Simstr & o_rText, - char i_cEnd, - bool i_bReverseName = false ); - /// @return false in case of empty tag with no attributes. - bool CheckAndPassBeginTag( - const char * i_sElementName ); - void CheckAndPassEndTag( - const char * i_sElementName ); - /// @precond IsBeginTag() == true. - bool IsAbsoluteEmpty() const; - - - void SyntaxError( - const char * i_sText ); - void TestCurChar(); - - // DATA - Simstr sFileName; - unsigned nFileLine; - - Buffer aFile; - XmlElement * pDocumentData; - - char sWord[8192]; - const char * text; -}; - - - -// IMPLEMENTATION - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/xmlelem.cxx b/xml2cmp/source/xcd/xmlelem.cxx deleted file mode 100644 index 3ec6ec6a88ad..000000000000 --- a/xml2cmp/source/xcd/xmlelem.cxx +++ /dev/null @@ -1,251 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <xmlelem.hxx> - - -// NOT FULLY DEFINED SERVICES -#include <parse.hxx> -#include <cr_html.hxx> - -XmlElement::XmlElement( const char * i_sName ) - : sName(i_sName) -{ -} - -XmlElement * -MultipleElement::FindChild( const Simstr & i_sChildName ) -{ - unsigned i_max = aChildren.size(); - for ( unsigned i = 0; i < i_max; ++i ) - { - if ( aChildren[i]->Name() == i_sChildName ) - return aChildren[i]; - } - - return 0; -} - -MultipleElement::~MultipleElement() -{ -} - -MultipleElement::MultipleElement( const char * i_sName ) - : XmlElement(i_sName) -{ -} - -void -MultipleElement::AddChild( XmlElement & let_drElement ) -{ - aChildren.push_back(&let_drElement); -} - -void -SequenceElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_Sequence( Children(), Name() ); -} - -void -SequenceElement::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.StartTable(); - - Children()[nIndexNameElement]->Write2Html(io_rHC); - for ( unsigned i = 0; i < Children().size(); ++i ) - { - if (i != nIndexNameElement) - { - Children()[i]->Write2Html(io_rHC); - } - } // end for - - io_rHC.FinishTable(); -} - - -SequenceElement::SequenceElement( const char * i_sName, - unsigned i_nIndexNameElement ) - : MultipleElement(i_sName), - nIndexNameElement(i_nIndexNameElement) -{ -} - -FreeChoiceElement::FreeChoiceElement() - : MultipleElement("") -{ -} - -void -FreeChoiceElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_FreeChoice(Children()); -} - -void -FreeChoiceElement::Write2Html( HtmlCreator & io_rHC ) const -{ - for ( unsigned i = 0; i < Children().size(); ++i ) - { - Children()[i]->Write2Html(io_rHC); - } // end for -} - -ListElement::ListElement( const char * i_sElementsName, - F_CREATE i_fCreateNewElement ) - : MultipleElement(i_sElementsName), - fCreateNewElement(i_fCreateNewElement) -{ -} - -void -ListElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_List( *this ); -} - -void -ListElement::Write2Html( HtmlCreator & io_rHC ) const -{ - for ( unsigned i = 0; i < Children().size(); ++i ) - { - Children()[i]->Write2Html(io_rHC); - } // end for -} - -XmlElement * -ListElement::Create_and_Add_NewElement() -{ - XmlElement * pNew = (*fCreateNewElement)(Name()); - Children().push_back( pNew ); - return pNew; -} - -TextElement::TextElement( const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ) - : XmlElement(i_sName), - eLinkType(i_eLinkType), - bReverseName(i_bReverseName) -{ -} - -SglTextElement::SglTextElement( const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ) - : TextElement(i_sName, i_eLinkType, i_bReverseName) -{ -} - -void -SglTextElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_Text(sContent, Name(), IsReversedName()); -} - -void -SglTextElement::Write2Html( HtmlCreator & io_rHC ) const -{ - if ( !sContent.is_no_text() ) - io_rHC.Write_SglTextElement( *this ); -} - -MultipleTextElement::MultipleTextElement( const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ) - : TextElement(i_sName, i_eLinkType, i_bReverseName) -{ -} - -void -MultipleTextElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_MultipleText(aContent, Name(), IsReversedName()); -} - -void -MultipleTextElement::Write2Html( HtmlCreator & io_rHC ) const -{ - if (Size() > 0) - io_rHC.Write_MultiTextElement( *this ); -} - -const Simstr & -MultipleTextElement::Data( unsigned i_nNr ) const -{ - static const Simstr sNull_; - - if (aContent.is_valid_index(i_nNr)) - return aContent[i_nNr]; - return sNull_; -} - -EmptyElement::EmptyElement( const char * i_sName ) - : XmlElement(i_sName) -{ -} - -SglAttrElement::SglAttrElement( const char * i_sName, - const char * i_sAttrName ) - : EmptyElement(i_sName), - sAttrName(i_sAttrName) -{ -} - -void -SglAttrElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_SglAttr(sAttrValue, Name(), sAttrName); -} - -void -SglAttrElement::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.Write_SglText( Name(), sAttrValue ); -} - -MultipleAttrElement::MultipleAttrElement( const char * i_sName, - const char ** i_sAttrNames, - unsigned i_nSize ) - : EmptyElement(i_sName) -{ - for ( unsigned i = 0; i < i_nSize; ++i ) - { - aAttrNames.push_back(Simstr(i_sAttrNames[i])); - aAttrValues.push_back(Simstr("")); - } -} - -void -MultipleAttrElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_MultipleAttr(aAttrValues, Name(), aAttrNames); -} - -void -MultipleAttrElement::Write2Html( HtmlCreator & io_rHC ) const -{ - if ( ! aAttrValues[0].is_no_text() ) - io_rHC.Write_ReferenceDocu( Name(), aAttrValues[0], aAttrValues[1], aAttrValues[2] ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/xmlelem.hxx b/xml2cmp/source/xcd/xmlelem.hxx deleted file mode 100644 index c25e10a8c02b..000000000000 --- a/xml2cmp/source/xcd/xmlelem.hxx +++ /dev/null @@ -1,229 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef X2C_XMLELEM_HXX -#define X2C_XMLELEM_HXX - - - -// USED SERVICES - // BASE CLASSES - // COMPONENTS -#include "../support/sistr.hxx" -#include "../support/list.hxx" -#include "../support/syshelp.hxx" - // PARAMETERS - - -class X2CParser; -class HtmlCreator; - -class XmlElement -{ - public: - virtual ~XmlElement() {} - virtual void Parse( - X2CParser & io_rParser ) = 0; - virtual void Write2Html( - HtmlCreator & io_rHC ) const = 0; - - const Simstr & Name() const { return sName; } - - protected: - XmlElement( - const char * i_sName ); - private: - Simstr sName; -}; - - -class MultipleElement : public XmlElement -{ - public: - ~MultipleElement(); - - virtual XmlElement * - FindChild( - const Simstr & i_sChildName ); - - - protected: - typedef DynamicList<XmlElement> ChildList; - - MultipleElement( - const char * i_sName ); - - void AddChild( - XmlElement & let_drElement ); - - const ChildList & Children() const { return aChildren; } - ChildList & Children() { return aChildren; } - - private: - ChildList aChildren; -}; - -class SequenceElement : public MultipleElement -{ - public: - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - - protected: - SequenceElement( - const char * i_sName, - unsigned i_nIndexNameElement = 0 ); - private: - unsigned nIndexNameElement; -}; - -class FreeChoiceElement : public MultipleElement -{ - public: - FreeChoiceElement(); - using MultipleElement::AddChild; - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; -}; - -class ListElement : public MultipleElement -{ - public: - typedef XmlElement * (*F_CREATE)(const Simstr &); - - ListElement( - const char * i_sElementsName, - F_CREATE i_fCreateNewElement ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - virtual XmlElement * - Create_and_Add_NewElement(); - private: - F_CREATE fCreateNewElement; -}; - -class TextElement : public XmlElement -{ - public: - E_LinkType LinkType() const { return eLinkType; } - bool IsReversedName() const { return bReverseName; } - protected: - TextElement( - const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ); - private: - E_LinkType eLinkType; - bool bReverseName; -}; - -class SglTextElement : public TextElement -{ - public: - SglTextElement( - const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - virtual const Simstr & - Data() const { return sContent; } - private: - Simstr sContent; -}; - -class MultipleTextElement : public TextElement -{ - public: - MultipleTextElement( - const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - virtual const Simstr & - Data( - unsigned i_nNr ) const; - virtual unsigned Size() const { return aContent.size(); } - - private: - List<Simstr> aContent; -}; - -class EmptyElement : public XmlElement -{ - protected: - EmptyElement( - const char * i_sName ); -}; - -class SglAttrElement : public EmptyElement -{ - public: - SglAttrElement( - const char * i_sName, - const char * i_sAttrName ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - private: - Simstr sAttrName; - Simstr sAttrValue; -}; - - -class MultipleAttrElement : public EmptyElement -{ - public: - MultipleAttrElement( - const char * i_sName, - const char ** i_sAttrNames, - unsigned i_nSize ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - private: - List<Simstr> aAttrNames; - List<Simstr> aAttrValues; -}; - -// IMPLEMENTATION - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/xmltree.cxx b/xml2cmp/source/xcd/xmltree.cxx deleted file mode 100644 index 0626374e47d9..000000000000 --- a/xml2cmp/source/xcd/xmltree.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <xmltree.hxx> - - -// NOT FULLY DEFINED SERVICES -#include <cr_html.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 -ModuleDescription::Get_SupportedServices( List< const MultipleTextElement * > & o_rServices ) const -{ - 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::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 -CompDescrList::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.StartBigCell(C_sCompDescrListTitle); - ListElement::Write2Html(io_rHC); - io_rHC.FinishBigCell(); -} - -XmlElement * -CompDescrList::Create_and_Add_NewElement() -{ - ComponentDescription * pCD = new ComponentDescription; - Children().push_back(pCD); - aCDs.push_back(pCD); - return pCD; -} - -void -CompDescrList::Get_SupportedServices( 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]->SupportedServices()); - } // end for -} - -void -CompDescrList::Get_Types( 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]->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 -} - -MdName::MdName() - : SglTextElement(C_sModuleName, lt_html, false) -{ -} - -void -MdName::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.Write_SglTextElement( *this, true ); -} - -CdName::CdName() - : SglTextElement(C_sName, lt_html, true) -{ -} - -void -CdName::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.Write_SglTextElement( *this, true ); -} - -SupportedService::SupportedService() - : MultipleTextElement(C_sSupportedService, lt_idl, true) -{ -} - -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; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/xmltree.hxx b/xml2cmp/source/xcd/xmltree.hxx deleted file mode 100644 index 3fe5d594d11f..000000000000 --- a/xml2cmp/source/xcd/xmltree.hxx +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef X2C_XMLTREE_HXX -#define X2C_XMLTREE_HXX - - - -// USED SERVICES - // BASE CLASSES -#include "xmlelem.hxx" - // COMPONENTS -#include "../support/sistr.hxx" -#include "../support/list.hxx" - // PARAMETERS - - -class CompDescrList; - -class ModuleDescription : public SequenceElement -{ - public: - 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: - SglTextElement * pModuleName; - CompDescrList * pCdList; - MultipleTextElement * - pTypes; - MultipleTextElement * - pServiceDependencies; -}; - - -class ComponentDescription : public SequenceElement -{ - public: - 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: - SglTextElement * pComponentName; - MultipleTextElement * - pSupportedServices; - MultipleTextElement * - pTypes; - MultipleTextElement * - pServiceDependencies; -}; - -class CompDescrList : public ListElement -{ - public: - 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: - List< ComponentDescription * > - aCDs; -}; - -class MdName : public SglTextElement -{ - public: - MdName(); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; -}; - -class CdName : public SglTextElement -{ - public: - CdName(); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; -}; - -class SupportedService : public MultipleTextElement -{ - public: - SupportedService(); -}; - - -// IMPLEMENTATION - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |