summaryrefslogtreecommitdiff
path: root/xml2cmp
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 14:29:57 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 14:29:57 +0000
commit41b1169be44061d52201e532982448a081a40645 (patch)
treee84be89cba249e830beb982098e960e2c6e2ae0f /xml2cmp
parent215e8c7210756d6d9033f8d742a6cd0e9be132aa (diff)
initial import
Diffstat (limited to 'xml2cmp')
-rw-r--r--xml2cmp/prj/d.lst2
-rw-r--r--xml2cmp/source/inc/lst_str.h133
-rw-r--r--xml2cmp/source/inc/new_del.h89
-rw-r--r--xml2cmp/source/inc/precomp.h89
-rw-r--r--xml2cmp/source/inc/str.h105
-rw-r--r--xml2cmp/source/inc/textbuff.h119
-rw-r--r--xml2cmp/source/inc/textfile.h110
-rw-r--r--xml2cmp/source/x2cclass/x2cstl.hxx81
-rw-r--r--xml2cmp/source/x2cclass/xml_cd.hxx119
-rw-r--r--xml2cmp/source/x2cclass/xml_cdff.cxx265
-rw-r--r--xml2cmp/source/x2cclass/xml_cdff.hxx138
-rw-r--r--xml2cmp/source/x2cclass/xml_cdim.cxx217
-rw-r--r--xml2cmp/source/x2cclass/xml_cdim.hxx147
13 files changed, 1614 insertions, 0 deletions
diff --git a/xml2cmp/prj/d.lst b/xml2cmp/prj/d.lst
new file mode 100644
index 000000000..868797deb
--- /dev/null
+++ b/xml2cmp/prj/d.lst
@@ -0,0 +1,2 @@
+..\%__SRC%\bin\xml2cmp.exe %_DEST%\bin%_EXT%\xml2cmp.exe
+..\%__SRC%\bin\xml2cmp %_DEST%\bin%_EXT%\xml2cmp
diff --git a/xml2cmp/source/inc/lst_str.h b/xml2cmp/source/inc/lst_str.h
new file mode 100644
index 000000000..68c36d949
--- /dev/null
+++ b/xml2cmp/source/inc/lst_str.h
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * $RCSfile: lst_str.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CPV_LST_STR_H
+#define CPV_LST_STR_H
+
+#include "str.h"
+
+
+typedef struct LSElem
+{
+ Cstring * pData;
+ struct LSElem * pNext;
+} LSElem;
+
+
+typedef struct LSIterator
+{
+ LSElem * pElement;
+} LSIterator;
+
+
+typedef struct ListCstring
+{
+ LSElem * dpStart;
+ LSElem * pEnd;
+ Bool bAutoDeleteData;
+} ListCstring;
+
+
+#define ListCstring_THIS ListCstring * pThis
+#define LSIterator_THIS LSIterator * pThis
+#define LSElem_THIS LSElem * pThis
+
+
+
+void ListCstring_CTOR( ListCstring_THIS,
+ Bool i_bAutoDeleteData );
+void ListCstring_DTOR( ListCstring_THIS );
+
+void LS_Add( ListCstring_THIS,
+ Cstring * i_pData );
+void LS_Empty( ListCstring_THIS,
+ Bool i_bDeleteData );
+void LS_Append( ListCstring_THIS,
+ char * i_sStrings[],
+ intt i_nNrOfStrings );
+Bool LS_IsEmpty( ListCstring_THIS );
+
+LSIterator LS_Begin( ListCstring_THIS );
+
+
+void LSIterator_CTOR( LSIterator_THIS,
+ LSElem * i_pElement );
+void LSI_opp( LSIterator_THIS ); /** operator++() */
+
+Bool LSI_obool( LSIterator_THIS );
+Cstring * LSI_optr( LSIterator_THIS ); /** operator->() */
+
+
+void LSElem_CTOR( LSElem_THIS,
+ Cstring * i_pData );
+void LSElem_DTOR( LSElem_THIS );
+
+Cstring * LSE_Data( LSElem_THIS );
+LSElem * LSE_Next( LSElem_THIS );
+
+void LSE_SetNext( LSElem_THIS,
+ LSElem * i_pNext );
+void LSE_DeleteData( LSElem_THIS );
+
+
+
+#endif
+
diff --git a/xml2cmp/source/inc/new_del.h b/xml2cmp/source/inc/new_del.h
new file mode 100644
index 000000000..152372f01
--- /dev/null
+++ b/xml2cmp/source/inc/new_del.h
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * $RCSfile: new_del.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CPV_NEW_DEL_H
+#define CPV_NEW_DEL_H
+
+
+void * New(
+ intt i_nSize );
+void Delete(
+ void * io_pMemory );
+
+/* at ASSIGN_NEW ptr must be an L-Value. */
+#define ASSIGN_NEW( ptr, type ) \
+ { ptr = New( sizeof( type ) ); type##_CTOR( ptr ); }
+
+#define ASSIGN_NEW1( ptr, type, param1 ) \
+ { ptr = New( sizeof( type ) ); type##_CTOR( ptr, param1 ); }
+
+#define ASSIGN_NEW2( ptr, type, param1, param2 ) \
+ { ptr = New( sizeof( type ) ); type##_CTOR( ptr, param1, param2 ); }
+
+#define ASSIGN_NEW3( ptr, type, param1, param2, param3 ) \
+ { ptr = New( sizeof( type ) ); type##_CTOR( ptr, param1, param2, param3 ); }
+
+#define DELETE( ptr, type ) \
+ { type##_DTOR( ptr ); Delete(ptr); }
+
+#endif
+
+
diff --git a/xml2cmp/source/inc/precomp.h b/xml2cmp/source/inc/precomp.h
new file mode 100644
index 000000000..2cf32b05f
--- /dev/null
+++ b/xml2cmp/source/inc/precomp.h
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * $RCSfile: precomp.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CPV_PRECOMP_H
+#define CPV_PRECOMP_H
+
+#define _NO_BOOL_TYPE_
+
+typedef short Bool;
+#define True 1
+#define False 0
+
+
+
+typedef long intt;
+
+#define AND &&
+#define OR ||
+#define NOT !
+
+
+#define REF( x ) (&(x))
+#define MREF( x ) (&(pThis->x))
+#define THIS_ pThis
+
+
+
+#endif
+
+
+
diff --git a/xml2cmp/source/inc/str.h b/xml2cmp/source/inc/str.h
new file mode 100644
index 000000000..6c2498edd
--- /dev/null
+++ b/xml2cmp/source/inc/str.h
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * $RCSfile: str.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CPV_STR_H
+#define CPV_STR_H
+
+
+#ifdef UNX
+#define stricmp(str1,str2) strcasecmp(str1, str2)
+#define strnicmp(str1,str2,n) strncasecmp(str1, str2, n)
+#endif
+
+
+typedef struct Cstring
+{
+ char * dpText;
+ intt nLength;
+
+} Cstring;
+
+#define Cstring_THIS Cstring * pThis
+
+
+void Cstring_CTOR( Cstring_THIS,
+ char * pText );
+void Cstring_DTOR( Cstring * pThis );
+
+void Cs_Assign( Cstring_THIS,
+ char * i_pNewText );
+void Cs_AssignPart( Cstring_THIS,
+ char * i_pNewText,
+ intt i_nLength );
+
+void Cs_AddCs( Cstring_THIS,
+ Cstring * i_pAddedText );
+void Cs_Add( Cstring_THIS,
+ char * i_pAddedText );
+
+char * Cs_Str( Cstring_THIS );
+intt Cs_Length( Cstring_THIS );
+
+void Cs_ToUpper( Cstring_THIS );
+
+
+
+#endif
+
diff --git a/xml2cmp/source/inc/textbuff.h b/xml2cmp/source/inc/textbuff.h
new file mode 100644
index 000000000..01aca8d86
--- /dev/null
+++ b/xml2cmp/source/inc/textbuff.h
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * $RCSfile: textbuff.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CTLS_TEXTBUFF_H
+#define CTLS_TEXTBUFF_H
+
+#include "textfile.h"
+
+
+typedef struct TextBuffer
+{
+ char * dpText;
+ intt nSize;
+
+ intt nPosition;
+
+} TextBuffer;
+
+#define TextBuffer_THIS TextBuffer * pThis
+
+
+#define ENDS '\0'
+#define ENDL '\n'
+
+typedef enum E_TB_Relation
+{
+ tb_begin,
+ tb_cur,
+ tb_end
+} E_TB_Relation;
+
+
+void TextBuffer_CTOR( TextBuffer_THIS,
+ intt i_nSize );
+void TextBuffer_DTOR( TextBuffer_THIS );
+void TB_Resize( TextBuffer_THIS,
+ intt i_nNewSize );
+
+Bool TB_oin( TextBuffer_THIS, /** operator>>(char *) */
+ char * i_pText );
+Bool TB_oinChar( TextBuffer_THIS, /** operator>>(char) */
+ char i_cChar );
+Bool TB_oinFile( TextBuffer_THIS, /** operator>>(TextFile*) */
+ TextFile * i_pFile );
+void TB_opp( TextBuffer_THIS ); /** operator++ */
+
+intt TB_Goto( TextBuffer_THIS,
+ intt i_nPosition,
+ E_TB_Relation i_nRelation ); /** tb_begin, tb_cur, tb_end */
+
+
+char * TB_Text( TextBuffer_THIS );
+char TB_CurChar( TextBuffer_THIS );
+char * TB_CurCharPtr( TextBuffer_THIS );
+intt TB_Size( TextBuffer_THIS );
+intt TB_Position( TextBuffer_THIS );
+Bool TB_EndOfBuffer( TextBuffer_THIS );
+
+
+#endif
+
diff --git a/xml2cmp/source/inc/textfile.h b/xml2cmp/source/inc/textfile.h
new file mode 100644
index 000000000..f0d229e75
--- /dev/null
+++ b/xml2cmp/source/inc/textfile.h
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * $RCSfile: textfile.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef CPV_TEXTFILE_H
+#define CPV_TEXTFILE_H
+
+#include <stdio.h>
+#include "str.h"
+
+
+
+typedef struct TextFile
+{
+ Cstring sName;
+ FILE * hFile;
+ intt nLastAction;
+} TextFile;
+
+#define TextFile_THIS TextFile * pThis
+
+
+
+void TextFile_CTOR( TextFile_THIS,
+ char * i_pName );
+void TextFile_DTOR( TextFile_THIS );
+
+Bool TF_Open( TextFile_THIS,
+ char * i_sOptions ); /* options for second parameter of fopen */
+Bool TF_Create( TextFile_THIS );
+void TF_Close( TextFile_THIS );
+
+void TF_Goto( TextFile_THIS,
+ intt i_nPosition );
+intt TF_Read( TextFile_THIS,
+ char * o_pBuffer,
+ intt i_nNrOfBytes );
+intt TF_Write( TextFile_THIS,
+ char * i_pBuffer,
+ intt i_nNrOfBytes );
+intt TF_WriteStr( TextFile_THIS,
+ char * i_pString );
+
+intt TF_Position( TextFile_THIS );
+intt TF_Size( TextFile_THIS );
+
+
+
+
+#endif
+
+
+
diff --git a/xml2cmp/source/x2cclass/x2cstl.hxx b/xml2cmp/source/x2cclass/x2cstl.hxx
new file mode 100644
index 000000000..e3f649bb3
--- /dev/null
+++ b/xml2cmp/source/x2cclass/x2cstl.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: x2cstl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef UDKSERVICE_X2CSTL_HXX
+#define UDKSERVICE_X2CSTL_HXX
+
+
+#if STLPORT_VERSION < 321
+#include <tools/presys.h>
+#include <vector.h>
+#include <tools/postsys.h>
+#else
+#include <vector>
+#endif // STLPORT_VERSION < 321
+
+#ifdef _USE_NO_NAMERSPACES_
+#define std
+#endif
+
+
+#endif
+
+
diff --git a/xml2cmp/source/x2cclass/xml_cd.hxx b/xml2cmp/source/x2cclass/xml_cd.hxx
new file mode 100644
index 000000000..8d86fd1a1
--- /dev/null
+++ b/xml2cmp/source/x2cclass/xml_cd.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * $RCSfile: xml_cd.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef UDKSERVICE_XML_CD_HXX
+#define UDKSERVICE_XML_CD_HXX
+
+
+#include <tools/string.hxx>
+#include "x2cstl.hxx"
+
+
+
+/** Represents one Component description from an XML file.
+ DatumOf() is used for tags with only one value.
+ DataOf() is used, if the tag has multiple values or if
+ you don't know.
+**/
+class ComponentDescription
+{
+ public:
+ /** @ATTENTION
+ Because the enum values are used as array indices:
+ tag_None must be the first and have the value "0".
+ tag_MAX must be the last.
+ The enum values must not be assigned numbers.
+ **/
+ enum E_Tag
+ {
+ tag_None = 0,
+ tag_Name,
+ tag_Description,
+ tag_ModuleName,
+ tag_LoaderName,
+ tag_SupportedService,
+ tag_ProjectBuildDependency,
+ tag_RuntimeModuleDependency,
+ tag_ServiceDependency,
+ tag_Language,
+ tag_Status,
+ tag_Type,
+ tag_MAX
+ };
+
+ virtual ~ComponentDescription() {}
+
+ /// @return All values of this tag. An empty vector for wrong indices.
+ virtual const std::vector< ByteString > &
+ DataOf(
+ ComponentDescription::E_Tag
+ i_eTag ) const = 0;
+
+ /// @return The only or the first value of this tag. An empty string for wrong indices.
+ virtual ByteString DatumOf(
+ ComponentDescription::E_Tag
+ i_eTag ) const = 0;
+};
+
+
+#endif
+
+
diff --git a/xml2cmp/source/x2cclass/xml_cdff.cxx b/xml2cmp/source/x2cclass/xml_cdff.cxx
new file mode 100644
index 000000000..c79d31661
--- /dev/null
+++ b/xml2cmp/source/x2cclass/xml_cdff.cxx
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * $RCSfile: xml_cdff.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "xml_cdff.hxx"
+
+#include <string.h>
+#include <tools/stream.hxx>
+#include "xml_cdim.hxx"
+#include <ctype.h>
+
+
+typedef ComponentDescriptionImpl::ValueList CdiValueList;
+
+class dyn_buffer
+{
+ public:
+ dyn_buffer() : s(0) {}
+ ~dyn_buffer() { if (s) delete [] s; }
+ operator const char *() const { return s; }
+ char * operator->() { return s; }
+ char & operator[](
+ INT32 ix ) { return s[ix]; }
+ void SetSize(
+ INT32 i_size ) { if (s) delete [] s; s = new char [i_size]; }
+ private:
+ char * s;
+};
+
+
+inline BOOL
+LoadXmlFile( dyn_buffer & o_rBuffer,
+ const UniString & i_sXmlFilePath )
+{
+ BOOL ret = TRUE;
+ SvFileStream aXmlFile;
+
+ aXmlFile.Open(i_sXmlFilePath, STREAM_READ);
+ if (aXmlFile.GetErrorCode() != FSYS_ERR_OK)
+ ret = FALSE;
+ if (ret)
+ {
+ aXmlFile.Seek(STREAM_SEEK_TO_END);
+ INT32 nBufferSize = aXmlFile.Tell();
+ o_rBuffer.SetSize(nBufferSize + 1);
+ o_rBuffer[nBufferSize] = '\0';
+ aXmlFile.Seek(0);
+ if (aXmlFile.Read(o_rBuffer.operator->(), nBufferSize) == 0)
+ ret = FALSE;
+ }
+
+ aXmlFile.Close();
+ return ret;
+}
+
+
+
+CompDescrsFromAnXmlFile::CompDescrsFromAnXmlFile()
+ : dpDescriptions(new std::vector< ComponentDescriptionImpl* >),
+ eStatus(not_yet_parsed)
+{
+ dpDescriptions->reserve(3);
+}
+
+CompDescrsFromAnXmlFile::~CompDescrsFromAnXmlFile()
+{
+ Empty();
+ delete dpDescriptions;
+}
+
+
+BOOL
+CompDescrsFromAnXmlFile::Parse( const UniString & i_sXmlFilePath )
+{
+ dyn_buffer dpBuffer;
+
+ if (! LoadXmlFile(dpBuffer,i_sXmlFilePath) )
+ {
+ eStatus = cant_read_file;
+ return FALSE;
+ }
+
+ const char * pTokenStart = 0;
+ const char * pBufferPosition = dpBuffer;
+ INT32 nTokenLength = 0;
+ BOOL bWithinElement = FALSE;
+
+ CdiValueList * pCurTagData = 0;
+ ByteString sStatusValue; // Used only if a <Status ...> tag is found.
+
+
+ for ( ComponentDescriptionImpl::ParseUntilStartOfDescription(pBufferPosition);
+ pBufferPosition != 0;
+ ComponentDescriptionImpl::ParseUntilStartOfDescription(pBufferPosition) )
+ {
+ ComponentDescriptionImpl * pCurCD = 0;
+ pCurCD = new ComponentDescriptionImpl;
+ dpDescriptions->push_back(pCurCD);
+
+ for ( ; *pBufferPosition != '\0' && pCurCD != 0; )
+ {
+ switch (*pBufferPosition)
+ {
+ case '<' :
+ if (! bWithinElement)
+ {
+ pCurTagData = pCurCD->GetBeginTag(sStatusValue, pBufferPosition);
+ if (pCurTagData != 0)
+ {
+ if (sStatusValue.Len () == 0)
+ {
+ // Start new token:
+ pTokenStart = pBufferPosition;
+ nTokenLength = 0;
+ bWithinElement = TRUE;;
+ }
+ else
+ {
+ // Status tag is already parsed:
+ pCurTagData->push_back(sStatusValue);
+ } // endif (sStatusValue.Length () == 0)
+ }
+ else if ( ComponentDescriptionImpl::CheckEndOfDescription(pBufferPosition) )
+ {
+ pBufferPosition += ComponentDescriptionImpl::DescriptionEndTagSize();
+ pCurCD = 0;
+ }
+ else
+ {
+ eStatus = inconsistent_file;
+ return FALSE;
+ } // endif (pCurTagData != 0) elseif() else
+ }
+ else if ( pCurTagData->MatchesEndTag(pBufferPosition) )
+ {
+ // Finish token:
+ pBufferPosition += pCurTagData->EndTagLength();
+ bWithinElement = FALSE;
+
+ // Remove leading and trailing spaces:
+ while ( isspace(*pTokenStart) )
+ {
+ pTokenStart++;
+ nTokenLength--;
+ }
+ while ( nTokenLength > 0
+ && isspace(pTokenStart[nTokenLength-1]) )
+ {
+ nTokenLength--;
+ }
+ // Add token to tag values list.
+ pCurTagData->push_back(ByteString(pTokenStart,nTokenLength));
+ }
+ else
+ {
+ nTokenLength++;
+ ++pBufferPosition;
+ } // endif (!bWithinElement) else if () else
+ break;
+ default:
+ if (bWithinElement)
+ {
+ ++nTokenLength;
+ }
+ ++pBufferPosition;
+ } // end switch
+ } // end for
+
+ if (bWithinElement)
+ {
+ eStatus = inconsistent_file;
+ return FALSE;
+ }
+ } // end for
+
+ return TRUE;
+}
+
+INT32
+CompDescrsFromAnXmlFile::NrOfDescriptions() const
+{
+ return dpDescriptions->size();
+}
+
+const ComponentDescription &
+CompDescrsFromAnXmlFile::operator[](INT32 i_nIndex) const
+{
+ static const ComponentDescriptionImpl aNullDescr_;
+ return 0 <= i_nIndex && i_nIndex < dpDescriptions->size()
+ ? *(*dpDescriptions)[i_nIndex]
+ : aNullDescr_;
+}
+
+void
+CompDescrsFromAnXmlFile::Empty()
+{
+ for ( std::vector< ComponentDescriptionImpl* >::iterator aIter = dpDescriptions->begin();
+ aIter != dpDescriptions->end();
+ ++aIter )
+ {
+ delete *aIter;
+ }
+ dpDescriptions->erase( dpDescriptions->begin(),
+ dpDescriptions->end() );
+}
+
+
+
diff --git a/xml2cmp/source/x2cclass/xml_cdff.hxx b/xml2cmp/source/x2cclass/xml_cdff.hxx
new file mode 100644
index 000000000..05a6af0f7
--- /dev/null
+++ b/xml2cmp/source/x2cclass/xml_cdff.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * $RCSfile: xml_cdff.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef UDKSERVICE_XML_CDFF_HXX
+#define UDKSERVICE_XML_CDFF_HXX
+
+
+#include <tools/string.hxx>
+#include "xml_cd.hxx"
+
+class ComponentDescriptionImpl;
+
+
+/** @descr
+ Is able to parse an XML file with Component descriptions. Gives access
+ to the parsed data.
+
+ Use:
+ CompDescrsFromAnXmlFile aCds;
+ UniString aFilepath(...);
+ if (! aCds.Parse(aFilepath) )
+ {
+ // react on:
+ aCds.Status();
+ }
+
+ With operator[] you get access to ComponentDescriptions
+ on indices 0 to NrOfDescriptions()-1 .
+
+ For further handling see class ComponentDescription
+ in xml_cd.hxx .
+
+ It is possible to parse more than one time. Then the old data
+ are discarded.
+**/
+class CompDescrsFromAnXmlFile
+{
+ public:
+ enum E_Status
+ {
+ ok = 0,
+ not_yet_parsed,
+ cant_read_file,
+ inconsistent_file,
+ no_tag_found_in_file
+ };
+
+ // LIFECYCLE
+ CompDescrsFromAnXmlFile();
+ ~CompDescrsFromAnXmlFile();
+
+ // OPERATIONS
+ BOOL Parse(
+ const UniString & i_sXmlFilePath );
+
+ // INQUIRY
+ INT32 NrOfDescriptions() const;
+ const ComponentDescription &
+ operator[]( /// @return an empty description, if index does not exist.
+ INT32 i_nIndex ) const;
+ CompDescrsFromAnXmlFile::E_Status
+ Status() const;
+
+ private:
+ // PRIVATE SERVICES
+ void Empty();
+
+ // DATA
+ std::vector< ComponentDescriptionImpl* > *
+ dpDescriptions;
+ E_Status eStatus;
+};
+
+
+
+
+
+#endif
+
+
diff --git a/xml2cmp/source/x2cclass/xml_cdim.cxx b/xml2cmp/source/x2cclass/xml_cdim.cxx
new file mode 100644
index 000000000..82526edc0
--- /dev/null
+++ b/xml2cmp/source/x2cclass/xml_cdim.cxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * $RCSfile: xml_cdim.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "xml_cdim.hxx"
+
+const char ComponentDescriptionImpl::C_sTagDescription[]
+ = "COMPONENTDESCRIPTION";
+const char ComponentDescriptionImpl::C_sStatus[]
+ = "Status";
+const char * ComponentDescriptionImpl::C_sSubTags[ComponentDescription::tag_MAX]
+ = { "None",
+ "Name",
+ "Description",
+ "ModuleName",
+ "LoaderName",
+ "SupportedService",
+ "ProjectBuildDependency",
+ "RuntimeModuleDependency",
+ "ServiceDependency",
+ "Language",
+ C_sStatus,
+ "Type"
+ };
+
+ComponentDescriptionImpl::ComponentDescriptionImpl()
+// : aTags
+{
+ const int i_max = tag_MAX;
+ aTags.reserve(i_max);
+
+ for (int i = 0; i < i_max; ++i)
+ {
+ aTags.push_back( new ValueList(E_Tag(i)) );
+ } // end for
+}
+
+ComponentDescriptionImpl::~ComponentDescriptionImpl()
+{
+ for ( std::vector< ValueList* >::iterator aIter = aTags.begin();
+ aIter != aTags.end();
+ ++aIter )
+ {
+ delete *aIter;
+ }
+}
+
+inline void
+GetStatusValue( ByteString & o_sValue, const ByteString & i_sStatusTag )
+{
+ // o_sValue is always == "" at the beginning.
+
+ const char * pStatusValue = strchr(i_sStatusTag.GetBuffer(), '"');
+ if (pStatusValue == 0)
+ return;
+ pStatusValue++;
+ const char * pStatusValueEnd = strrchr(pStatusValue,'"');
+ if (pStatusValueEnd == 0 || pStatusValueEnd - pStatusValue < 1)
+ return ;
+
+ ByteString sValue(pStatusValue, pStatusValueEnd - pStatusValue);
+ o_sValue = sValue;
+}
+
+ComponentDescriptionImpl::ValueList *
+ComponentDescriptionImpl::GetBeginTag( ByteString & o_sValue,
+ const char *& io_pStartOfTag ) const
+{
+ o_sValue = "";
+
+ const char * pCurTextEnd = strchr(io_pStartOfTag,'>');
+ if ( 0 == pCurTextEnd )
+ return 0;
+
+ if ( ComponentDescriptionImpl::CheckEndOfDescription(io_pStartOfTag) )
+ return 0;
+
+ ByteString sTag(io_pStartOfTag + 1, pCurTextEnd - io_pStartOfTag - 1);
+ io_pStartOfTag += sTag.Len() + 2;
+
+ // Special case <Status ... >
+ if ( strnicmp(C_sStatus, sTag.GetBuffer(), (sizeof C_sStatus) - 1 ) == 0 )
+ {
+ GetStatusValue(o_sValue,sTag);
+ return aTags[tag_Status];
+ }
+
+ // Regular seeking for matching data list:
+ for ( INT32 i = 0; i < tag_MAX; i++ )
+ {
+ if ( 0 == stricmp(sTag.GetBuffer(), C_sSubTags[i]) )
+ return aTags[i];
+ } // end for
+
+ return 0;
+}
+
+const std::vector< ByteString > &
+ComponentDescriptionImpl::DataOf( ComponentDescriptionImpl::E_Tag i_eTag ) const
+{
+ if (0 < i_eTag && i_eTag < tag_MAX)
+ return *aTags[i_eTag];
+ else
+ return ValueList::Null_();
+}
+
+ByteString
+ComponentDescriptionImpl::DatumOf( ComponentDescriptionImpl::E_Tag i_eTag ) const
+{
+ if (0 < i_eTag && i_eTag < tag_MAX)
+ {
+ ValueList & rValues = *aTags[i_eTag];
+ if (rValues.size() > 0)
+ return rValues[0];
+ }
+ return "";
+}
+
+void
+ComponentDescriptionImpl::ParseUntilStartOfDescription( const char * & io_pBufferPosition )
+{
+ for ( const char * pSearch = strchr(io_pBufferPosition,'<');
+ pSearch != 0;
+ pSearch = strchr(pSearch+1,'<') )
+ {
+ if ( pSearch != io_pBufferPosition
+ && 0 == strnicmp(pSearch+1,C_sTagDescription, strlen(C_sTagDescription))
+ && *(pSearch + strlen(C_sTagDescription) + 1) == '>' )
+ {
+ io_pBufferPosition = pSearch + strlen(C_sTagDescription) + 2;
+ return;
+ }
+ } // end for
+
+ io_pBufferPosition = 0;
+}
+
+BOOL
+ComponentDescriptionImpl::ValueList::MatchesEndTag( const char * i_pTextPosition ) const
+{
+ return strnicmp( i_pTextPosition+2, C_sSubTags[eTag], strlen(C_sSubTags[eTag]) ) == 0
+ && strncmp(i_pTextPosition,"</",2) == 0
+ && *(i_pTextPosition + 2 + strlen(C_sSubTags[eTag]) ) == '>';
+}
+
+INT32
+ComponentDescriptionImpl::ValueList::EndTagLength() const
+{
+ return strlen(C_sSubTags[eTag]) + 3;
+}
+
+
+const ComponentDescriptionImpl::ValueList &
+ComponentDescriptionImpl::ValueList::Null_()
+{
+ static const ValueList aNull_(ComponentDescription::tag_None);
+ return aNull_;
+}
+
+
diff --git a/xml2cmp/source/x2cclass/xml_cdim.hxx b/xml2cmp/source/x2cclass/xml_cdim.hxx
new file mode 100644
index 000000000..f32584f62
--- /dev/null
+++ b/xml2cmp/source/x2cclass/xml_cdim.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * $RCSfile: xml_cdim.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef UDKSERVICE_XML_CDIM_HXX
+#define UDKSERVICE_XML_CDIM_HXX
+
+
+#include "xml_cd.hxx"
+#include <tools/string.hxx>
+
+
+
+
+
+/** Represents one of the Component descriptions in an XML file.
+ Implements ComponentDescription and does part of the parsing for class CompDescrsFromAnXmlFile.
+**/
+class ComponentDescriptionImpl : public ComponentDescription
+{
+ public:
+ class ValueList : public std::vector< ByteString >
+ {
+ public:
+ // LIFECYCLE
+ ValueList(
+ E_Tag i_eTag )
+ : eTag(i_eTag) {}
+ // INQUIRY
+ const char * BeginTag() const;
+ BOOL MatchesEndTag(
+ const char * i_pTextPosition ) const;
+ INT32 EndTagLength() const;
+
+ static const ValueList &
+ Null_();
+ private:
+ E_Tag eTag;
+ };
+
+ // LIFECYCLE
+ ComponentDescriptionImpl();
+ virtual ~ComponentDescriptionImpl();
+
+ // OPERATIONS
+ ValueList * GetBeginTag(
+ ByteString & o_sValue,
+ const char * & io_pStartOfTag ) const;
+ static void ParseUntilStartOfDescription(
+ const char * & io_pBufferPosition );
+ static BOOL CheckEndOfDescription(
+ const char * & io_pBufferPosition );
+ // INQUIRY
+ static INT32 DescriptionEndTagSize();
+
+ // INTERFACE ComponentDescription
+ // INQUIRY
+ virtual const std::vector< ByteString > &
+ DataOf( /// @return All values of this tag.
+ ComponentDescription::E_Tag
+ i_eTag ) const;
+ virtual ByteString DatumOf( /// @return The only or the first value of this tag.
+ ComponentDescription::E_Tag
+ i_eTag ) const;
+ private:
+ // DATA
+ static const char C_sTagDescription[];
+ static const char C_sStatus[];
+ static const char * C_sSubTags[ComponentDescription::tag_MAX];
+ friend class ValueList;
+
+ std::vector< ValueList* > // Dynamic allocated pointers.
+ aTags;
+};
+
+
+inline BOOL
+ComponentDescriptionImpl::CheckEndOfDescription( const char * & io_pBufferPosition )
+ { return strnicmp(io_pBufferPosition + 2, C_sTagDescription, strlen(C_sTagDescription)) == 0
+ && strncmp(io_pBufferPosition, "</", 2) == 0
+ && * (io_pBufferPosition + 2 + strlen(C_sTagDescription)) == '>'; }
+
+inline INT32
+ComponentDescriptionImpl::DescriptionEndTagSize()
+ { return strlen(C_sTagDescription) + 3; }
+
+
+#endif
+
+